Online Go-Fish Card Game

Published

​[1] ​The standard 52-card pack is used. ​[2] ​The goal is to win the most "books" of cards. ​[3] ​A book is any four of a kind, such as four kings, four aces, etc. ​[4]​ First, a player is randomly chosen to be the dealer. ​[5] ​The dealer shuffles the cards then deals the cards clockwise one at a time, face down, beginning with the player to the left. ​[6] ​If two or three people are playing, each player receives seven cards. If four or five people are playing, each receives five cards. ​[7] The remaining cards are placed face down in the center to form the stock. ​[8] ​To begin playing, the player to the left of the dealer looks at any other player and tells them the rank of a card that they want, from ace down to two (for example, "Give me your kings,"). ​[9]​ The player who made the request must have at least one card of the rank that was asked for in their hand. ​[10]​ The player who is addressed must hand over all the cards requested. ​[11]​ If that player has none, they say, "Go fish!" and the player who made the request draws the top card of the stock and places it in their hand, ending their turn. ​[12]​ If a player successfully gets one or more cards, they can continue to ask for cards from anyone.

[13] ​If a player gets the fourth card of a book, the player shows all four cards, places them on the table face up in front of everyone, and continues their turn. ​[14] ​If a player has no cards in their hand, they may (when it's their turn to play), draw 1 card from the stack and ask for a card with that rank. If there are no cards left in the stack, they are out of the game. ​[15] T​ he game ends when all thirteen books have been claimed. ​[16] T​ he winner is the player with the most books.

Read More

RAFT Algorithm Design

Published

Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference is that it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems. We hope Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today.

Read More

RPC Interaction

Published

In distributed computing, a ​remote procedure call​ (​RPC​) is when a computer program causes a procedure to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.

Read More

Go-Fish Interaction Diagram

Published

Version 1 - `Go Fish` Server and Client interaction(s) [Not Adding RAFT algorithm] Our card game uses RPC calls such as `rpc.HandleHTTP()` for the server sides. One difficulty of implementing the server is to keep the server running to receive the proper requests such as the implementation in our AskForCards(). Meanwhile, the server needs to track who is winning the game in a loop cycle until the game finishes. Each player in our game is connected to a thread.To handle thread collision, our implementation applies the Mu.lock() and defer Mu.Unlock() to allow each player to interact with the server individually. The other Reply{} and Args{} struct for calling and receiving messages among client and server sides is defined in the assistant repository; however, until now we haven’t fully defined the vars inside the file.

Read More