Hi,
I have two thoughts here.
First, In past thinking about something like this, I thought about how to
represent the game record and the board. In my mind, the game record was a list
of dictionaries, where entry 0 is the top of the listing, and entries 1 through
the last move is white move, black move, white comment and black comment. If
the game would be timed, then I would add entries for white time and black
time.
In my mind, the board was represented as a dictionary with 64 entries. Each
entry was a square designation, and either null or a letter designation for a
pawn or piece. I think I would also have needed to add a square color.
Also, I was doing some preliminary thinking about how to do simple move
validation.
I was considering using the cmd module to make a command line interface for
moves. There would be a move command with starting and ending square. Parsing
algebraic notation was going to come in a second version of the program.
For example, someone would type move e2e4, and the program would do some simple
checking like Is there a piece on e2? Which piece is it? Whose turn is it? Is
there a piece on e4? Is the piect on e2 a pawn, and is it the right color?
I was going to use upper case letters as the pieces for white, and lower case
letters as the pieces for black.
In my thinking about how to calculate moves, I was thinking along these lines.
If the person moved along a file, I would simply add two. For example, e2 e4.
If they move to another
rank, I would use the ord function to convert the letter to a number, add 2,
then convert the result back to a letter, then make the move. I think I got
files and ranks mixed up, but you probably get the idea.
When it came to storing the entire game on disk, I was unsure which library
module to use, but I was thinking that it would be the slheelve module.
I was gooing to add the clock as another feature, and exchange the command line
interface for a GUI interface, or simply choose to add a GUI or even web
interface and let the game mechanics be used by the front end.
Thanks.
Jim
If building your own website is holding you back, I can help.
On May 30, 2015, at 6:36 PM, Richard Dinger <rrdinger@xxxxxxxxxx> wrote:List web page is
Hi all,
At the chess group meeting yesterday the subject of space came up.
Write a program that reads a game record, optionally writes a FEN and
determines space on either side
Richard
List web page is //www.freelists.org/webpage/pythonvis
To unsubscribe, send email to pythonvis-request@xxxxxxxxxxxxx with
"unsubscribe" in the Subject field.