Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Representing Complex but Static Data in Perl

by cyocum (Curate)
on Apr 07, 2005 at 14:13 UTC ( #445682=note: print w/replies, xml ) Need Help??

in reply to Re: Representing Complex but Static Data in Perl
in thread Representing Complex but Static Data in Perl

Very Cool. This is an interesting idea. Thanks for the reference to DMB::Deep. I may put the opening move database in there since I will only use it for a little while then once it is exhausted, I would move to the search function. I want to keep the valid move table in memory since I will use it over and over again rather than pulling from a file (although, at this beginning stage, it is probably not a huge increase in speed).

My plan was to encapulate the hash inside the piece object and then ask the piece object to give me all the valid moves from where it is (the piece object holds it's own position). That way I can control various special moves like en passant and castling in their respective objects.

  • Comment on Re^2: Representing Complex but Static Data in Perl

Replies are listed 'Best First'.
Re^3: Representing Complex but Static Data in Perl
by dragonchild (Archbishop) on Apr 07, 2005 at 14:25 UTC
    That's a lot of memory ... oh - you're also going to have to work out things like blocking pieces (for non-knights) and the like. To tell you the truth, I'm not seeing a huge gain here. Pawns have to have the state of the board to determine ep. Granted, you have a set of optimizers to make the ep check pretty cheap, but it's still there.

    Frankly, I would drop into XS and write the move generation code there. That is, of course, if the speed is that poor.

    Also, a question no-one (including me) has approached is whether or not your original algorithm was good or not. 90% of all speedups happen in better algorithm choice.

      My algorithem choice was alphabeta and it is pretty slow probably due to the fact that I am still learning all the ins and outs of this kind of programming. Once I learn about how to write a good alphabeta, I will then move to something more interesting like MTD(f).

      To work out the blocking pieces, you just run along the list of moves and check the square represented against the board, which can be passed to the function as a reference. Since the board is stored internally as a 8x8 multi-dim array, it is pretty easy to see if there is something there and of what color. I have a function called isOccupied to check and isColor to tell me the color.

      Of course, this could all be negated by using bitboards but I am not comfortable enough with the idea yet to try it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://445682]
[james28909]: what would be the best way to capture that stream with perl? ffmpeg args -rtp rtp://
[LanX]: if I was forced to talk about all security risks I encountered oO
[james28909]: if i did that with ffmpeg, i could then listen on the port with perl right?
[LanX]: one of my clients filtered a menu linking to Web pages according to user rights. .. but he didn't secure the access to those unlisted pages

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-05-22 21:51 GMT
Find Nodes?
    Voting Booth?