Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Bot Development >> Evaluation components in bomb
(Message started by: fotland on Feb 11th, 2007, 6:30pm)

Title: Evaluation components in bomb
Post by fotland on Feb 11th, 2007, 6:30pm
Here I list the components of bomb's evaluation function. I'll start other topics for the more complex ones.

Material. I use a simple, static material value that is easy to maintain incrementally. Piece values don't change, and are: 100, 250, 300, 600, 900, 1500.

Positional terms are:

Opening book lookup - every position from every game played is saved in a persistent opening book with the number of times it was a win and the number of times it was a loss. Add 10 * (wins-losses). This prevents repeating a game that led to a loss. The book is in memory, so the lookup is very fast - a single probe using the position hash. The book holds 1 million positions.

Rabbit count - bonus for having more rabbits. The values (by number of rabbits) are:
0, 1000, 1400, 1700, 1900, 2050, 2150, 2200, 2200
So the last rabbit is worth more than a camel but less than an elephant.

Trap safety - a safe trap has an elephant or two pieces next to it.

Trap control

Pins - a piece must stay near a trap to save another weaker piece

Frames - a piece is stuck on a trap

Distance from center for Elephant and Camel

Advance horse if enemy king pinned

Keep camel away from enemy elephant

Piece/square tables for each piece (not rabbits). This is just a set of constant values to add by piece type and square. For example, this is the array of values for a gold horse:

static short rookval[64] = { // 0 is upper left
-40,-20,-20,-20,-20,-20,-20, -40,
-30,-15,-10, -5, -5,-10,-15, -30,
-20, 10,-20, 5, 5,-20, 10, -20,
-5, 5, 5, 5, 5, 5, 5, -5,
0, 5, 5, 5, 5, 5, 5, 0,
-5, 10, 5, 7, 7, 5, 10, -5,
-5, 5, 8, 5, 5, 8, 5, -5,
-25,-10, -5, -5, -5,-10, -10, -25,
};

Don't leave a piece on a trap. If the trap is safe the penalty is 20 + the piece-square value/16. If the trapo is not safe, the penalty is (material value of this piece + piece-square value)/8.

Rabbit location and coordination evaluation

Frozen piece penalty:
-2, -10, -10, -15, -25, 0,

Static capture evaluation.  There are about 50 patterns of pieces that lead to capture in 4 steps or less.  I use a decision tree (nested if/then/else) to find each of these at each trap and evaluate them.  I have them all diagrammed somewhere, but I can't find it right now.  Every cature pattern with up 4 steps is included.

An example would be: one enemy piece adjacent to a trap, and that piece has a stronger, unfrozen friendly piece next to it, there is a 2-step capture possible.

I also find some sequences that lead to capture in up to 8 steps.

The trap evaluation is not complex, just big, about 500 lines of code.  The decision tree is organized for performance, with tests likely to fail made first.

I have a set of test positions, but it's not exhaustive so I'm sure there are still bugs.

The trap evaluation returns an array of pieces that can be trapped, and for each piece, the number of steps to trap it, and the number of steps to save it.  The array is then examined to find the biggest piece I can capture with my remaining steps, the biggest piece I can save with my remaining steps, then the worst the enemy can do with his next move.







Title: Re: Evaluation components in bomb
Post by IdahoEv on Feb 12th, 2007, 2:12pm

on 02/11/07 at 18:30:56, fotland wrote:
Opening book lookup - every position from every game played is saved in a persistent opening book with the number of times it was a win and the number of times it was a loss.  Add 10 * (wins-losses).  This prevents repeating a game that led to a loss.  The book is in memory, so the lookup is very fast - a single probe using the position hash.  The book holds 1 million positions.


Every game ever played, or every game Bomb has played?

Do you just store this in a file in Bomb's directory, load it at the beginning of each invocation of Bomb (i.e. each turn), and update it after the end of each game?

Does this mean that the instances of Bomb in the bot ladder are actively learning by adding to the opening book?  It would seem not, as  despite the number of times bait-and-tackle openings have been used on them, they still work.   And, IIRC, Omar has ruled that the bot ladder bots are to retain static performance.

Title: Re: Evaluation components in bomb
Post by fotland on Feb 12th, 2007, 8:52pm
Only games bomb has played are in the book.  I'm not running the ladder bots so I don;t know if the book is enabled.

Title: Re: Evaluation components in bomb
Post by PMertens on Feb 13th, 2007, 3:09am
As I understood from a similar discussion about gnobot the opening books are turned off.

http://arimaa.com/arimaa/forum/cgi/YaBB.cgi?board=devTalk;action=display;num=1149735353

I personally can just quote myself here:


Quote:
Please make it learn ...


(not trying to restart a debate here)

Title: Re: Evaluation components in bomb
Post by chessandgo on Feb 13th, 2007, 6:38am

on 02/13/07 at 03:09:36, PMertens wrote:
(not trying to restart a debate here)


(... but merely doing it) :p

Title: Re: Evaluation components in bomb
Post by Fritzlein on Feb 19th, 2007, 4:52pm

on 02/11/07 at 18:30:56, fotland wrote:
I use a simple, static material value that is easy to maintain incrementally.  Piece values don't change, and are: 100, 250, 300, 600, 900, 1500.

Rabbit count - bonus for having more rabbits.  The values (by number of rabbits) are:
0, 1000, 1400, 1700, 1900, 2050, 2150, 2200, 2200

For anyone else who had to look twice to understand the rabbit bonus, here are the values of rabbits in the order that they die, compared to the static pieces:

Rabbit 1: 100
Rabbit 2: 150
Rabbit 3: 200
Rabbit 4: 250 = cat
Rabbit 5: 300 = dog
Rabbit 6: 400
Rabbit 7: 500
600 = horse
900 = camel
Rabbit 8: 1100
1500 = elephant

Title: Re: Evaluation components in bomb
Post by IdahoEv on Feb 22nd, 2007, 2:53am

on 02/12/07 at 20:52:34, fotland wrote:
Only games bomb has played are in the book.  I'm not running the ladder bots so I don;t know if the book is enabled.


How is the book updated?  Is there a separate executable that gets called after the end of each game?



Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB 2000-2003. All Rights Reserved.