Ok, I'm trying to make a 2-player chess program, but I'm a little stumped. Which is better:
1. Using a list and drawing in the pieces as they come up in the list.
2. Making a picture and modifying that as necessary.

I'm thinking the picture is better, but I dunno....
CalcMan06 wrote:
Ok, I'm trying to make a 2-player chess program, but I'm a little stumped. Which is better:
1. Using a list and drawing in the pieces as they come up in the list.
2. Making a picture and modifying that as necessary.

I'm thinking the picture is better, but I dunno....


or use a matrix and a picture. only modify the picture when the matrix is modified. write a routine to draw your piece based on color and type in the matrix (remember that Line()'s can be either black or white ^^)

then draw the picture from scratch the first time the board loads and modify it as necessary during the game.

here's some pseudocode for drawing a line based on color.


Code:

RandInt(0,1)
Line(X,Y,X,Y+5,Ans)


if you want a blacksquare and a white piece or a white square and a black piece you could do this (as part of a larger routine of course).

Code:

RandInt(0,1)
Line(X,Y,X,Y+5,Ans)
Line(X,Y+1,Y+4,not(Ans


I recommend using a square of pt-Changes, 1 in each corner of the current square to draw you cursor
Ok, I haven't had much experience with Matrices, but I'll try.
or faster, but slightly more code intensive would be strings, but I recommend a matrix for something like chess where most of the program is spent waiting for user input.
I agree with elfprince13 on this. That would be the perfect way.
Alright, now I have a question on Matrices. I filled up my matrix with lists. Is there a way to fill up a matrix with numbers you specify without lists programmatically(besides "Fill("?)
Try the list>Matrix( command...
I know, that's what I did, I'm asking if there's another way.
If you already thought of and discarded using two nested For( loops, then no, there's no other way to do it.
Heh, good luck with the chess program. I made a decent GUI/2-player chess game back in the day (link). Building the basic engine isn't easy, but it's certainly doable if you put your nose to the grindstone. The really difficult part is writing an AI, a task I gave up on. You'll notice the description says "Programmers Wanted"; if you're interested in helping write an AI or improving my existing program, I'd be happy to help you! Smile
I'm not planning on having an AI at the moment, but rather, to make it be playable either over a link port or on one calculator. An AI would be impossible for me, but I think I may be able to pull together a great program nonetheless. You say it did not handle check/checkmate? An easy way to check for those would be to see if the king was on a square determined for moving by another piece of the opposite color. If the king can make a legal move, then it's not mate. If the king cannot make one and is in check, then the game's over. What about Stalemate and such? Were those included?
CalcMan06 wrote:
An AI would be impossible for me...
If you tell yourself it's impossible then it will be. What JPez said goes for everything you want to do:
jpez wrote:
it's certainly doable if you put your nose to the grindstone.
CalcMan06 wrote:
I'm not planning on having an AI at the moment, but rather, to make it be playable either over a link port or on one calculator. An AI would be impossible for me, but I think I may be able to pull together a great program nonetheless. You say it did not handle check/checkmate? An easy way to check for those would be to see if the king was on a square determined for moving by another piece of the opposite color. If the king can make a legal move, then it's not mate. If the king cannot make one and is in check, then the game's over. What about Stalemate and such? Were those included?
I'm fully aware of the rules of chess, the difficulty is implementing them in a limited language and platform. Rolling Eyes
jpez wrote:
Heh, good luck with the chess program. I made a decent GUI/2-player chess game back in the day (link). ...
Secksay! I might take your challenge and try to finish that off one day...
Ok, now I have a slight little problem. I want people to be able to input their own names. The Input function works just fine, but when the program goes to "Text(" out the names, I always get an "ERROR: DOMAIN" Does this occur because Text( does not accept strings? (I'm using Strings) The names I put in should fit.....
CalcMan06 wrote:
Ok, now I have a slight little problem. I want people to be able to input their own names. The Input function works just fine, but when the program goes to "Text(" out the names, I always get an "ERROR: DOMAIN" Does this occur because Text( does not accept strings? (I'm using Strings) The names I put in should fit.....


text( goes by pixels, not points. Also, it accepts strings, but if the start of the text command points to somewhere off the screen, then it will give u domain error.
http://www.ticalc.org/archives/files/fileinfo/363/36335.html

There you go, a form of input on the home and graph screens. Smile
You can also check this thread out.
something1990 wrote:
You can also check this thread out.
Hey, I like that routine in the first post... nice job, Dan.
Harq wrote:
text( goes by pixels, not points.


>< THAT'S what the problem was! I had set the window, and I thought the Text( goes by the window, not the pixels on the screen. Now it displays the names correctly, and I can focus on getting selection of pieces to work....
  
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