首页 > > 详细

辅导ECE175 Go Fish调试R、R语言讲解留学生

Go Fish,C。

Requirement

You are to develop an interactive game of Go Fish between two players. In Go Fish, each player takes turns asking for a card with a specific rank or face from another player. The goal is to form a book (a set of 4 cards with the same face or rank). The player with the most books at the end of the game is declared the winner. The gameplay for Go

Fish is described at https://en.wikipedia.org/wiki/Go_Fish. Your program should operate as follows.

Setup

Go Fish cards are represented as variables of the following type:

1
2
3
4
5
typedef struct card_s #123;
char suit[7];
int value;
struct card_s *pt;
#125; card;

 

  1. You are allowed to add attributes to this definition, but not to remove any. You can represent colors by using card suits. Red: hearts; Yellow: diamonds; Green: clubs; Blue: spades. The action field is used to denote the function of action cards.
  2. The game is played with a standard 52-card deck.
  3. At the beginning, the user can choose to shuffle the deck or load a predefined sequence of cards from a file (for testing). The cards are stored in a file in a format of your choice. For instance, they could be stored in the form
  4. The deck is implemented by a dynamic list of cards. This can be a singly-linked or a doubly-linked list (recommended). The cards drawn from the deck are deleted from the list.
  5. Each player’s hand is implemented by a dynamic list of cards. The list is initially populated with the cards dealt to each player. The card drawn (played) by each player is added to (deleted from) the respective list.
  6. The pool of cards in the center is implemented as a dynamic list of cards that is shuffled at the beginning of your game. The cards drawn or discarded in the pile is added/deleted in a dynamic fashion.

Game Play

The gameplay is described at https://en.wikipedia.org/wiki/Go_Fish

Optional Features for Extra Credit

  1. Any number of players: Modify your code to work with more than two players. Look at the rule changes when more than 4 players participate (in terms of card dealing).
  2. Game variations: Implement at least four game variations, as they are described in the game description.
  3. Player automation: Automate one of the players to implement to play the game according to a winning strategy
  4. Graphics. Add graphics to your game. You can print cards using ascii art. For example.

Sample Execution

Note: You are encouraged to make your output look more appealing than what is given below. Your interface should display sufficient direction for a user to play the game. Get friends and family to play your game without much assistance.

It is very likely that you will not get the exact same code execution shown below. This is used to show you how the game should be played.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!