Ejemplo n.º 1
0
	def on_get_action(self, board: Board) -> Action:
		while True:
			print(board.matrix)
			key = input("Input your action:")
			action = {
				"w": Action.UP,
				"s": Action.DOWN,
				"a": Action.LEFT,
				"d": Action.RIGHT
			}.get(key)
			if action is None:
				print("Please type 'w' 'a' 's' or 'd' but not '", key, "'", sep="")
				continue
			if action not in board.get_options():
				print("Your action is illegal!")
				continue
			return action
Ejemplo n.º 2
0
 def on_suggest_action(self, board: Board) -> Action:
     options = board.get_options()
     index = np.random.randint(0, len(options))
     return options[index]