From 5877545b59b43ac56fa8971c0bc45163630a38c7 Mon Sep 17 00:00:00 2001 From: GuanHC1 <31777716+GuanHC1@users.noreply.github.com> Date: Thu, 19 Oct 2017 13:26:03 -0500 Subject: [PATCH] Create Hacktoberfest1 --- Hacktoberfest1 | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Hacktoberfest1 diff --git a/Hacktoberfest1 b/Hacktoberfest1 new file mode 100644 index 0000000..159b9f4 --- /dev/null +++ b/Hacktoberfest1 @@ -0,0 +1,42 @@ +Pseudo Code +On how to play Go Fish +Rules +Go Fish works using a simple deck of 52 cards. Each player has a hand, usually of five or seven cards. Each player takes turns, each turn asking if another player has a card or cards with a certain face value. If not, the asking player has to take another card. If the other player has the requested card, they must give all cards of that face value to the other player. If you have all four cards of a certain value, you may lay them down in a stack, face-up, which is called a book. Once all card values have been turned into books, the player with the most books wins. + + +Pseudo Code +* Create deck +* Set two players +* Distribute 5 cards from deck to both players +* On game start: + *Set turn to player 1 + *Loop until end of game: + *When player 1’s turn ends: + set turn to player 2 + *When player 2’s turn ends: + set turn to player 1 + * On player 1’s turn: + * Player 1 asks “Player 2, do you have any…” + * Insert card + * If Player 2 lacks the requested card(s): + * Player 2 says “Go Fish” + * Player 1 has to draw a card from the deck + * End player 1’s turn + * Else if Player 2 has requested card(s): + * Player 2 gives all requested card(s) to Player 1 + * Player 1 may ask again //This means player 1 can ask over and over until you have to Go Fish! +* On player 2’s turn: + * Player 2 asks “Player 1, do you have any…” + * Insert the value of a card after that + * If Player 2 lacks the requested card(s): + * Player 1 says “Go Fish” + * Player 2 has to draw a card from the deck + * End player 2’s turn + * If Player 2 has requested card(s): + * Player 1 gives all requested card(s) to Player 1 + * Player 2 may ask again +* If any player holds 4 of the same card: + * That card is put down as a book: and card == 0 +* If all books have been created: + * The player with the most cards wins +* Return 0