Welcome, Guest. Please Login or Register.
Apr 19th, 2024, 1:33pm

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Bot Performance »


   Arimaa Forum
   Arimaa
   Bot Development
(Moderator: supersamu)
   Bot Performance
« Previous topic | Next topic »
Pages: 1 2 3  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Bot Performance  (Read 5601 times)
jdb
Forum Guru
*****



Arimaa player #214

   


Gender: male
Posts: 682
Re: Bot Performance
« Reply #15 on: Jul 26th, 2010, 10:01am »
Quote Quote Modify Modify

Here is the test case from clueless for the routine to generate all unique moves for a position. The ones with 300K legal moves take around .25 sec each on my machine. The position text is the same as the one used by the arimaa server. To get something human readable replace "%13" with "/n".
 
Code:

package arimaa3;
 
import static org.junit.Assert.*;
 
import org.junit.Before;
import org.junit.Test;
 
public class GenTurn2Test {
 
 private GenTurn2 turn;  
 private long result[];
 
 @Before
 public void setUp() throws Exception {
  turn = new GenTurn2();
  result = new long[800000];
 }
 
 String text[] = {
   "10w %13 +-----------------+%138| r r r     r r   |%137| r   m c c h r r |%136|   d    d   |%135|    E  |%134|       |%133|   H     e   D   |%132| R   C     C   R |%131| R R R D M R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 80%13",
   "21w %13 +-----------------+%138| r r r  r   |%137| r   m h c r   r |%136|   d   E     d   |%135|   r   |%134|       |%133|   H     e   D   |%132| R   C   C     R |%131| R R R   M R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 168%13",
   "22w %13 +-----------------+%138| r r r  r   |%137| r   m h c r   r |%136|   d   E     d   |%135| r     |%134|       |%133|   H     e   D   |%132| R   C   C     R |%131| R R R M   R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 176%13",
   "6b %13 +-----------------+%138| r r r m   r r r |%137| r   c     d   r |%136|   h     c   h   |%135|  d E  |%134|       |%133| H H     e   M   |%132| D D R     C C   |%131| R R R R   R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 52%13",
   "23b %13 +-----------------+%138| r r r   m r r r |%137| r   d     c   r |%136| D   d E     h   |%135| h   H c    |%134|  C     H   |%133|   R   e     M D |%132|     R     C   R |%131| R R    R R |%13 +-----------------+%13   a b c d e f g h%13TS: 188%13",
   "11w %13 +-----------------+%138| r r r     r r r |%137|     c   r c     |%136|   d    h   |%135| h     |%134|    E   d   |%133|   C     e   H   |%132| R   D D   C   R |%131| R R R   M R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 88%13",
   "18b %13 +-----------------+%138| r r r   m r r r |%137| r   c d c d   r |%136|   h    h   |%135|       |%134| R     E    |%133|   H   e     H   |%132| M   D C C D   R |%131| R R R     R R R |%13 +-----------------+%13   a b c d e f g h%13TS: 148%13",
   "25w %13 +-----------------+%138| r r   m r   r r |%137| r c d c   d r   |%136|   h   e E   h   |%135|       |%134|     R |%133|   H    H   |%132|     D   D C C   |%131| R R R   M   R R |%13 +-----------------+%13   a b c d e f g h%13TS: 200%13",
   "40w %13 +-----------------+%138| r r     m r   r |%137| r c d h   d r R |%136|  e E   r   |%135|       |%134|       |%133|    D   H   |%132|  D   C C   |%131| R R R M     R R |%13 +-----------------+%13   a b c d e f g h%13TS: 320%13",
   "14b %13 +-----------------+%138| r r r m   r r r |%137| r d d c     c r |%136|   h      h |%135|       |%134|       |%133|   H   e     H E |%132| R D D C M C   R |%131| R R R   R   R R |%13 +-----------------+%13   a b c d e f g h%13TS: 116%13",
   "24b %13 +-----------------+%138| r r r   m r r r |%137| r d d c     c r |%136|   h    h   |%135|       |%134|       |%133| C H   e     R H |%132| R D D E   C R R |%131| R R R   M     R |%13 +-----------------+%13   a b c d e f g h%13TS: 196%13",
   "12w %13 +-----------------+%138| r e   |%137|       |%136|       |%135|       |%134|       |%133|       |%132|       |%131| R E   |%13 +-----------------+%13   a b c d e f g h%13TS: 44%13",
   "48b %13 +-----------------+%138| r    D r   |%137| r     r    |%136|   c   |%135|      c     |%134| R r h      |%133|     D r     E   |%132|     C d R R d R |%131|  R  R |%13 +-----------------+%13   a b c d e f g h%13",
   "48b %13 +-----------------+%138| r    D r   |%137| r     r    |%136|   c   |%135|      c     |%134| R r h      |%133|    r e E   |%132|   D C d R R d R |%131|    R     R |%13 +-----------------+%13   a b c d e f g h%13",
   "20w %13 +-----------------+%138| r r   m h   r   |%137| r   M     r   r |%136| r     E    |%135|   R      H |%134|     e |%133| D  C     R |%132|     H C   R     |%131| R R R  R R |%13 +-----------------+%13   a b c d e f g h%13",
   "16w %13 +-----------------+%138|     e      |%137| R     |%136|       |%135|      E     |%134|       |%133|  R    |%132|       |%131|       |%13 +-----------------+%13   a b c d e f g h%13", // Endgame
   "16b %13 +-----------------+%138|     e      |%137|       |%136|       |%135|      E     |%134|       |%133|  R    |%132|       |%131|       |%13 +-----------------+%13   a b c d e f g h%13", // Endgame
   "16w %13 +-----------------+%138|     e      |%137|       |%136|       |%135|      E     |%134|       |%133|  R    |%132|       |%131|       |%13 +-----------------+%13   a b c d e f g h%13", // Endgame
   "26b %13 +-----------------+%138| r r r r r   r r |%137| M E d h    |%136| h D C c c   R H |%135| R R R R r m   e |%134|   H R |%133|       |%132|    R  |%131|       |%13 +-----------------+%13   a b c d e f g h%13",
   "46b %13 +-----------------+%138|       |%137|       |%136|       |%135|       |%134|    r   r   |%133| r   r   E   D r |%132| R M e R m     R |%131|   h R      |%13 +-----------------+%13   a b c d e f g h%13",
   "61w %13 +-----------------+%138| r H r      |%137|   m E      |%136|   r R d c   r   |%135|   R   R R   R r |%134| R D e R   r C r |%133|       |%132|       |%131|       |%13 +-----------------+%13   a b c d e f g h%13",
   "58b %13 +-----------------+%138|       |%137|       |%136|       |%135|       |%134|   C    M r |%133| R e r E    |%132|     D r r r   R |%131|     R R R R R   |%13 +-----------------+%13   a b c d e f g h%13",
   "40b %13 +-----------------+%138|    r   r r |%137| r   c |%136|    D  |%135|   H   R    |%134|      M     |%133|   m      H |%132|   E e R  r |%131|   R R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138| r r     r   H   |%137|     c r R h   r |%136|   d  H R   |%135|   e   |%134|   h E  r C |%133|   d R c     R   |%132|     R      |%131|       |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   E   M   C     |%136|       |%135|     D   H   D   |%134|  H   C     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   E   H   C     |%136|       |%135|     D   H   D   |%134|  M   C     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   C   H   E     |%136|       |%135|     D   H   D   |%134|  M   C     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   C   H   E     |%136|       |%135|     D   H   D   |%134|  M   C     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   C   H   E     |%136|       |%135|     D   M   D   |%134|  H   C     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   C   H   E     |%136|       |%135|     D   M   D   |%134|  C   H     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137|   E   H   C     |%136|       |%135|     D   M   D   |%134|  C   H     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
   "63w %13 +-----------------+%138|     r |%137| E     H   C     |%136|       |%135|     D   M   D   |%134|  C   H     |%133|   R   |%132|     R   R   R   |%131|   R   R   R   R |%13 +-----------------+%13   a b c d e f g h%13",
 };
 
