DEV Community

loading...

Discussion on: Daily Challenge #43 - Boardgame Fight Resolver

Collapse
arctic_kona profile image
Arctic Kona


#!/bin/bash

# ( attack , defend )
# archer: 1; swordsmen: 2; pikemen: 3; cavalry: 4;
function fightResolve {
    echo "$1$2" | grep -qEe '(21|32|43|14)' - &&
        return $2
    return $1
}