Board for chess setup.

by Pete

COLOR 7, 1: CLS
LM% = 3: TM% = 3: LEVEL% = 1
LOCATE TM%, LM%
FOR H = 1 TO 8
FOR J = 1 TO 2
FOR I = 1 TO 8
IF H / 2 = H \ 2 THEN
IF I / 2 = I \ 2 THEN COLOR 0, 7 ELSE COLOR 7, 0
ELSE
IF I / 2 = I \ 2 THEN COLOR 7, 0 ELSE COLOR 0, 7
END IF
PRINT space$(5);
NEXT I
IF H = 8 AND J = 2 THEN  ELSE PRINT : LOCATE , LM%
NEXT J
NEXT H
FOR J = 1 TO 2
IF J = 1 THEN COLOR 7, 1 ELSE COLOR 0, 6: LEVEL% = 15

X = 1
FOR I = 1 TO 8
A$=MID$("RNBKQBNR",i,1)
LOCATE TM% + LEVEL%, X + LM%: PRINT " " + A$ + " ";
X = X + 5
NEXT I
X = 1
FOR I = 1 TO 8
IF J = 1 THEN LOCATE TM% + LEVEL% + 2, X + LM% ELSE LOCATE TM% + LEVEL% - 2, X + LM%
PRINT " P ";
X = X + 5
NEXT I
NEXT J

REM OPTIONAL BORDER
'COLOR 7, 4: REM RED (A BIT TOO MUCH?)
COLOR 7, 0
LOCATE TM% - 1, LM% - 1
PRINT CHR$(218); STRING$(40, 196); CHR$(191)
LOCATE , LM% - 1
FOR I = 1 TO 17
PRINT CHR$(179)
LOCATE , LM% - 1
NEXT I
LOCATE TM%, LM% - 1
FOR I = 1 TO 17
LOCATE , 40 + LM%
PRINT CHR$(179)
NEXT I
LOCATE TM% - 2 + 18, LM% - 1
PRINT CHR$(192); STRING$(40, 196); CHR$(217)

REM NUMBERING
LOCATE TM% + 17: COLOR 7, 1
LOCATE , LM% + 2
FOR I = 1 TO 8
PRINT LCASE$(CHR$(64 + I)) + SPACE$(4);
NEXT I

LOCATE TM% + 1, 40 + LM% + 2
FOR I = 1 TO 8
PRINT CHR$(57 - I);
LOCATE CSRLIN + 2, 40 + LM% + 2
NEXT I

LOCATE 25, 1: PRINT "Press Esc to end";
DO
LOOP UNTIL INKEY$ = CHR$(27)
SYSTEM

-------------------------------------------

You could try the red border, I think it is a bit too much color. Also, you can remove the border and try it that way.

Use the TM% and LM% (margin values) to adjust where on the screen you want the chess board placed.

Let me know if you like it. I figured you wanted a screen 0 display and something a bit smaller than the other two I placed in the sub forum.

I did not know if you needed pieces setup, so I did that, anyway. I included the numbering on the sides. Personally, I would map out a mouse driver instead of using keyboard input for such a game.

You have the option of input text to any side, top or bottom of the screen. If you wanted to keep it simple, you could work with VIEW PRINT to set the board in one view screen and the input text in another.

Pete



    
This message has been edited by iorr5t from IP address 68.98.164.60 on Dec 19, 2005 9:07 PM

Posted on Dec 19, 2005, 12:58 PM
from IP address 68.6.85.9

Respond to this message   

Return to Index


Response TitleAuthor and Date
Same idea. but I added a positional mouse driverPete on Dec 19
 Pawns do legal moves - Mouse driver. Includes En Passant.Pete on Dec 19
  Needed to exchange white/black pieces. I posted a finished phase 1 here URL:Pete on Dec 20