logo Use CA10RAM to get 10%* Discount.
Order Nowlogo

The goal of this project is to implement the game Hey, that’s my Fish! using the C programming language.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Project Profile

The goal of this project is to implement the game Hey, that’s my Fish! using the C programming language. The game will be interactive and played between a human user and an AI (artificial intelligence). The focus of this project is primarily on exercising an introductory understanding of the C programming language including basic data types, looping and conditional constructs, arrays, iteration, basic I/O, formatted output, and functions.  This semester, all projects are individual work (not done in groups), unlike the challenges and labs!

Hey, that’s my Fish

Traditionally, Hey’ that my Fish! game is a 2-4 player game in which the players first choose a color of penguins and then take turns moving one of his/her penguins in a straight line as far as he/she wishes, as long as there is a continuous line of vacant hexagons between the penguin's starting and destination hexagons. The hexagons has 1-3 points and will be collected when player’s penguin move out from it. The objective of the game is to collect the most points in the game to win. Please see the Wikipedia entry for more details. In your implementation you will use P (for Player) and A (for AI) characters in place of the colors. In this project, you only need to implement this game for two players and each only has 1 penguin to play in this game. Please use ‘P’ as player’s penguin and ‘A’ to represent the AI’s penguin. Also, we change hexagons to octagon.

 

Game Board

The game board is a 6-column by 6-row suspended grid. The rows are labeled 1 - 6 and the columns are labeled 1 - 6. This is the initial game board:

 

   1 2 3 4 5 6

1  1 1 1 1 1 1

2  1 2 2 2 2 1

3  1 2 3 3 2 1

4  1 2 3 3 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

 

The rows are labeled from top to bottom starting with 1, and the columns are labeled from left to right starting with 1. The number in the table(i, j) means the point of octagon at row i and column j. If the octagon was taken, please use “.” to represent it. Here is an example state of the game:

   1 2 3 4 5 6

1  . P 1 1 1 .

2  . . 2 2 2 1

3  1 2 . . 2 1

4  1 2 A . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

 

Game Play

Your implementation will prompt the user before game play to determine where (which octagon) player’s penguin is. Both players can only select an octagon with 1 point as a starting point. In your implementation, have the human player take the first move. When it is the human’s turn the game will prompt the player for which (row, column) she would like to move in the game board. For example, using the above game state, if the human player chooses (2,3) the resulting game state would be:

   1 2 3 4 5 6

1  . . 1 1 1 .

2  . . P 2 2 1

3  1 2 . . 2 1

4  1 2 A . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

 

Notice that the player cannot choose (3, 2) since the octagon(2, 2) was taken and there’s no path from octagon(1,2) to it. You need to tell the player if she chooses an invalid move, like (3, 2) in this situation, and ask the player to choose another move. The next move would be decided by the AI player, followed by prompting the human player again. Game play would then proceed in that fashion. Here is an example of the game playing out to completion:

 

   1 2 3 4 5 6

1  . 1 1 1 1 .

2  . . P 2 2 1

3  1 2 . . 2 1

4  1 A . . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

   1 2 3 4 5 6

1  . 1 1 1 1 .

2  . . . P 2 1

3  1 2 . . 2 1

4  1 A . . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

   1 2 3 4 5 6

1  . 1 1 1 1 .

2  . . . P 2 1

3  1 2 . . 2 1

4  1 . . . 2 1

5  1 A 2 2 2 1

6  1 1 1 1 1 1

   1 2 3 4 5 6

1  . 1 1 1 1 .

2  . . . . P 1

3  1 2 . . 2 1

4  1 . . . 2 1

5  1 A 2 2 2 1

6  1 1 1 1 1 1

 

A valid path: the path your penguin moves through contains no empty spot (see . in the map) or another penguin.

Both Player and AI can move as many squares as they want, so long as it's in a straight line and there’s still a path. See the exam below, the player/AI can move from (1, 2) to (1, 5) and from (1, 5) to (6, 5), but cannot move from (6, 5) to (3, 2).

   1 2 3 4 5 6

1  . . 1 1 P .

2  . . 2 2 2 1

3  1 2 . . 2 1

4  1 2 . . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 1 1

   1 2 3 4 5 6

1  . . 1 1 . .

2  . . 2 2 2 1

3  1 2 . . 2 1

4  1 2 . . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 P 1

   1 2 3 4 5 6

1  . . 1 1 . .

2  . . 2 2 2 1

3  1 2 . . 2 1

4  1 2 . . 2 1

5  1 2 2 2 2 1

6  1 1 1 1 P 1

 

If one of the players don’t have any achievable octagon left, print a message saying so and skip that player’s turn until both players don’t have any achievable octagon left and the game is over. See the example below, after the player’s last term, the AI move twice and end the game.

  

   1 2 3 4 5 6

1  . . . . . .

2  . . P 2 . 1

3  1 2 . . . 1

4  . A . . 2 1

5  . 2 . . . .

6  . . . . . .

   1 2 3 4 5 6

1  . . . . . .

2  . . . P . 1

3  1 2 . . . 1

4  . A . . 2 1

5  . 2 . . . .

6  . . . . . .

 1 2 3 4 5 6

1  . . . . . .

2  . . . P . 1

3  1 A . . . 1

4  . . . . 2 1

5  . 2 . . . .

6  . . . . . .

 1 2 3 4 5 6

1  . . . . . .

2  . . . P . 1

3  A . . . . 1

4  . . . . 2 1

5  . 2 . . . .

6  . . . . . .

 

When both players cannot move, output the points acquired by each player in order and announce the winner. For example (though a real game would probably have a longer record):

Player’s points: 1+3+1+1+2+3 = 11

AI’s points: 1+2+2+1+3+1 = 10

Player wins!

Requirements

Your primary objective is to use the C programming language to design and implement Hey’ that my Fish! game that operates according to the game play described in the previous section. You are required to design and implement the appropriate data structures and corresponding algorithms that will enable a human player to play against an AI player. 

 

The AI design is entirely up to you, however, it should be at least as smart as a 5 year old playing the game. That is, the AI should make some obvious choices such as chasing the achievable octagon with maximal point. If you have taken a course in Artificial Intelligence you are welcome to make your AI more sophisticated (e.g., Minimax), however, this is not required. Furthermore, you are constrained to using only the C constructs that we have covered up through the first week of class. In particular:

 

Allowable C Language Constructs

printf

basic C data types and variables (int, float, double, char, _Byte/byte)

storage sizes and ranges

type specifiers

arithmetic expressions

for, while, do loop, if statement, switch, conditional operator

aligning output

scanf

 

1D array and initialization

const

multi-dim arrays

variable length arrays

array length bounds, iteration, length

functions, arguments, locals, returns

prototype declaration

functions and arrays, mutability

global variables

automatic/static variables

 

In addition, your implementation must meet the following specific requirements:

 

An array must be used to represent the game board as described above.

Must be able to take “row column” as user input (i.e. “2 4” to play the tile in the second row and fourth column).

One or more functions must be used as part of the implementation.

Arrays must be passed to functions as arguments.

Iteration must be used to traverse the game board.

Your implementation must be able to determine end state of game: win, lose, or draw with both player’s total points.

An AI must exist in your game as described above.

You should minimize the use of global variables - no global variables is the best.

Your implementation must show the state of the game, modeled after our examples above, after each move (both human and AI) and display the final game state, who won or who drew, along with the recorded points in the form mentioned in the previous section. All output should be properly formatted and aligned.

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

913 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

521 Answers

Hire Me
expert
Husnain SaeedComputer science

925 Answers

Hire Me
expert
Atharva PatilComputer science

944 Answers

Hire Me