Welcome, Guest. Please Login or Register.
May 6th, 2024, 9:44pm

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Move generation in Bomb »


   Arimaa Forum
   Arimaa
   Bot Development
(Moderator: supersamu)
   Move generation in Bomb
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Move generation in Bomb  (Read 771 times)
fotland
Forum Guru
*****



Arimaa player #211

   


Gender: male
Posts: 216
Move generation in Bomb
« on: Feb 11th, 2007, 5:55pm »
Quote Quote Modify Modify

With bitmaps for the board, move generation is very simple.  I generate push and pull moves first, since they are more likely to cause a cutoff in the search, and are very common in the principal variations.
 
My bomb code was derived from an earlier chess program, so it uses chess terminology.
 
The code to generate the rest of the moves is just:
 bmap t;
 bmap all = p[WPIECES];
 all.bmor(p[BPIECES]);
 
 bmap unfrozen = p[WPIECES+tm];
 unfrozen.andnot(frozen);
 if(tm == WHITE){
  // much faster to generate forward moves first
  t = unfrozen;
  t.shu();
  t.andnot(all);
  while((to = t.nextbit()) != NOBITS){
   (nextmove++)->setmove(to+8, to);
  }
  t = unfrozen;
  t.shl();
  t.andnot(all);
  while((to = t.nextbit()) != NOBITS){
   (nextmove++)->setmove(to+1, to);
  }
  t = unfrozen;
  t.shr();
  t.andnot(all);
  while((to = t.nextbit()) != NOBITS){
   (nextmove++)->setmove(to-1, to);
  }
  t = unfrozen;
  t.andnot(p[WPAWN]); // pawns can't move backwards */
  t.shd();
  t.andnot(all);
  while((to = t.nextbit()) != NOBITS){
   (nextmove++)->setmove(to-8, to);
  }
 
and the same code for black.
IP Logged
Pages: 1  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.