简体   繁体   English

2位玩家,介子在矩阵中移动

[英]2 players, pion move in a matrix

I have a question related to 2 players move in a matrix. 我有一个问题与2个玩家的矩阵移动有关。 I assume that there is a well known method for this question, but I didnt find one. 我认为有一个众所周知的方法可以解决这个问题,但是我没有找到一个方法。

There is a matrix with m rows, n columns. 有一个矩阵,其中包含m行n列。 2 players will move a pion respectively. 2个玩家将分别移动一个中介。 Pion can move only i+1 or j+1 which means only right or down. 介子只能移动i + 1或j + 1,这意味着只能向右或向下移动。 Last row and last column of the matrix is filled with given values. 矩阵的最后一行和最后一列填充有给定值。 The purpose of the game is to reach last row or last column, first player wants to get max value, second player wants to get lowest value, in the last row/column. 游戏的目的是到达最后一行或最后一列,第一位玩家想要获得最大值,第二位玩家想要获得最低值,位于最后一行/列中。

在此处输入图片说明

According to above table, 2 players will move pion p from 0,0 position. 根据上表,有2个玩家将从0,0位置移动pion p。 First player wants to reach a bigger element, while second player wants to reach a smaller element. 第一个玩家想要达到更大的元素,而第二个玩家想要达到一个较小的元素。

My idea: Since players will move the pion respectively, I have separated the table as follows 我的想法:由于玩家会分别移动介子,所以我将桌子分开如下 在此处输入图片说明

cells with 1s refer the only possible moves of first player and 2s refer to only possible second player moves. 带有1的单元格代表第一玩家的唯一可能动作,带有2的单元格仅代表第二玩家的可能动作。 From this point I thought about a dynamic programming solution but couldnt find any. 从这一点出发,我想到了一个动态编程解决方案,但找不到任何解决方案。

Any help is appreciated. 任何帮助表示赞赏。

The state of dynamic programming is (number of row, number of column). 动态编程的状态是(行数,列数)。 The value is the best score the player can achieve by moving from this cell. 该值是玩家从该单元格移动可获得的最佳分数。
Base case: the score for a cell in the last row/column is fixed. 基本情况:最后一行/列中单元格的分数是固定的。
Inductive case: try to move right and down and choose the best option. 归纳案例:尝试左右移动并选择最佳选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM