samedi 23 février 2019

Battleship with C++

I am going to be honest. My college professor wants us to create a battleship game using C++, but I swear she has not taught us enough code and hasn't given us enough practice to complete such a task. This is an intro to coding course and everywhere I look online to do such a project seems to require code that she hasn't even mentioned like seeding and we covered srand() for like 5 minutes in class. I am actually desperate and I need help on how to even start the code... I know this is not the place to "make connections" or ask for such broad questions and this will get disliked causing me to not be able to ask another question for another 7 days, but I really need help. I semi-planned how I think the code should be laid out, but I have no idea how to even make an array from a seperate .txt file.

// Initialize default variables
// Create game board

// Loop till all ships are placed

// Game Loop Start
// Player inputs valid attack grid
// Check to see if attack is a hit
// Remove/add damage to hit ships
// Redraw game board
// Check to see if game is over
    // If game over - exit loop/end program
// Player guesses again
// Game Loop Return

Keep in mind, this game is 100% just 1 player. The player is trying to destroy a computer generated board and nothing else. The computer does not have a turn. The player does not have a board with ships. The play just has a visual to see whether they have hit or missed the computer's board. Also the ships are 3x1 (S S S) and are only horizontal on a 100x100 grid.

ANY help would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire