So I've decided to write a "chess" program for the TI84.

Which is pretty straightforward, really.

But it's not.

Because there are so many ways to do it.

And the screen's too small. Seriously.

Even if I use one character for each piece AND use the graph screen... I still need room for the piece itself, the color of the piece, and the color of the square. And then there's the ordeal of moving the pieces. How do I display a cursor over the board and move pieces without having to redraw the entire thing every time I move the cursor?

Also, what is a good(er) way to represent the pieces? Right now, I've got 64 elements in L1. X and Y for every piece. There's 16 pieces on each side, 32 total, so 64.

This seems...unwieldly. I feel as if I'm missing something really obvious.
Aeromax wrote:
So I've decided to write a "chess" program for the TI84.

Which is pretty straightforward, really.

But it's not.

Because there are so many ways to do it.

And the screen's too small. Seriously.

Even if I use one character for each piece AND use the graph screen... I still need room for the piece itself, the color of the piece, and the color of the square. And then there's the ordeal of moving the pieces. How do I display a cursor over the board and move pieces without having to redraw the entire thing every time I move the cursor?

Also, what is a good(er) way to represent the pieces? Right now, I've got 64 elements in L1. X and Y for every piece. There's 16 pieces on each side, 32 total, so 64.

This seems...unwieldly. I feel as if I'm missing something really obvious.


The screen is NOT too small.... just use graphscreen. Store a Pic of the board, and move that one piece. Then save the pic again, etc...

You could use matrices, but thats annoying... perhpas two lists? 1 for x, 1 for y? You do realize that the main problem you will encounter is the chess engine itself, not the interface. You should really try something a bit simpler, like checkers.
Stat sprites would work quite well for this at least I think.But yes rthprog is right the display and gui will be a joke compared to getting the rules, ai and other various things.
grazi

the thing is that you would need something like XLib, Omnicalc (right?), or Codex for (decent) sprites... Aeromax, are you planning on using a lib for this? Otherwise this will be next to impossible.
Here's Proof it can be done in basic with great graphics.
Well, as for the time being, I'm not even going to concern myself with the "higher functions" of a game. Fex, it's not going to have any rules, there's not an AI and I just use regular text characters for the sprites.

But I've just had a breakthrough as far as mapping pieces. Instead of having each piece's X and Y coordinates stored in a list of 64, I have a list of 64 with the type of piece in each square.

Fex, instead of {piece 1 x, piece 1 y, piece 2 x, piece 2 y ... } it's {ID of piece in square 1, ID of piece in square 2 ... }

This is going to be a hell of a lot easier as far as moving pieces. However, displaying them is going to be a bit of a challenge. I should have a basic, functioning piece-moving game (with capturing enabled) done by today.
rthprog wrote:
the thing is that you would need something like XLib, Omnicalc (right?), or Codex for (decent) sprites


no.



Aeromax, check out this:

i think it will be [url=http://sfgp.cemetech.net/calc/BattleField/BattleField_(83plus__Doors_CS_6_Edition).zip]helpful[/url]
Well. I've finished what might be able to pass for a rough draft. It allows you to select, deselect, and drop pieces. It will also tell you if a move is legal and it won't let you make an illegal move. It's got a timer and it can save the game, too.

All in all, it's chess...
Aeromax wrote:
Well. I've finished what might be able to pass for a rough draft. It allows you to select, deselect, and drop pieces. It will also tell you if a move is legal and it won't let you make an illegal move. It's got a timer and it can save the game, too.

All in all, it's chess...
Shock That was pretty fast, well done.
Well. I mean, there aren't any sprites or anything, there's no AI and I'm still working out some kinks.

But the cool thing about this is that I'm not obligated to make it run REAL REAL FAST and spend days optimizing it. Of course, I had to get it to the point where you could move around the board and take a turn and not have it take an hour to render the screen, but that's pretty much all. Chess isn't that speedy of a game. And the rules governing movement are pretty simple... I just used a list instead of a matrix, and figured out how to decide if a move was legal.

8 elements is a row.
Old position = Z
New position = V
(V-Z) = S
sqrt(S^2) = R

Rooks: fPart(R/8) = 0 (meaning it's a multiple of 8 and thus a vertical line) or iPart(Z/8) = iPart(V/8) (meaning they're both on the same row)

Bishops: fPart(R/9) = 0 (down-right/up-left diagonal) or fPart(R/7) = 0 (up-right/down-left diagonal)

Queens: rook and bishop =/= 0

Kings: R = 1 or R = 7 or R = 8 or R = 9 (one space left/right, 7 and 9 for diagonals and 8 to move up/down)

Knights: R = 6 or R = 10 or R = 15 or R = 17

Pawns: S = 8 and space is unoccupied /or/ S = 8 and space is unoccupied and the pawn is on the second row /or/ S = 7 and space is occupied /or/ S = 9 and space is occupied (first one is regular movement, second is jumping from the start, and last two are capturing)

And then from there I do stuff.

But I'm working on the GUI and some other stuff, and when I add one feature another one stops working, and fixing that feature brings up another crappy block of code, which I improve, which breaks something else.

It's going to be a while.
By the way, sqrt(S^2) is just abs(S). Wink
Well, not for imaginary numbers, but we don't care about them. Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement