DEV Community

Discussion on: Daily Challenge #43 - Boardgame Fight Resolver

Collapse
 
konaarctic profile image
Kona Arctic • Edited


#!/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
}