本文整理汇总了Python中sudoku.Sudoku.del_number方法的典型用法代码示例。如果您正苦于以下问题:Python Sudoku.del_number方法的具体用法?Python Sudoku.del_number怎么用?Python Sudoku.del_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sudoku.Sudoku
的用法示例。
在下文中一共展示了Sudoku.del_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from sudoku import Sudoku [as 别名]
# 或者: from sudoku.Sudoku import del_number [as 别名]
def main():
ui.mainmenu()
s = Sudoku()
print(s.get_str())
while True:
command = ui.input_command()
if command[0] == 0:
# ADD
args = ui.parse_add(command[1])
if s.check_number(args[0], args[1], args[2]) == []:
s.add_number(args[0], args[1], args[2])
else:
print("The number you tried to add does not fit the rules.")
print("Please try again.")
continue
elif command[0] == 1:
# DEL
args = ui.parse_del(command[1])
s.del_number(args[0], args[1])
elif command[0] == 2:
# SAVE
if not s.save(command[1]):
continue
elif command[0] == 3:
# LOAD
if not s.load(command[1]):
continue
elif command[0] == 4:
# CHK
if s.check():
print(COLORS["green"] + "Your Sudoku seems right.\n" + \
COLORS["clear"])
else:
print(COLORS["red"] + COLORS["bell"] + \
"Your Sudoku is wrong.\n" + COLORS["clear"])
continue
elif command[0] == 5:
# HELP
ui.parse_help(command[1])
continue
elif command[0] == 6:
# QUIT
print("Quitting game...")
exit()
elif command[0] == 7:
# NEW
s.set_numbers(EMPTY_SUDOKU)
elif command[0] == ERROR:
# ERROR
print("Unknown command. Please try again.")
continue
ui.clear_screen()
print(s.get_str())