-
Notifications
You must be signed in to change notification settings - Fork 0
An implementation of the popular board game, 'Hey, That's my Fish!' is C without the use of arrays
License
urvishramaiya/ThatsMyFish
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project was approached in a modular fashion. Each task was identified and broken down into smaller pieces and delegated to separate functions to enhance clarity and readability. To start off, the grid was defined in a struct and memory was allocated using malloc for the exact number of grid cells required for the game. The player struct defined the human and AI. The task is assigning the grid structs point values, followed by using the defined pointers to link the cells in each of 8 directions. The grid struct definition contains 8 pointers of the type of the defined struct that allow each individual grid cell to point to other cells of the grid struct type simply by equating the pointers to the grid cells. This allows for easy navigation across the game board for the purpose of moving the player and AI around. The player moves by entering input structured in the format of DIRECTION SPACES, which is interpreted by the program and converted into movement on the game board. If an invalid move is entered, such as trying to cross a '.' cell, the game will prompt a new input. After the human player makes their move, the AI uses a defined function to find an accessible spot on the board that will award it maximum points. The process involves the function iterating through each of the cells in every direction until a '.' cell or board edge is encountered. The identified cell is returned to the main function where it is passed along to a move function that updates AI position and points accrued. The game also includes checks for a deadlock scenario that prevents either player from moving, and allows the other player to continue making moves. Once both players are stuck, the game if declared over, scores are displayed and a player is announced as the winner.
About
An implementation of the popular board game, 'Hey, That's my Fish!' is C without the use of arrays
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published