 long correct_move_count[] = {
   20229,20203,18569,25293,17386,23695,22409,31866,17622,10232,14361,79,859 6,
   16477,48665,358,19,150,3598,161,2549,141,2030,3045,336488,337916,337922,  
   337922,338030,338034,338034,315908,
 };
 
 
 
 @Test
 public void testGenAllTurns() {
  // Run test positions
  for (int i=0; i<text.length; i++ ) {
   String pos_text = text[i];
   GameState position = new GameState(pos_text);
   turn.genAllTurns(position, result);
   long total_moves = result[0]/2;
   assertEquals(correct_move_count[i],total_moves);
  }
 }
 
}
IP Logged
speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #16 on: Jul 26th, 2010, 10:52am »
Quote Quote Modify Modify

Great, thanks!
IP Logged
speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #17 on: Jul 27th, 2010, 9:13pm »
Quote Quote Modify Modify

Regarding the position with just the elephant 19 legal moves for silver - I only see 18 legal moves.  Not changing the position isn't a legal move, right?  What am I missing?
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Bot Performance
« Reply #18 on: Jul 27th, 2010, 9:40pm »
Quote Quote Modify Modify

on Jul 27th, 2010, 9:13pm, speek wrote:
Regarding the position with just the elephant 19 legal moves for silver - I only see 18 legal moves.  Not changing the position isn't a legal move, right?  What am I missing?

