A quick fight game made in bash
#!/bin/bash
health=10
enemy=10
while [[ $health > 0 && $enemy > 0 ]]
do
echo You: $health
echo Enemy: $enemy
input=
while [[ $input != 0 && $input != 1 ]]
do
echo "Pick a number (0-1)"
read input
if [[ $input != 0 && $input != 1 ]]; then
echo "Wrong input"
fi
done
hit=$(( $RANDOM % 2 ))
if [[ $input == $hit ]]; then
((enemy--))
else
((health--))
fi
done
if [[ $health == 0 ]]; then
echo "You Died"
else
echo "You defeated the beast"
fi
Save this as a file named fight.sh onto any linux system, chmod +x it, run it and have fun