summaryrefslogtreecommitdiff
path: root/src/Q2
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q2')
-rw-r--r--src/Q2/README.md229
1 files changed, 114 insertions, 115 deletions
diff --git a/src/Q2/README.md b/src/Q2/README.md
index f226423..68676b6 100644
--- a/src/Q2/README.md
+++ b/src/Q2/README.md
@@ -3,118 +3,117 @@ Learning Profile for Assignment #2, And Question #2
Name: Mo Khan
Student ID: 3431709
-1. Problem Statement:
-
-```text
-Write a program that plays the Rock-Paper-Scissors-Lizard-Spock game.
-Refer to http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock for more information.
-Normally, one player is a human and the other is the computer program.
-However, in this exercise, the program will generate two players who play against each other.
-The play continues until either of the computer-generated players wins four consecutive times.
-In this game, two random integers are generated in the range of [1 to 5], one per player.
-1 refers to Rock, 2 refers to Paper, 3 refers to Scissors, 4 refers to Lizard, and 5 refers to Spock.
-
-For example, if the computer randomly generates integers 2 and 5 in the first iteration,
-2 is for the first player and 5 is for the second player.
-Based on Rule 8 in the following 10 rules, Paper (2) disproves Spock (5), so Player 1 wins.
-Repeat it to generate one more pair and determine who wins that iteration.
-Continue the iterations until one player wins four consecutive times.
-
-Rule 1: Scissors cut paper
-Rule 2: Paper covers rock
-Rule 3: Rock crushes lizard
-Rule 4: Lizard poisons Spock
-Rule 5: Spock smashes (or melts) scissors
-Rule 6: Scissors decapitate lizard
-Rule 7: Lizard eats paper
-Rule 8: Paper disproves Spock
-Rule 9: Spock vaporizes rock
-Rule 10: Rock breaks scissors
-```
-
-2. Description of the Code:
-
-The main game loop can be found in `main`. This will loop until a winner
-has won at least 4 consecutive times.
-
-The `Random` class is used to generate a pseudo random number between
-0 - 4. To keep the numbers between 1 - 5, I have incremented this value
-by 1.
-
-The `play` method prints out the choice for both players, then
-determines the winner and adjusts the last winner and consecutive wins
-fields based on the winner.
-
-3. Errors and Warnings:
-
-When a tie occurs, I assume the previous winner remains the current
-winner.
-
-This program does not require any user input so the possibilities
-remains low. A possible condition that can occur is an infinite loop due
-to the random number generator producing results that does not allow a
-single player to win 4 consecutive times. One way to handle this
-scenario, is to set a maximum number of rounds that can be played. I
-chose not to implement this.
-
-4. Sample Input and Output:
-
-An example of a short game:
-
-```bash
-Starting a new game of Rock, paper, scissors, lizard, spock...
-
-Round: 1
---------------------------------------
-Player 1: scissor
-Player 2: paper
-Player 1 has 1 consecutive wins.
-
-Round: 2
---------------------------------------
-Player 1: scissor
-Player 2: lizard
-Player 1 has 2 consecutive wins.
-
-Round: 3
---------------------------------------
-Player 1: rock
-Player 2: lizard
-Player 1 has 3 consecutive wins.
-
-Round: 4
---------------------------------------
-Player 1: paper
-Player 2: rock
-Player 1 has 4 consecutive wins.
-
-**************************************
- The winner is player 1!
-**************************************
-```
-
-An example of a longer game:
-```bash
-...
-Round: 72
---------------------------------------
-Player 1: paper
-Player 2: paper
-Player 1 has 3 consecutive wins.
-
-Round: 73
---------------------------------------
-Player 1: rock
-Player 2: scissor
-Player 1 has 4 consecutive wins.
-
-**************************************
- The winner is player 1!
-**************************************
-```
-
-5. Discussion:
-
-I chose to print additional information to the console to make it
-easier to see how many rounds were played and to ensure that the
-correct winner is determined.
+1. Problem Statement
+
+ Write a program that plays the Rock-Paper-Scissors-Lizard-Spock game.
+ Refer to http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock for more information.
+ Normally, one player is a human and the other is the computer program.
+ However, in this exercise, the program will generate two players who play against each other.
+ The play continues until either of the computer-generated players wins four consecutive times.
+ In this game, two random integers are generated in the range of [1 to 5], one per player.
+ 1 refers to Rock, 2 refers to Paper, 3 refers to Scissors, 4 refers to Lizard, and 5 refers to Spock.
+
+ For example, if the computer randomly generates integers 2 and 5 in the first iteration,
+ 2 is for the first player and 5 is for the second player.
+ Based on Rule 8 in the following 10 rules, Paper (2) disproves Spock (5), so Player 1 wins.
+ Repeat it to generate one more pair and determine who wins that iteration.
+ Continue the iterations until one player wins four consecutive times.
+
+ 1. Scissors cut paper
+ 1. Paper covers rock
+ 1. Rock crushes lizard
+ 1. Lizard poisons Spock
+ 1. Spock smashes (or melts) scissors
+ 1. Scissors decapitate lizard
+ 1. Lizard eats paper
+ 1. Paper disproves Spock
+ 1. Spock vaporizes rock
+ 1. Rock breaks scissors
+
+1. Description of the Code
+
+ The main game loop can be found in `main`. This will loop until a winner
+ has won at least 4 consecutive times.
+
+ The `Random` class is used to generate a pseudo random number between
+ 0 - 4. To keep the numbers between 1 - 5, I have incremented this value
+ by 1.
+
+ The `play` method prints out the choice for both players, then
+ determines the winner and adjusts the last winner and consecutive wins
+ fields based on the winner.
+
+1. Errors and Warnings
+
+ When a tie occurs, I assume the previous winner remains the current
+ winner.
+
+ This program does not require any user input so the possibilities
+ remains low. A possible condition that can occur is an infinite loop due
+ to the random number generator producing results that does not allow a
+ single player to win 4 consecutive times. One way to handle this
+ scenario, is to set a maximum number of rounds that can be played. I
+ chose not to implement this.
+
+1. Sample Input and Output
+
+ 1. An example of a short game:
+
+ ```bash
+ Starting a new game of Rock, paper, scissors, lizard, spock...
+
+ Round: 1
+ --------------------------------------
+ Player 1: scissor
+ Player 2: paper
+ Player 1 has 1 consecutive wins.
+
+ Round: 2
+ --------------------------------------
+ Player 1: scissor
+ Player 2: lizard
+ Player 1 has 2 consecutive wins.
+
+ Round: 3
+ --------------------------------------
+ Player 1: rock
+ Player 2: lizard
+ Player 1 has 3 consecutive wins.
+
+ Round: 4
+ --------------------------------------
+ Player 1: paper
+ Player 2: rock
+ Player 1 has 4 consecutive wins.
+
+ **************************************
+ The winner is player 1!
+ **************************************
+ ```
+
+ 1. An example of a longer game:
+
+ ```bash
+ ...
+ Round: 72
+ --------------------------------------
+ Player 1: paper
+ Player 2: paper
+ Player 1 has 3 consecutive wins.
+
+ Round: 73
+ --------------------------------------
+ Player 1: rock
+ Player 2: scissor
+ Player 1 has 4 consecutive wins.
+
+ **************************************
+ The winner is player 1!
+ **************************************
+ ```
+
+1. Discussion
+
+ I chose to print additional information to the console to make it
+ easier to see how many rounds were played and to ensure that the
+ correct winner is determined.