Re: Calculator Program


[Prev][Next][Index][Thread]

Re: Calculator Program



JUSTIN SMITH (-) wrote:
: Hello. I am a student, that is interested in making a chess sprogram
: (simple), for a ti82, 85, or my ti92. I would be interested in any help,
: and am asking for people to post any source code if they have any that
: would assist me with a chess calculator program. Thank you for your help.
: This is absolutely NOT school related, it will be used for recreation
: purposes only, and to impress friends. :)


Can assembly language programs be written for these calculators?


If not, then it is unlikely that a very playabled chess game can
be written for them.  There was a simple chess game written for
a HP48 calculator that was not in assembly.  It took 20-30 minutes
to make a move, and I beat it in 5 moves.  It also had a few bugs.


There are also a couple of chess games for the HP48 that are
written with a lot of assembly.  These are very much better!
They can even beat lessor players (read: beginners!).


I am currently working on another chess game for the HP48.
It will be much better than any of the other HP48 chess
programs.  It will be able to beat most calculator users.
And, it will be written in assembly.


So, a chess game can surely be written for a calculator,
but to really be a playable chess game it NEEDS to be
written in assembly!


SORRY, while I am an expert HP48 programmer and THE expert
for chess programming on such a machine, I know nothing
about TI calculators.


Try and find a simple chess program written in a language
that you understand.  Then you can use it as a guideline
to write your own chess program.


Then just write the program a step (subroutine) at a time.


DrawBoard       -  Draws board to screen.
MoveGen         -  Generates moves.
MakeMove        -  Makes move.
SortMoves       -  Move ordering.
UnMakeMove      -  Unmakes move in search.
ScoreMove       -  Scores move in search.
Search          -  Search for computer move.




Keep things simple to start with.  First put DrawBoard,
MoveGen, and MakeMove together with user input to make
a two player game.  Then add the rest with a simple
two-ply search (no capture search) for the computer move.


You will need some scoring but keep it very simple.
Some simple piece tables are good enough to start with.
You can add more as needed later.


Any move ordering is better than none.  Keep it simple
to start.


If you don't write the program in assembly, you will
likely stop about here.  It will play a very lousy game,
but hey...
If the program takes longer than 10 minutes to make a
move, it is just not worth going any further.


If you decide to go on, the next step is to improve
the move ordering.  GOOD MOVE ORDERING IS A MUST!
You will get bigger speed gains in move ordering than
in any other part of the program.  There is MUCH more
speed to be gained from move ordering than there is
from optomizing code.


Next add a simple capture search.  Keep in mind that
a reasonably good capture search is as important for
quality of play as move ordering is for speed.


Now you can go back and improve the scoring.  You will
likely want to do most of the scoring in the main search.
Only doing material scoring in the capture search.


A one-ply main search plus capture search will be somewhat
playable (much better than the two-ply search without the
capture search).


A two-ply main search plus capture search will beat many
a wimpy chess player (read: average ti82, ti85 owner).


If you can get to a three-ply or four-ply main search
plus capture search, you should be very happy.  This
should beat most of the calculator owners (but maybe
not the chess club geeks).


If you can get the program to do a four-ply (or more)
search plus capture search in a reasonable time, then
you are on your way to making a REAL chess program!
(An assembly language program on the ti92 should
qualify!)


If you get this far, then there are lots of things you
may want to add.  Much improved scoring, null moves,
search extensions, and more!  (If you have the memory,
you may even want to try hash tables!)


Good luck!
dan  (kirkland@ee.utah.edu)


References: