|
Post by RD on Oct 20, 2002 15:06:21 GMT
hi, I just started a course and they want us to strart programming from the beginning, so they gave us qbasic I know a bit about qbasic but need help with the following question. ---------------------------------------------------- Write a program to allow the user to move north,south east or west around a 8*8 chessboard. Assume the user is starting on the first square of the first row (1,1). Allow them to select a direction and the number of positions they would like to move. Allow them to make as many attempts at moving as they want. ----------------------------------------------------- so if anyone can give me any help/idea has how to go about it plese do, as it the only question im having touble with. thanks RD also can someone give me the code so that the computer will beep when an error is entered. thanks again
|
|
Elias
Junior Member
Posts: 78
|
Post by Elias on Jan 21, 2003 18:20:17 GMT
Im sorry for the (very very) Late answer, but you can always use
DIM SHARED AREA (8,8) AS INTEGER
to make any kind of grid, from there just use X and Y coordinates to move around the grid, To capture Arrow keys from the keyboard:
CHR$(0) + "H" = UP ARROW CHR$(0) + "P" = DOWN ARROW CHR$(0) + "K" = LEFT ARROW CHR$(0) + "M" = RIGHT ARROW
another way to capture keyboard keys are INP(96) but i dont remember the values for each key, you should make a program wich monitors INP(96).
About the beep on error, you can us:
ON ERROR GOTO ERRORHANDLER ERROR ON
' an action wich causes an error.
ERRORHANDLER: BEEP RESUME (NEXT ) ' next is an optional parameter
AND AGAIN IM SORRY FOR THE LATE ANSWER.
|
|