answersLogoWhite

0


Best Answer

first you have to initialize the array.

board : Array [1..10,1..10] of char;

then place the ships

board[2,2]:='A';

board[3,2]:='A';

board[4,2]:='A';

board[5,2]:='A';

board[6,2]:='A';

i would advise to use some simple coding for the ships such as

aircraft carrier code: A

so if aircraft carrier is at

[2,5] to [6,5], you can ask the user to enter two numbers (row, column) and check if

e.g. point [4,5] is assigned to 'A'

this is the coding i used for aircraft carrier, which is pretty much the same for all

while Gcount <> 17 do //5+4+3+3+2

begin

count:= count+1; // to count how many hits were required at the end

writeln('enter row you want to hit');

readln(row);

writeln('enter column you want to hit');

readln(col);

if board [row,col] = 'A' then

begin

Gcount:=Gcount+1;

writeln('you hit AirCraft Carrier');

end

else if board [row,col] = 'B' then

.... and so on....

i did not copy the exact code i used since there is a slight error. you can hit the same spot twice...

but in general to make such a game is not very hard

regards, Gohan (CY)

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you make the battleship game using pascal?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Make a pascal using c plus plus?

Please make your question more clear. Qhat do you want to do? Rewrite the programming language Pascal? Convert c++ code to Pascal? Create a Pascal triangle? Make a baby son that's called Pascal? (btw, that last thing has to be done in hardware)


How do you make a memory card game on turbo pascal?

you cant u stupid


How did pascal make pascal's triangle?

pascal drew a triangle, and then signed his name at the bottom of the page. He was 7 years old


Where do you make a flash game?

Open flash. Make a game using AS.


How to make your own game?

You can make your own game using Sploder. A similar service is Game Gonzo.


When did Blaise Pascal make his contributions?

1891


How make a sentence using after the football game?

After the football game i had a huge party.


When did Pascal Blaise make his invention?

1642 - 1645


Can you make sentences using a cakewalk?

This game was a cakewalk


Did Blaise Pascal make Harry Potter?

No, but he was a wizard at math.


What units make up a pascal?

(force) divided by (area) That's pressure. 1 pascal = 1 newton per square meter


how to make your own board game with cards?

using your mind