Youtube Battleship Videos
View some of the great videos from our library below, or visit our You Tube page for the full collection. Video Gallery. View some of the great videos from our library below, or visit our You Tube page for the full collection. Address // 1 Battleship Road, Wilmington, NC 28401 Phone // 910-399-9100. Two British Royal Navy battleships, the HMS Howe and HMS Anson, prepare for their first voyage during.
Battleship C++
The example is a video on youtube and here is the link:https://www.youtube.com/watch?v=b-9FK83iZ_8
This is what I have so far. I got some notes on here too, to tryto help make it better and complete it faster.
*What I need help the most is from 'void hideBoat()' andbelow that, but if you see anything that needs to be correted ormissing please let me know so I can fix it with yourhelp.
The program should do the following things and for credit itmust utilize at least 3 functions:
*Correctly print the instructions
*Correctly print the board (excluding the ship)
*Randomly places a ship on the board in a valid position
*Validates the player's input
- Accepts only rows A - E and columns 1 - 5 only
- Does not accept a guess that was made previously
*Allows the player 10 turns to sink the ship
- If the ship is sank in 10 turns the player wins, otherwise,the player loses
- At the end of the game the player can choose to play again andthe game restarts, otherwise, the game is exited
Introduction: Enrique Iglesias is a one of most popular Spanish singer, writer and actor. Enrique is considered as King of Latin Pop. Enrique has sold 159 records all around the world. He has scored 150 number of hits all of Billboard Charts.Iglesias most popular songs are Hero, Somebody me, Tonight, I Like it and Addicted. Enrique iglesias mp3 songs download 2018. Enrique Iglesias Songs Download- Listen to Enrique Iglesias new song MP3 free online. Play Enrique Iglesias hit songs and download Enrique Iglesias best MP3 songs. Download Bollywood Enrique Iglesias Singer, Composer, Music Producer, Most Popular Mp3 Song Of Enrique Iglesias Direct Link From Songspk, You Can Download Songs From. Singer Enrique Iglesias, the son of famous singer Julio Iglesias, was born in Madrid and lived there with his mother until 1982. Then his mother sent Enrique to his father in Miami, USA. But also a couple of new songs. Enrique’s new studio work titled Euphoria was released in 2010 and it became his first record, presenting the songs in.
Note: The example in the video displays 'S' where theship is located, this is for demonstration purposes only, myprogram should hide this by not displaying the 'S'characters.
My battleship box isn't exacly like the one on the videobut it is good enough for me so it doesn't need to befixed.
#include 'stdafx.h'
#include
#include
#include
using namespace std;
//Declare Function to print the instructions
void printInstructions();
void clearBoard();
void printBoard();
void hideBoat(); //Alot like set ship
void inputGuess();
bool isSquareOpen(int row, int col); //if the square is open
bool isGameWon();
//Declared the board to be displayed
//above main, it's global, it can be
//referenced throughout this program
const int SIZE = 5;
char displayBoard[SIZE][SIZE];
bool secretBoard[SIZE][SIZE];
int main()
{
srand((unsigned int)time(0));
char response = 'y';
while (response 'y')
{
printInstructions();
clearBoard(); Pc based obd2 scan tool.
hideBoat(); //hide the treasure in the board
printBoard();
while (!isGameWon())
{
inputGuess();
printBoard();
}
cout << 'Play again? (y/n)';
cin >> response;
}
//Game over
return 0;
}
//Implement the print instructions function
void printInstructions()
{
cout << 'Your goal is to sink the computers ship.'<< endl;
cout << 'The Computers's ship is only 3 spaces long.'<< endl;
cout << 'It is not diagonal.' << endl;
cout << 'Choose a position on the board (example A1).n'<< endl;
cout << 'You have 10 tries to sink the ship.' <<endl;
cout << endl;
}
void printBoard()
{
cout << ' ---------------------' << endl;
char crow = 'A';
for (int row = 0; row < SIZE; row++)
{
cout << crow << ' ' << displayBoard[row][0]<< ' ' <<
displayBoard[row][1] << ' ' <<displayBoard[row][2] << ' ' <<
displayBoard[row][3] << ' ' <<displayBoard[row][4] << ' ';
cout << endl;
cout << ' ---------------------' << endl;
crow++;
}
cout << ' 1 2 3 4 5n' << endl;
}
//Gets called between game play to reset the boards
void clearBoard()
{
for (int row = 0; row < SIZE; row++)
{
for (int col = 0; col < SIZE; col++)
{
displayBoard[row][col] = ' ';
secretBoard[row][col] = false;
}
}
}
? void hideBoat() ?
{
int row = rand() % SIZE; //Generate number between 0 andSIZE
int col = rand() % SIZE;
secretBoard[row][col] = true;
//The below code is for testing the example only
displayBoard[row][col] = '*';
//What about a ship??
//to represent the direction, generate a random number between 0and 1
//if the random number that represents direction is 0 put theship horizontally
//when the ship is horizontal
//assuming SIZE is 5
//Generate a random row between 0 and SIZE values between 0 and4
//Generate a random col between 0 and SIZE - values between 0and 2
//set secretBoard[row][col] = true, set secretBoard[row][col+1]to true,
//set secretBoard[row][col+2] = true;
//else if the random number that represents direction is 1 putthe ship vertically
//when the ship is horizontal
//assuming SIZE is 5
//Generate a random row between 0 and SIZE - values between 0and 2
//Generate a random col between 0 and SIZE values between 0 and4
//set secretBoard[row][col] = true, set secretBoard[row +1][col] to true,
//set secretBoard[row+2][col] = true;
}
void inputGuess()
{
char crow;
int col;
int row;
cout << 'You have ' << ? << 'guesses remaining.' << endl;
cout << 'Choose a cell: ';
cin >> crow >> col;
//Transpose user entry to 0 based indexes
col--;
row = int(crow - 65);
if (col < 0 col > 2 row < 0 row > 2 !isSquareOpen(row, col))
{
cout << 'Invalid Input. Try again.' << endl;
}
else if (secretBoard[row][col] true)
{
cout << 'Hit!';
displayBoard[row][col] = 'X';
secretBoard[row][col] = false;
}
else
{
cout << 'Miss!!';
displayBoard[row][col] = 'O';
}
}
bool isSquareOpen(int row, int col) //if the square is open
{
if (displayBoard[row][col] 'O')
return false;
return true;
}
bool isGameWon()
{
for (int row = 0; row < SIZE; row++)
{
for (int col = 0; col < SIZE; col++)
{
if (secretBoard[row][col] true)
{
return false;
}
}
}
return true;
}
Battleship C++
The example is a video on youtube and here is the link:https://www.youtube.com/watch?v=b-9FK83iZ_8
This is what I have so far. I got some notes on here too, to tryto help make it better and complete it faster.
*What I need help the most is from 'void hideBoat()' andbelow that, but if you see anything that needs to be correted ormissing please let me know so I can fix it with yourhelp.
The program should do the following things and for credit itmust utilize at least 3 functions:
*Correctly print the instructions
*Correctly print the board (excluding the ship)
*Randomly places a ship on the board in a valid position
*Validates the player's input
- Accepts only rows A - E and columns 1 - 5 only
- Does not accept a guess that was made previously
*Allows the player 10 turns to sink the ship
- If the ship is sank in 10 turns the player wins, otherwise,the player loses
- At the end of the game the player can choose to play again andthe game restarts, otherwise, the game is exited
Note: The example in the video displays 'S' where theship is located, this is for demonstration purposes only, myprogram should hide this by not displaying the 'S'characters.
My battleship box isn't exacly like the one on the videobut it is good enough for me so it doesn't need to befixed.
#include 'stdafx.h'
#include
#include
#include
using namespace std;
//Declare Function to print the instructions
void printInstructions();
void clearBoard();
void printBoard();
void hideBoat(); //Alot like set ship
void inputGuess();
bool isSquareOpen(int row, int col); //if the square is open
bool isGameWon();
//Declared the board to be displayed
//above main, it's global, it can be
//referenced throughout this program
const int SIZE = 5;
char displayBoard[SIZE][SIZE];
bool secretBoard[SIZE][SIZE];
int main()
{
srand((unsigned int)time(0));
char response = 'y';
while (response 'y')
{
printInstructions();
clearBoard();
hideBoat(); //hide the treasure in the board
printBoard();
while (!isGameWon())
{
inputGuess();
printBoard();
}
cout << 'Play again? (y/n)';
cin >> response;
}
//Game over
return 0;
}
//Implement the print instructions function
void printInstructions()
{
cout << 'Your goal is to sink the computers ship.'<< endl;
cout << 'The Computers's ship is only 3 spaces long.'<< endl;
cout << 'It is not diagonal.' << endl;
cout << 'Choose a position on the board (example A1).n'<< endl;
cout << 'You have 10 tries to sink the ship.' <<endl;
cout << endl;
}
void printBoard()
{
cout << ' ---------------------' << endl;
char crow = 'A';
for (int row = 0; row < SIZE; row++)
{
cout << crow << ' ' << displayBoard[row][0]<< ' ' <<
displayBoard[row][1] << ' ' <<displayBoard[row][2] << ' ' <<
displayBoard[row][3] << ' ' <<displayBoard[row][4] << ' ';
cout << endl;
cout << ' ---------------------' << endl;
crow++;
}
cout << ' 1 2 3 4 5n' << endl;
}
//Gets called between game play to reset the boards
void clearBoard()
{
for (int row = 0; row < SIZE; row++)
{
for (int col = 0; col < SIZE; col++)
{
displayBoard[row][col] = ' ';
secretBoard[row][col] = false;
}
}
}
? void hideBoat() ?
{
int row = rand() % SIZE; //Generate number between 0 andSIZE
int col = rand() % SIZE;
secretBoard[row][col] = true;
//The below code is for testing the example only
displayBoard[row][col] = '*';
//What about a ship??
//to represent the direction, generate a random number between 0and 1
//if the random number that represents direction is 0 put theship horizontally
//when the ship is horizontal
//assuming SIZE is 5
//Generate a random row between 0 and SIZE values between 0 and4
//Generate a random col between 0 and SIZE - values between 0and 2
//set secretBoard[row][col] = true, set secretBoard[row][col+1]to true,
//set secretBoard[row][col+2] = true;
//else if the random number that represents direction is 1 putthe ship vertically
//when the ship is horizontal
//assuming SIZE is 5
//Generate a random row between 0 and SIZE - values between 0and 2
//Generate a random col between 0 and SIZE values between 0 and4
//set secretBoard[row][col] = true, set secretBoard[row +1][col] to true,
//set secretBoard[row+2][col] = true;
}
void inputGuess()
{
char crow;
int col;
int row;
cout << 'You have ' << ? << 'guesses remaining.' << endl;
cout << 'Choose a cell: ';
cin >> crow >> col;
//Transpose user entry to 0 based indexes
col--;
row = int(crow - 65);
if (col < 0 col > 2 row < 0 row > 2 !isSquareOpen(row, col))
{
cout << 'Invalid Input. Try again.' << endl;
}
else if (secretBoard[row][col] true)
{
cout << 'Hit!';
displayBoard[row][col] = 'X';
secretBoard[row][col] = false;
}
else
{
cout << 'Miss!!';
displayBoard[row][col] = 'O';
}
}
bool isSquareOpen(int row, int col) //if the square is open
{
if (displayBoard[row][col] 'O')
return false;
return true;
}
bool isGameWon()
{
Youtube Videos Full Movie Battleship
for (int row = 0; row < SIZE; row++)
{
for (int col = 0; col < SIZE; col++)
{
if (secretBoard[row][col] true)
{
return false;
}
}
}
return true;
Youtube Battleships In Action
}