首先,我对Python完全陌生,刚刚开始学习它。我知道很多关于 C++ 的东西,但我只是尝试用 Python 实现其中一些。
我已经对其进行了大量搜索,但找不到任何符合我要求的解决方案。请看下面的代码,
import os
class _Getch:
"""Gets a single character from standard input. Does not echo to the
screen."""
def __init__(self):
try:
self.impl = _GetchWindows()
except:
print("Error!")
def __call__(self): return self.impl()
class _GetchWindows:
def __init__(self):
import msvcrt
def __call__(self):
import msvcrt
return msvcrt.getch()
def mainfun():
check = fh = True
while check:
fh = True
arr = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
print ("Welcome to Tic Tac Toe Game!!!\n\n")
print("Enter 1 to …Run Code Online (Sandbox Code Playgroud)