Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The while loop represents the game.
- # Each iteration represents a turn of the game
- # where you are given inputs (the heights of the mountains)
- # and where you have to print an output (the index of the mountain to fire on)
- # The inputs you are given are automatically updated according to your last actions.
- index_highest_mountain="0"
- max_highest_mounter="0"
- # game loop
- while true; do
- for ((i=0; i<8; i++)); do
- # mountainH: représente la hauteur d'une montagne.
- read -r mountainH
- if [[ "$max_highest_mounter" -lt "$mountainH" ]]; then
- max_highest_mounter="$mountainH"
- index_highest_mountain="$i"
- fi
- done
- printf "%s\n" "$index_highest_mountain"
- max_highest_mounter="0"
- index_highest_mountain="0"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement