+ def get_adjacent_positions(self):
+ positions = [self.position]
+
+ x, y = self.position
+
+ if self.bits.check_bit(BITS.NORTH) and y > 0:
+ positions.append((x, y - 1))
+ if self.bits.check_bit(BITS.SOUTH) and y < 4:
+ positions.append((x, y + 1))
+ if self.bits.check_bit(BITS.EAST) and x < 4:
+ positions.append((x + 1, y))
+ if self.bits.check_bit(BITS.WEST) and x > 0:
+ positions.append((x - 1, y))
+
+ return positions
+
+ def get_knight_positions(self):
+ positions = set([self.position])
+
+ x, y = self.position
+
+ for a in (2, -2):
+ for b in (1, -1):
+ i, j = x + a, y + b
+ if 0 <= i < 5 and 0 <= j < 5:
+ positions.add((i, j))
+
+ i, j = x + b, y + a
+ if 0 <= i < 5 and 0 <= j < 5:
+ positions.add((i, j))
+
+ return sorted(list(positions))
+
+ def get_bishop_positions(self):
+ positions = set()
+