要使用 2D numpy 数组制作棋盘游戏,用户输入一个数字,我需要在单独的变量中返回该数字的 X 和 Y 值。
这就是我设置数组的方式
board = np.array(["01","02","03","04","05","06","07","08",
"09","10","11","12","13","14","15","16",
"17","18","19","20","21","22","23","24",
"25","26"," ","@@","29","30","31","32",
"33","34","35","@@"," ","38","39","40",
"41","42","43","44","45","46","47","48",
"49","50","51","52","53","54","55","56",
"57","58","59","60","61","62","63","64"])
board = board.reshape(8,8)
Run Code Online (Sandbox Code Playgroud)