Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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.)


    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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://332111]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-06-25 06:44 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.