home .. forth .. colorforth mail list archive ..

Re: [colorforth] ANN c4thchess and c4thche2 (inclds personnal note To: HOakford)


Where are the Pieces ?
I imagine that some of you who may have tried c4thChess at this point
are wondering, " Where are the Pieces that are supposed to be on the
board"?

Last post I forgot to mention that you code them in yourself in Icons. 
If you look at the blocks that contain the pieces definitions, you
will see , just before each word '2emit', a hexadecimal value. That is
the icon in Icons that will represent the piece.

In the Prototype that you see in the jpeg ( which I did in windows ) I
used lowercase for queenside and upper for kingside and numbers for
each pawn.
r n b q K B N R
1 2 3 4 5 6 7 8 
In this version of chess, It is necessary to distinguish between king
and queen side. Just imagine that you have no hands and you have to
'tell' the computer which pawn or bishop to move and you'll understand
my thinking here. I thought about using a cursor to do all the moves,
but frankly that would be much slower than the current way. ( that's
not gonna stop me from makeing a version that does that- seems like a
decent exercise )


In the version that was on my cf disk, which is the version
represented by the html page and the .img file, all those hex values
are of custom icons that I created myself in the Icons editor after
all the existing icons.
Since these Icons are now pics and not letters -- to distinguish
between K & Q sides I put a tail that points to the sided of the board
that the piece originated on.
Also I determined that it would be more convenient if the pawns were
not numbers but the letter of the file it started on. So, whites king
pawn is on square E2 and therefore it has and E on top. To move a pawn
you would type..

we m 2 u.
we
white e file pawn 
m 
put that piece's packed x-y co-ord into the  mover pointer
2 u 
2 squares up.

Yup, if you use my code you will have to fire up Icons and make your own icons.

Since i used hex values before 2emit, and Icons displayes each icon
with a decimal value in the top left corner, the easy way to convert
between numbers is to put the hex value on the stack while the
keyboard is in hex mode, then go back to the number mode and select
decimal. :)

So sorry if this caused any confusion. I'm always available to answer
questions  you may have :)

-- 
Ray St. Marie
Rastm2 At users dot sourceforge dot net
Rastm2 AT aol dot com Ray.StMarie AT gmail dot com
Raystm2 in  irc.freenode.net /join #c4th #c4th-ot #forth


