创建一个程序来玩战舰,可变射击是他们想要射击的单元格,因此我想创建一个变量,其单元格坐标为“ X”(命中)或“ O”(命中)打印网格。
尝试(拍摄)=“ X”,但仅将烟灰分配给X (位置和alll是数组)
shoot = input("Choose your cell to attack in the form letter number eg (a1): ")
if shoot in locations:
print("HIT")
(shoot) = "X"
computerturn()
elif shoot in alll:
print("MISS")
(shoot) = "O"
computerturn()
如果shoot是a1并且a1在位置,则变量a1应该为X