DM2B-The Referee Program

by

********************************
*** DM2B-The Referee Program ***
********************************

     ========== The Chess Board
     RNBQKBNR 8
     PPPPPPPP 7
     -------- 6
     -------- 5
     -------- 4
     -------- 3
     PPPPPPPP 2
     RNBQKBNR 1
     ==========
     abcdefgh

Where 1-9 identifies the rank (row)
and a-h identifies the file (column)

The referees board:
DIM SHARED Board(8, 8) AS INTEGER' column, row
'1=K 2=Q 3=B 4=N 5=R 6=pawn (White)
'7=K 8=R if the piece has moved (re: Castling)
'9=P if the pawn can be taken en passent
'-1=K .... (Black)

Where the Black King is in it's original position, e8, is
Board(1,5)=1
whereas if that piece has moved and returned to that position
Board(1,5)=7

DIM SHARED WBoard(8, 8) AS INTEGER' column, row
DIM SHARED BBoard(8, 8) AS INTEGER' column, row

- Same standards. These arrays contain the location of opponent pieces as arbitrarily decided by a player and have no bearing on the game.

Subordinate design modules:

======= DM3BA: Play Game
Main program
DECLARE SUB RefereeSpeaks (msg$)

======= DM3BB: Display
DECLARE FUNCTION DisplayBoard$ (Mode$)
DECLARE SUB WindowSub (cmd$)

======= DM3BC: Introduction
DECLARE SUB Introduction (n$, t%)


************************
*** DM3BA: Play Game ***
************************

Main, Input-Output, Logic, etc.


**********************
*** DM3BB: Display ***
**********************
DECLARE FUNCTION DisplayBoard$ (Mode$)

This will control the screen and communication with the player. It will display BOARD(8,8) depending on Mode$:
- If Mode$="BW" then it will display the entire board (it is the end of the game.)
- If Mode$="W" or "w" then it will display the white pieces only from BOARD(8,8), but will also display bogus black pieces from BBoard(8,8).  - If Mode$="B" or "b" then it will display the black pieces only from BOARD(8,8), but will also display bogus white pieces from BBoard(8,8).  

 and return immediately with null or anything.
If Mode$ = "W" or "B" then DisplayBoard will return a move in this format "d2-d4" if the player selected a move. Anything else means the player press ESC or otherwise elected not to select a move or to resign.

If Mode$ = "w" or "b" then DisplayBoard will return null (or anything) without requiring the user to make a move or press ESC.

DisplayBoard will also allow a player to place opponent pieces as desired for personal use. (Ignored by logic portions of the system.)

White placement of Black pieces are to be recorded in WBoard and Black placements in BBoard (DIM SHARED in main program). Whenever displaying in Mode$ BWbw, first player's pieces are displayed and then opponent imaginary pieces are displayed wherever there is an empty square.

DECLARE SUB WindowSub (cmd$)

This is to allow the main program to communicate with the player. Values of cmd$ are
"Open"     - Here the SUB will clear the communication window and
             return with the screen set so the main program can do
             PRINT and INPUT commands without disrupting the                          chessboard display.
"Close --" - Here the SUB will simply return. No further PRINT
             or INPUT statements will be issued by main but the
             display will remain visible to the player
"Close w-" - Same except WAIT 2 before returning.
"Close -c" - No wait. The window is cleared or removed immediately.
"Close wc" - WAIT 2, then clear or remove.
"mmm"      - (where mmm is anything else.) - Same as
             WindowSub "Open"
             Call RefereeSpeaks("mmm")
             WindowSub "Close w-"
               Note RefereeSpeaks is simulated as only
               PRINT "mmm"
               But it additionally writes a temporary file in
               the real version to notify the next player of
               calls made during current player's turn.


***************************
*** DM3BC: Introduction ***
***************************
DECLARE SUB Introduction (n$, t%)

This sub will provide an initial display to the player. It will examine the directory where KRef.exe is called to determine if there are any  files (games) of the form xxx.ksg. If so, it will list the xxx-portion. In addition, it will list the options "new game" and "exit".

The player will select an option and the SUB will return with parameters set as follows:

If the player selects an existing game,
n$="xxx" where "xxx.ksg" is a file that exists
t%=1

If the player selects a new game, prompt for a name and create file.
n$="xxx" where "xxx.ksg" is the empty file that is produced
t%=2

If the play selected "Exit"
n$=(doesn't matter - will be ignored)
t%=3



    
This message has been edited by iorr5t from IP address 68.98.164.60 on Feb 11, 2006 8:58 AM
This message has been edited by iorr5t from IP address 68.98.164.60 on Feb 8, 2006 2:17 PM
This message has been edited by iorr5t from IP address 68.98.164.60 on Feb 5, 2006 9:07 AM
This message has been edited by iorr5t from IP address 68.98.164.60 on Jan 14, 2006 9:50 AM

Posted on Jan 14, 2006, 8:30 AM
from IP address 68.98.164.60

Respond to this message   

Return to Index


Response TitleAuthor and Date
DM3BA-Play Game on Jan 18