You can translate this fragment into Python by arranging the choices and functions into a dictionary:
actions = {0: make_computer_move, 1: make_human_move}
actions.get(choice, report_error)()
ZhangZhihui's Blog |
|
||
Copyright © 2024 ZhangZhihuiAAA
Powered by .NET 9.0 on Kubernetes |