Suicide is legal.  By my count the elephant can reach 18 different squares or go bye-bye for 19 total legal moves.
IP Logged

speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #19 on: Jul 27th, 2010, 10:23pm »
Quote Quote Modify Modify

That's how I get to 18.  The possible moves are:
 
a6,a7,a8   3
b5,b6,b7,b8    4
c6,c7    2
d6,d7,d8   3
e6,e7,e8   3
f7,f8      2
g8         1
 
total =      18
 
Which square did I miss?
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Bot Performance
« Reply #20 on: Jul 27th, 2010, 10:45pm »
Quote Quote Modify Modify

on Jul 27th, 2010, 10:23pm, speek wrote:
That's how I get to 18.  The possible moves are:
 
a6,a7,a8                  3
b5,b6,b7,b8              4
c6,c7                        2
d6,d7,d8                  3
e6,e7,e8                  3
f7,f8                          2
g8                             1
 
total =                     18
 
Which square did I miss?

You missed d5.
IP Logged

speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #21 on: Jul 28th, 2010, 8:35am »
Quote Quote Modify Modify

I have the gold elephant at d5.  A lot of the pieces appear "in between" columns when I replace %13 with \n.  Probably this is why my code is often off by a few tens of moves on some of these positions.  Any pointers on how to properly read these charts?
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Bot Performance
« Reply #22 on: Jul 28th, 2010, 9:26am »
Quote Quote Modify Modify

The way text is displayed by the forum collapses anything more than five spaces down to five spaces.  I couldn't get the board to display properly from cutting and pasting JDB's post.  I had to quote JDB's post, and then cut and paste from the window where I was editing my supposed reply to his message.  Then I had the right number of spaces.
IP Logged

jdb
Forum Guru
*****



Arimaa player #214

   


Gender: male
Posts: 682
Re: Bot Performance
« Reply #23 on: Jul 28th, 2010, 9:33am »
Quote Quote Modify Modify

on Jul 28th, 2010, 8:35am, speek wrote:
I have the gold elephant at d5.  A lot of the pieces appear "in between" columns when I replace %13 with \n.  Probably this is why my code is often off by a few tens of moves on some of these positions.  Any pointers on how to properly read these charts?

 
 
String readable_text = pos_text.replaceAll("%13","\n");
System.out.println(readable_text);
 
Should print out the position in a nice format.
IP Logged
speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #24 on: Jul 28th, 2010, 9:34am »
Quote Quote Modify Modify

on Jul 28th, 2010, 9:26am, Fritzlein wrote:
 I had to quote JDB's post

 
Ah, thanks for the secret!
IP Logged
jdb
Forum Guru
*****



Arimaa player #214

   


Gender: male
Posts: 682
Re: Bot Performance
« Reply #25 on: Jul 28th, 2010, 9:35am »
Quote Quote Modify Modify

on Jul 28th, 2010, 9:26am, Fritzlein wrote:
The way text is displayed by the forum collapses anything more than five spaces down to five spaces.  I couldn't get the board to display properly from cutting and pasting JDB's post.  I had to quote JDB's post, and then cut and paste from the window where I was editing my supposed reply to his message.  Then I had the right number of spaces.

 
I didn't know about the 5 space thing. Is there a way for me to fix that on my end?
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Bot Performance
« Reply #26 on: Jul 28th, 2010, 9:44am »
Quote Quote Modify Modify

on Jul 28th, 2010, 9:35am, jdb wrote:
I didn't know about the 5 space thing. Is there a way for me to fix that on my end?

