how to write a program for true basic battles

Destination software Atv thunder ridge r...
June 4, 2010 at 15:32:40
Specs: Windows XP
i am writting a program for battleship and would like you to help me improve the quality and make it work. so far it reads:
DIM BOARD1$(10,10)
DIM BOARD2$(10,10)
DIM PLAYER1BOARD$(10,10)
DIM PLAYER2BOARD$(10,10)
SET BACK "BLACK"
CLEAR

SET COLOR 8
FOR X = 1 TO 10
FOR Y = 1 TO 10
LET BOARD$(X,Y) = "o"
PRINT BOARD$(X,Y);,
NEXT Y
PRINT
PRINT
PRINT
NEXT X

SET COLOR "WHITE"
PRINT "WOULD YOU LIKE TO BE PLAYER1 or PLAYER2 (1:PLAYER1 or 2:PLAYER2)";
INPUT PLAYER
PAUSE 1
CLEAR

IF PLAYER = 1 THEN CALL PASSCODE1
IF PLAYER = 2 THEN CALL PASSCODE2

SUB PASSCODE1
PRINT "ENTER YOUR PASSCODE";
INPUT CODE1
CALL PLAYER1
END SUB

SUB PASSCODE2
PRINT "ENTER YOUR PASSCODE";
INPUT CODE2
CALL PLAYER2
END SUB

SUB PLAYER1
PRINT "ENTER YOUR PASSCODE";
INPUT REPLY1

IF REPLY2 <> CODE2 THEN
PRINT "INCORRECT PASSCODE"
IF REPLY2 = CODE2 THEN
PRINT "PLAYER1:INPUT YOUR BATTLE SHIP POSITIONS"
PRINT "ENTER ROW"
INPUT ROW1
PRINT "ENTER COLUMN"
INPUT COLUMN1
SET COLOR "WHITE"
LET BOARD1$(ROW1,COLUMN1) = "x"
CALL BOARD
END IF
END IF
END SUB

SUB PLAYER2
PRINT "ENTER YOUR PASSCODE";
INPUT REPLY2

IF REPLY2 <> CODE2 THEN
PRINT "INCORRECT PASSCODE"
IF REPLY2 = CODE2 THEN
PRINT "PLAYER2:INPUT YOUR BATTLE SHIP POSITIONS"
PRINT "ENTER ROW"
INPUT ROW2
PRINT "ENTER COLUMN"
INPUT COLUMN2
SET COLOR "WHITE"
LET BOARD2$(ROW2,COLUMN2) = "x"
CALL BOARD
END IF
END IF
END SUB

DO
LET COUNT = COUNT + 1
PRINT "PLAYER 1: ENTER POSITION"
PRINT "ENTER ROW"
INPUT GUESSROW1
PRINT "ENTER COLUMN"
INPUT GUESSCOLUMN1

CLEAR
CALL BOARD

PRINT "PLAYER 2: ENTER POSITION"
PRINT "ENTER ROW"
INPUT GUESSROW2
PRINT "ENTER COLUMN"
INPUT GUESSCOLUMN2

CLEAR
CALL BOARD
LOOP UNTIL COUNT = 4

SUB CHECK
CLEAR
END SUB

SUB BOARD
SET COLOR 8
FOR X = 1 TO 10
FOR Y = 1 TO 10
PRINT BOARD$(X,Y);,
NEXT Y
PRINT
PRINT
PRINT
NEXT X
END SUB

SUB EXIT
DO
PRINT tab(31,43);"Are you sure you want to quit (Y:YES or N:NO)";
INPUT RESPONSE$
PRINT
IF RESPONSE$ = "N" THEN CALL GAME
IF RESPONSE$ = "Y" THEN
PRINT tab(62,43);"(press enter to exit)"
PRINT tab(30,43);"GAME OVER"
END IF
LOOP UNTIL LCASE$(RESPONSE$)<>("Y")
END SUB
END


See More: how to write a program for true basic battles

Report •


#1
June 4, 2010 at 22:34:36
Post it to programming forum.

Report •
Related Solutions


Ask Question