Open
Conversation
| For my final project I would like to make a battleship game. The rules will be very similar to the classic board game except the user will be able to customize their level and how large/small they would like the board to be. The easier the level, the more ships will be placed on the board (for a higher probability of hitting the ships). Depending on how much time it takes to code the basic parts of the game, I may have the board write to an external file, but I most likely will just print the board and the computer's moves. | ||
| This project will use a lot of arrays and conditional statements. The board will be a 2D array and the conditional statements will represent different scenarios, for example if the user hits a ship. It will also use functions so, instead of rewriting what happens when a ship is hit, I can just call a function to change the score/lives. The entire game will be in a loop while the user has ships left. | ||
| I would like to make this project because Battleship is a popular game and I think that it combines many of the topics we have covered. I have made many games in the past in Java but this would be my first of this type and in C. | ||
| I plan on using the standard input/output library as well as <assert.h> to check if certain conditions are met (like hitting a ship) and <time.h> to choose random spots to place the ship. These are the only ones I can think of now but I may have to add more as I go. |
Contributor
There was a problem hiding this comment.
In the classic game of Battleship, the ships are of varying sizes. Do you plan on doing this or do you intend to just make them a fixed size? And does your player select where the ships will be placed or will they be random?
The project sounds good. A suggestion I have is to place your functions in separate files (the definitions go in .c files and the prototypes go in the corresponding .h file) to help keep things organized. Also, it may be interesting to implement a very simple AI for the computer (assuming your ships are larger than 1 in size), where the computer aims in a smaller radius around where it hit until it sinks a ship as opposed to continuing to randomly pick locations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.