Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

refactored - a game is now expressible as a pure function

you pass it winlogic, and a (player, throws) tuple where throws is a possibly
infinite sequence of throws.  right now it's backed by prompted-for input
from the console
latest commit 29c58f9687
Nate Young authored September 27, 2010
Octocat-spinner-32 hs reorganized into language-per-folder September 25, 2010
Octocat-spinner-32 java reorganized into language-per-folder September 25, 2010
Octocat-spinner-32 rps refactored - a game is now expressible as a pure function September 27, 2010
Octocat-spinner-32 .gitignore Adding my Haskell code for easy reference and comparison February 08, 2010
Octocat-spinner-32 README reorganized into language-per-folder September 25, 2010
README
Rock Paper Scissors
----
Write an interactive game of Rock, Paper, Scissors.

There will be two players, the program should prompt each in turn for their name
and then each for their "throw" until notifying that one or the other has one.

$ java RockPaperScissors
Player 1 Name: Nate
Player 2 Name: Ben
[R]ock, [P]aper, or [S]cissors? R
[R]ock, [P]aper, or [S]cissors? P
Ben Wins!

The program should be easily modifiable to handle the following
score scenarios:
  "First to X" - winner is the first player to win X matches
  "Best of X" - winner is the first one to win more than 50% of X matches, only the required number of matches should be played
  "To X, win by Y" - winner is first one to win X or more matches, by a margin of Y

There's no need to drag XML into this, command line options should be preferred.

$ java RockPaperScissors -to 5
$ java RockPaperScissors -bestof 5
$ java RockPaperScissors -to 5 -by 2

Originally this was an excercise in TDD and Java, but it's moved beyond that
into Haskell, Clojure and Ruby.  I'm interested in how Test-Driven Development 
guides your design decisions, so it would be helpful if your commit log left a 
concise and explanatory trail of what you did and why.  git rebase --interactive 
may be helpful in revising the past in this regard.

No tricks, here, just an excercise in writing small, complete software.
Something went wrong with that request. Please try again.