On Wed, 20 Oct 2004 10:39:33 -0500, Ray St. Marie <ray.stmarie@xxxxxxxxx> wrote:
> Hi Chris, and thank you for your continued interest :)
> 
> Yes, Sir!  The point for the chesses was to shorten the editor
> learning curve so that the environment learning curve could begin. I
> should have that tutor done in a week or so.
> 
> Most likely, you will need to type the 2 chesses coded into your
> editor in different blocks than what I used, as the blocks that I used
> will probubly be used by other code.  I suggest putting it last as the
> recording copyadvance block could overwrite existing blocks -- please
> note the note there!.
> 
> Please be sure that you notice block 30 where I redefined ( or I
> should say inserted )  a definition in   ' 5* '   to add   ' pr '
> used in the chess.
> 
> <r>5* <grdec> 5
> <r>pr <g>for 2emit next ;
> 
> note: that pr ( print) takes a count
> 
> Please also note that the 18 block has a few defs that are specific to
> the chesses. You see the '<r>2ch'  def there that 'turns on" both
> chesses.
> 
> If you were to type in the code like it appears on blocks 80,82,84
> (c4thchess) ,86(c4thches2),88(copyadvance) - keeping in mind to code
> the "load" definitions to the blocks _you_ put them on, then code
> block 18 with the chess load instructions and run '2ch' -- you will
> see the Icons-graphical display of the board with pieces in position
> of a current game in progress.
> 
> The next thing your gonna wanna do is ...
> type 'cb'  this brings you to the current recording board, for you to
> update the next move.  (provided you coded the all the demo game
> blocks ( which I really don't recommend unless you need the practice)
> and set the recording vars properly) ( provided you read the note that
> is included with the code block 'cb'  is on and it's swap block )
> ( be sure when codeing that block to set the record vars appropriatly)
> 
> type 'chs' and your back to the  main board.
> 
> to move
> 
> Think of the sentance you need to use to tell the computer to move the
> piece. You would say something like
> 
> white kings bishop move 5 squares up-left.
> 
> so to move you type
> 
> wkb m 5 ul
> ( on the editor command line -- this plays in the editor)
> 
> wkb
> puts the address of the white king bishop variable on the stack.
> m
> sets that variable as the move pointer
> ul
> is a move function that takes a count. therefore even moveing 1 square
> up you are (currently but not for long) required to put the 1 on the
> stack. otherwise the game will crash-- in case of crash just you will
> have to reset your computer ( sorry)  and '2ch' and your back --
> pieces always remember where they are.
> 
> m will eventually disapear. I dont like the fact that sometimes I
> forget to type it and move the last mover by mistake.
> calling the piece var to the stack will automatically call m in the future.
> 
> when you set a piece as the mover it is always the mover till you set
> another one -- this is convenient when moveing Knights as you need two
> moves to move them.
> 
> to take pieces off the board just move them off to the side.
> 
> I've add bounds to the move functions currently so that pieces don't
> go off the screen ( they don't go off the screen really - they just
> get stuck somewhere in that version and you can correct this by going
> to its variable -- cuting it off the block and redefining it. When you
> restart the game the offending piece will be in the 0,0 position ( top
> left ) and you can move it back to where you want.
> 
> after making a move, 'cb' to the current block of the c4thches2
> ( remember, If you didn't code my 'demo game in progress' them calling
> 'cb' at this point will bring you to the block that I have set in the
> cbl var on the copyadvance page unless you reset it properly ).
> 
> Please note that calling 'nb' on that copyadvance page could be very
> dangerous .
> 
> There are copies of variables on the block 79 for all the pieces in
> there first postitions.  copy them to a blank block and and replace
> the ones on the pieces blocks with the copies using the cursor to
> reset the board for a new game. my new version put all these vars on
> the same block and copying/replacing is much easier now . one function
> .
> 
> The c4thches2 can be used alone without the copyadvance feature as a
> game by itself.
> 
> The above versions are the most simplest chesses I could think of.
> 
> After reading Starting Forth, It dawned on me that I could turn any
> forth interpreter into a chess interpreter. I thought I would do a
> general version in Gforth to use in any forth interpreter and to give
> me enough education to 'crack' colorForth --- little did I know that I
> would actually finish the colorForth versions first.
> 
> My current version of c4thchess is moving on to included all the
> changes I mentioned above plus jumptables instead of variables.  This
> is necessary for the tutorial.
> 
> Thanks again -- Ray
> Rastm2 At Users dot sourceforge dot net
> Raystm2 At Gmail dot com
> irc.freenode /join #c4th-ot
> 
> On Mon, 18 Oct 2004 18:52:02 -0700, Chris Walton
> 
> 
> <chris.r.walton@xxxxxxxxx> wrote:
> > Awesome. Do you have some sort of "tutorial" with it of some sorts? Or
> > can you explain here how it works? I see from the screen shot that you
> > use it _in the editor_, but I can't quite seem to be able to figure
> > out how it works ;)
> >
> >
> >
> >
> > On Mon, 18 Oct 2004 20:47:02 -0500, Ray St. Marie <ray.stmarie@xxxxxxxxx> wrote:
> > > Hi Chris,
> > >
> > > Yeah , just have to type it in . there is nothing non-portable about
> > > that code :)
> > >
> > > Ray
> > >
> > > On Mon, 18 Oct 2004 15:42:40 -0700, Chris Walton
> > >
> > >
> > > <chris.r.walton@xxxxxxxxx> wrote:
> > > > Awesome stuff! I'll have to try it. Any idea if it'll work on XColorForth?
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
> > > > For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
> > > > Main web page - http://www.colorforth.com
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
> > > For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
> > > Main web page - http://www.colorforth.com
> > >
> > >
> >
> >
> > --
> > I F34R N0N3 F0R F0RTH SH4LL GUID3 M3
> >
> > ---------------------------------------------------------------------
> >
> >
> > To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
> > Main web page - http://www.colorforth.com
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com