在numpy的二维数组中的特定位置插入单个值
Inserting a single value at a specific location in a 2D array in numpy
我正在尝试编写 Connect 4 游戏,我需要在棋盘上的特定 (row,col) 中插入“#”。有人可以解释一下我如何将这个值插入那个位置吗?
谢谢!
像这样:???
import numpy as np
board=np.zeros([8, 8], dtype=np.character)
print board
board[3, 4]="#"
print board
...或者您还有什么问题?
我正在尝试编写 Connect 4 游戏,我需要在棋盘上的特定 (row,col) 中插入“#”。有人可以解释一下我如何将这个值插入那个位置吗?
谢谢!
像这样:???
import numpy as np
board=np.zeros([8, 8], dtype=np.character)
print board
board[3, 4]="#"
print board
...或者您还有什么问题?