"be consistent" PerlMonks

### Re: Re: "Rites of Passage" wheel reinventing

by demerphq (Chancellor)
 on Feb 26, 2004 at 22:03 UTC ( #332111=note: print w/replies, xml ) Need Help??

in reply to Re: "Rites of Passage" wheel reinventing
in thread "Rites of Passage" wheel reinventing

Im confused, how do you reckon you can lookup table all the possible moves? Maybe i misunderstand you but wouldnt that require knowing all possible games and putting all possible board positions in the lookup table? (Which I think would mean that you could solve the problem of the prefect game.)

---
demerphq

First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi

Replies are listed 'Best First'.
Re: Re: Re: "Rites of Passage" wheel reinventing
by hardburn (Abbot) on Feb 26, 2004 at 22:12 UTC

Nah, you just need to have a board with one piece on it and generate all possible moves for that piece from that postion. Then put that data in the lookup table and do it again for the next piece or position. You'll still have to do a little runtime work like check that the piece isn't jumping over other pieces (except for knights) and isn't landing on a square already occupied by a freindly piece, plus few other special cases (like pawn attacks). For the most part, though, lookup tables get the hard part done.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Re^3: "Rites of Passage" wheel reinventing
by Nkuvu (Priest) on Feb 26, 2004 at 22:14 UTC
I thought of this as an individual move validator. "Is this move legal?" sort of thing.
It's a small lookup table. Just fifty billion possibilities. Nothing big :)
Re: Re: Re: "Rites of Passage" wheel reinventing
by monsieur_champs (Curate) on Feb 27, 2004 at 15:15 UTC

Which I think would mean that you could solve the problem of the prefect game.

<funny>All in O(1) time, and built on-the-fly!! This should be a pretty nice chunck of code...</funny>

"In few words, translating PerlMonks documentation and best articles to other languages is like building a bridge to join other Perl communities into PerlMonks family. This makes the family bigger, the knowledge greater, the parties better and the life easier." -- monsieur_champs

Create A New User
Node Status?
node history
Node Type: note [id://332111]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-04-22 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (82 votes). Check out past polls.

Notices?