1
TI Z80 / Chess in Basic
« on: September 27, 2011, 05:06:59 pm »
[Edit: Also had another problem. I wanted to have a banner on the side so that when a piece is selected it showed the name plus a more detailed drawing. Is there anyway that I can clear just that section of the screen with ease? I might be able to do clrdraw with what hot_dog suggested since with that I can just remake the board, haven't tried it out, but I want to have a back up plan]
Currently working on Chess in Basic and could use a little bit of help. So far I've only coded very basic parts of it but I've noticed during testing that it's already a little slow. In a nutshell what my program does is:
-Display the picture of the chess board (including the pieces already on it. I chose this method so that I could archive and unarchive pics within the program and also save games)
-Draw the cursor.
-Get key so that the cursor can move left, right, up and down while also allowing the player to select a piece (by pressing 2nd).
-When 2nd is press the prgm checks the pixels in that square. It can determine the difference between a black square, white square, and every single piece. (it sees rooks and bishops as the same but this shouldn't be a -problem)
-If a piece is selected it determines what piece it is (it determines if it's a piece at all first) and then what moves are available to it (and if it's a pawn if it's able to "jump" two squares) [at the moment I only have it programmed for pawns). All available moves are shown with a x through the square and all remaining pixels are darkened (a black square is actually a checkered square). If 2nd is pressed again on the pawn it reverts the available moves back to their original square type.
But even though I've only programmed white pawns (not even the black pawns yet) it takes about a half second for the cursor to move, and even longer to display the available moves. Before I continue I want to try and speed up this program so that it runs faster and not take 10 seconds per cursor move, (let alone moving to the piece you want)
Other non important stuff:
Each piece is not saved as a pic. I also plan to have the original pic drawn in using pic on and pic off but only at the end when I'm sure this works.
Each piece is not a variable. The program checks the pixels to determine what each square is, not what variable is where.
I actually can't move a piece yet. I simply haven't programmed it to but I'm fairly confident I could if I decided to put it in.
It will be a person vs person game. Not a person vs computer game. I'd rather it have AI but I'm not sure how to make this, if you know how that'd also be helpful. (Keep in mind this is in BASIC).
Currently working on Chess in Basic and could use a little bit of help. So far I've only coded very basic parts of it but I've noticed during testing that it's already a little slow. In a nutshell what my program does is:
-Display the picture of the chess board (including the pieces already on it. I chose this method so that I could archive and unarchive pics within the program and also save games)
-Draw the cursor.
-Get key so that the cursor can move left, right, up and down while also allowing the player to select a piece (by pressing 2nd).
-When 2nd is press the prgm checks the pixels in that square. It can determine the difference between a black square, white square, and every single piece. (it sees rooks and bishops as the same but this shouldn't be a -problem)
-If a piece is selected it determines what piece it is (it determines if it's a piece at all first) and then what moves are available to it (and if it's a pawn if it's able to "jump" two squares) [at the moment I only have it programmed for pawns). All available moves are shown with a x through the square and all remaining pixels are darkened (a black square is actually a checkered square). If 2nd is pressed again on the pawn it reverts the available moves back to their original square type.
But even though I've only programmed white pawns (not even the black pawns yet) it takes about a half second for the cursor to move, and even longer to display the available moves. Before I continue I want to try and speed up this program so that it runs faster and not take 10 seconds per cursor move, (let alone moving to the piece you want)
Other non important stuff:
Each piece is not saved as a pic. I also plan to have the original pic drawn in using pic on and pic off but only at the end when I'm sure this works.
Each piece is not a variable. The program checks the pixels to determine what each square is, not what variable is where.
I actually can't move a piece yet. I simply haven't programmed it to but I'm fairly confident I could if I decided to put it in.
It will be a person vs person game. Not a person vs computer game. I'd rather it have AI but I'm not sure how to make this, if you know how that'd also be helpful. (Keep in mind this is in BASIC).