Games: Rock Paper Scissors
Mix.install([
{:jason, "~> 1.4"},
{:kino, "~> 0.9", override: true},
{:youtube, github: "brooklinjazz/youtube"},
{:hidden_cell, github: "brooklinjazz/hidden_cell"}
])
Navigation
Home Report An Issue Games: Guessing GameExUnitGames: Rock Paper Scissors
In your existing Games project, you’re going to create a rock paper scissors game where players will play against an AI which randomly chooses rock, paper, or scissors.
You should be able to start your project by running the following from the game
folder in
the command line.
iex -S mix
Then you can start the rock paper scissors game with a Games.RockPaperScissors
module.
The game should prompt the user for a choice of "rock"
, "paper"
, or "scissors"
.
iex> Games.RockPaperScissors.play()
(rock/paper/scissors): scissors
The game should generate a random AI choice of "rock"
, "paper"
, or "scissors"
, then prompt the user with feedback if they win, lose, or draw.
# Ai Choice: Paper
Choose rock, paper, or scissors: scissors
"You win! scissors beats paper."
# Ai Choice: Scissors
Choose rock, paper, or scissors: paper
"You lose! scissors beats paper."
# Ai Choice: Rock
Choose rock, paper, or scissors: rock
"It's a tie!"
Commit Your Progress
DockYard Academy now recommends you use the latest Release rather than forking or cloning our repository.
Run git status
to ensure there are no undesirable changes.
Then run the following in your command line from the curriculum
folder to commit your progress.
$ git add .
$ git commit -m "finish Games: Rock Paper Scissors exercise"
$ git push
We’re proud to offer our open-source curriculum free of charge for anyone to learn from at their own pace.
We also offer a paid course where you can learn from an instructor alongside a cohort of your peers. We will accept applications for the June-August 2023 cohort soon.