Skip to main content
100%

Jogo Jokenpo em Ruby

✓ Published0🌍 Public
SSeralto
Last edited May 9, 2016
Created on May 9, 2016

This example shows a command-line Rock-Paper-Scissors game implemented in Ruby, where a player competes against a randomly choosing computer opponent. The code defines a `calcula_vencedor` function that determines the winner based on the modulo of the difference between choices, while a hash maps numeric options to the game’s three gestures. The main loop uses `gets` for player input, validates choices, and generates the computer’s pick with `Random.rand`. The program runs repeatedly until the player opts out, ending with a farewell message.

AI-generated description

Similar vizzes