Not that I know of.  When I use non-proportional font to make tables, I have to put in periods to stop the spaces from collapsing and to make it display correctly in the forum.   Angry  For example:
 

Elephant File    2005  2006  2007  2008  2009  2010
-------------    ----  ----  ----  ----  ----  ----
d .    .     .   98.1  79.5  85.3  89.9  90.0  81.6
c .    .     .     .   13.7   9.4   9.5  10.0  13.2
b .    .     .    1.9   6.3   5.3    .     .    5.2
a .    .     .     .    0.5    .    0.6
 
Rabbits Forward  2005  2006  2007  2008  2009  2010
---------------  ----  ----  ----  ----  ----  ----
ah     .     .   55.6  56.3  76.5  59.5  57.1  52.4
a .    .     .    2.5  15.3   4.1   0.6   5.0  12.8
none   .     .   14.4  22.6  10.0   6.0   2.1  10.8
cf     .     .   23.1    .     .    8.3   1.4   6.6
ac     .     .     .     .     .    0.6    .    5.2
c .    .     .    3.1    .     .     .     .    3.8      
acfh   .     .    0.6    .     .   14.9  22.1   3.5
af     .     .     .     .     .     .    0.7   2.1
ach    .     .     .     .     .     .    1.4   1.0
acf    .     .     .     .     .     .     .    1.0
ad     .     .     .     .     .     .     .    0.3
ce     .     .     .     .     .     .     .    0.3
adh    .     .     .    2.6   4.1  10.1  10.0
adeh   .     .     .    2.6   4.1
ag     .     .     .    0.5   1.2  
abgh   .     .    0.6          
  
Setup Balance    2005  2006  2007  2008  2009  2010
-------------    ----  ----  ----  ----  ----  ----
Symmetrical  .   56.9  50.5  54.1  50.0  35.7  20.1
Balanced     .   22.5  30.0  34.1  42.3  42.9  31.2
Unbalanced   .   20.6  19.5  11.8   7.7  20.7  48.6
 
Gold Move 2w     2005  2006  2007  2008  2009  2010
------------     ----  ----  ----  ----  ----  ----
E up 4 .     .   68.8  26.3  25.9  13.1  20.0  22.9
E up 3 over 1    11.3  11.6   1.2   3.6  14.3   9.7
E up 3; X up 1    6.3  41.1  40.0  45.2  45.7  33.3
E up 2; X,Y up 1  3.8  10.5  23.5  27.4  17.1  21.5
E, X, Y, Z up 1   3.8   3.2    .    1.2    .    4.2
Other  .     .    6.3   7.4   9.4   9.5   2.8   8.3

IP Logged

speek
Forum Guru
*****



Arimaa player #5441

   


Gender: male
Posts: 75
Re: Bot Performance
« Reply #27 on: Jul 28th, 2010, 9:55am »
Quote Quote Modify Modify

Ok, I am mostly getting the right answers.  Positions 2 and 3 for instance, spot on.  Position 1, off by 1Huh  But, I am using two different hashes of the board to key unique positions, so it's entirely possible two different positions have the same two hashes once in a great while.
IP Logged
rbarreira
Forum Guru
*****



Arimaa player #1621

   


Gender: male
Posts: 605
Re: Bot Performance
« Reply #28 on: Jul 28th, 2010, 9:58am »
Quote Quote Modify Modify

on Jul 28th, 2010, 9:55am, speek wrote:
Ok, I am mostly getting the right answers.  Positions 2 and 3 for instance, spot on.  Position 1, off by 1Huh  But, I am using two different hashes of the board to key unique positions, so it's entirely possible two different positions have the same two hashes once in a great while.

 
As long as your zobrist keys have enough bits (64 is more than enough) and they're random enough it is more likely to be struck by lightning than finding a hash collision by just looking at a few thousand positions.
IP Logged
jdb
Forum Guru
*****



Arimaa player #214

   


Gender: male
Posts: 682
Re: Bot Performance
« Reply #29 on: Jul 28th, 2010, 10:25am »
Quote Quote Modify Modify

on Jul 28th, 2010, 9:44am, Fritzlein wrote:

Not that I know of.  When I use non-proportional font to make tables, I have to put in periods to stop the spaces from collapsing and to make it display correctly in the forum.   Angry  For example:

 
Ok thanks for the info.
 
Maybe there is a setting in the forum software Omar can set?
IP Logged
Pages: 1 2 3  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

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