Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAticAtac

Posted 27 September 2012 - 09:07 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.
the change:

void make_move(Board &b, Move m, int player) {
  u32 &bnp = b.net[player];

  if (m<32) {
	for (unsigned i=0; i<5; ++i) {
		  if (test(m, i)) {
			b.base[i][player]--;
			bnp |= (077u<<(6*i)) & target[!player];
		  }
	}
  }
  else {
	u32 boarding = bnp & target[player];
	for (; boarding; boarding &= boarding-1) {
		  int row = lowest_bit_set(boarding) / 6;
		  b.base[row][!player] = 0;
		  if (b.base[row][player] < 3)  <---- limit to 3
			 b.base[row][player]++;
	}
	bnp &= ~target[player];
	bnp = player==0 ? bnp << 1 : bnp >> 1;
  
	if (m==32)
		  bnp = ((bnp & 00000000077u) << 24) + (bnp >> 6);
	else if (m==34)
		  bnp = ((bnp & 00077777777u) << 6) + ((bnp & 07700000000u) >> 24);
  
	bnp &= ~holes;
  }

  b.net[!player] &= ~bnp;
}


Now i hope we got all the rules Posted Image

#7AticAtac

Posted 27 September 2012 - 09:04 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.
the change:

void make_move(Board &b, Move m, int player) {
u32 &bnp = b.net[player];

if (m<32) {
for (unsigned i=0; i<5; ++i) {
if (test(m, i)) {
b.base[i][player]--;
bnp |= (077u<<(6*i)) & target[!player];
}
}
}
else {
u32 boarding = bnp & target[player];
for (; boarding; boarding &= boarding-1) {
int row = lowest_bit_set(boarding) / 6;
b.base[row][!player] = 0;
if (b.base[row][player] < 3) <---- limit to 3
b.base[row][player]++;
}
bnp &= ~target[player];
bnp = player==0 ? bnp << 1 : bnp >> 1;

if (m==32)
bnp = ((bnp & 00000000077u) << 24) + (bnp >> 6);
else if (m==34)
bnp = ((bnp & 00077777777u) << 6) + ((bnp & 07700000000u) >> 24);

bnp &= ~holes;
}

b.net[!player] &= ~bnp;
}



Now i hope we got all the rules Posted Image

#6AticAtac

Posted 27 September 2012 - 09:04 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.
the change:

void make_move(Board &b, Move m, int player) {
u32 &bnp = b.net[player];

if (m<32) {
for (unsigned i=0; i<5; ++i) {
if (test(m, i)) {
b.base[i][player]--;
bnp |= (077u<<(6*i)) & target[!player];
}
}
}
else {
u32 boarding = bnp & target[player];
for (; boarding; boarding &= boarding-1) {
int row = lowest_bit_set(boarding) / 6;
b.base[row][!player] = 0;
if (b.base[row][player] < 3)
b.base[row][player]++;
}
bnp &= ~target[player];
bnp = player==0 ? bnp << 1 : bnp >> 1;

if (m==32)
bnp = ((bnp & 00000000077u) << 24) + (bnp >> 6);
else if (m==34)
bnp = ((bnp & 00077777777u) << 6) + ((bnp & 07700000000u) >> 24);

bnp &= ~holes;
}

b.net[!player] &= ~bnp;
}



Now i hope we got all the rules Posted Image

#5AticAtac

Posted 27 September 2012 - 09:02 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.
the change:

void make_move(Board &b, Move m, int player) {
u32 &bnp = b.net[player];

if (m<32) {
for (unsigned i=0; i<5; ++i) {
if (test(m, i)) {
b.base[i][player]--;
bnp |= (077u<<(6*i)) & target[!player];
}
}
}
else {
u32 boarding = bnp & target[player];
for (; boarding; boarding &= boarding-1) {
int row = lowest_bit_set(boarding) / 6;
b.base[row][!player] = 0;
b.base[row][player]++;
if (b.base[row][player] > 3) b.base[row][player] = 3; <--- limit to 3
}
bnp &= ~target[player];
bnp = player==0 ? bnp << 1 : bnp >> 1;

if (m==32)
bnp = ((bnp & 00000000077u) << 24) + (bnp >> 6);
else if (m==34)
bnp = ((bnp & 00077777777u) << 6) + ((bnp & 07700000000u) >> 24);

bnp &= ~holes;
}

b.net[!player] &= ~bnp;
}



Now i hope we got all the rules Posted Image

#4AticAtac

Posted 27 September 2012 - 09:01 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.
the change:
[source lang="cpp"]void make_move(Board &b, Move m, int player) { u32 &bnp = b.net[player]; if (m<32) { for (unsigned i=0; i<5; ++i) { if (test(m, i)) { b.base[i][player]--; bnp |= (077u<<(6*i)) & target[!player]; } } } else { u32 boarding = bnp & target[player]; for (; boarding; boarding &= boarding-1) { int row = lowest_bit_set(boarding) / 6; b.base[row][!player] = 0; b.base[row][player]++; if (b.base[row][player] > 3) b.base[row][player] = 3; <--- limit to 3 } bnp &= ~target[player]; bnp = player==0 ? bnp << 1 : bnp >> 1; if (m==32) bnp = ((bnp & 00000000077u) << 24) + (bnp >> 6); else if (m==34) bnp = ((bnp & 00077777777u) << 6) + ((bnp & 07700000000u) >> 24); bnp &= ~holes; } b.net[!player] &= ~bnp;}[/source]


Now i hope we got all the rules Posted Image

#3AticAtac

Posted 27 September 2012 - 08:57 AM

I did not implement that, and the rule didn't come up in the games I played. This is an important rule because without it there are infinite games (draws, I would say). I'll implement it later.

In the emulator the door of the destroyed base stays always open!

Another rule: there cann't be more than 3 pieces in a base! So any additional piece moving into a base with already 3 pieces inside will be destroyed.

Now i hope we got all the rules Posted Image

PARTNERS