def actual_idx_move(self, move_idx):
     '''
     commits a move in tensor notation
     in both actual_game and rollout_game
     '''
     move_fen = tn.tensor_indices_to_move(move_idx)
     self._actual_move(move_fen)
 def idx_move(self, move_idx):
     '''
     make a move in index notation in rollout game
     :param tuple: tuple with three np.arrays of
     shape (1,) denoting the index of a move in
     move tensor notation
     '''
     move_fen = tn.tensor_indices_to_move(move_idx)
     try:
         self.rollout_game.make_move(move_fen)
     except:
         raise ValueError(f"rollout: move {move_fen} \
                 not possible in position \
                 {self.rollout_game.board.fen()}")
     return tn.fen_to_tensor(self.rollout_game.board.fen())
    def get_new_position(self, old_pos, move_idx):
        """
        get new position from an
        old position and a move
        selected in old position
        """
        old_fen = tn.tensor_to_fen(old_pos)
        self.rollout_game.board = chess.variant.RacingKingsBoard(old_fen)

        move_fen = tn.tensor_indices_to_move(move_idx)

        try:
            self.rollout_game.make_move(move_fen)
        except:
            raise ValueError(f"move {move_fen} \
                    not possible in position {old_fen}")

        new_fen = self.rollout_game.board.fen()
        return tn.fen_to_tensor(new_fen)
 def move_index_to_fen(self, move_idx):
     '''
     translate move index to uci notation
     :return str: move in uci notation
     '''
     return tn.tensor_indices_to_move(move_idx)