Author |
Topic: Evaluation components in bomb (Read 5938 times) |
|
fotland
Forum Guru
Arimaa player #211
Gender:
Posts: 216
|
|
Evaluation components in bomb
« on: Feb 11th, 2007, 6:30pm » |
Quote Modify
|
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.
|
« Last Edit: Feb 11th, 2007, 6:57pm by fotland » |
IP Logged |
|
|
|
IdahoEv
Forum Guru
Arimaa player #1753
Gender:
Posts: 405
|
|
Re: Evaluation components in bomb
« Reply #1 on: Feb 12th, 2007, 2:12pm » |
Quote Modify
|
on Feb 11th, 2007, 6:30pm, 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.
|
|
IP Logged |
|
|
|
fotland
Forum Guru
Arimaa player #211
Gender:
Posts: 216
|
|
Re: Evaluation components in bomb
« Reply #2 on: Feb 12th, 2007, 8:52pm » |
Quote Modify
|
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.
|
|
IP Logged |
|
|
|
chessandgo
Forum Guru
Arimaa player #1889
Gender:
Posts: 1244
|
|
Re: Evaluation components in bomb
« Reply #4 on: Feb 13th, 2007, 6:38am » |
Quote Modify
|
on Feb 13th, 2007, 3:09am, PMertens wrote: (not trying to restart a debate here) |
| (... but merely doing it) :p
|
|
IP Logged |
|
|
|
Fritzlein
Forum Guru
Arimaa player #706
Gender:
Posts: 5928
|
|
Re: Evaluation components in bomb
« Reply #5 on: Feb 19th, 2007, 4:52pm » |
Quote Modify
|
on Feb 11th, 2007, 6:30pm, 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
|
|
IP Logged |
|
|
|
IdahoEv
Forum Guru
Arimaa player #1753
Gender:
Posts: 405
|
|
Re: Evaluation components in bomb
« Reply #6 on: Feb 22nd, 2007, 2:53am » |
Quote Modify
|
on Feb 12th, 2007, 8:52pm, 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?
|
|
IP Logged |
|
|
|
|