Skip to content

Instantly share code, notes, and snippets.

@antigones
Last active January 17, 2023 22:01
Show Gist options
  • Save antigones/bb483f282c2600eb7076680902fe4953 to your computer and use it in GitHub Desktop.
Save antigones/bb483f282c2600eb7076680902fe4953 to your computer and use it in GitHub Desktop.
Reward function
def get_reward(self, state):
# GOAT and WOLF cannot be left unsupervised together
# GOAT and CABBAGE cannot be left unsupervised together
if state[2] == self.goal_state[2]:
return 100
if {'🐐', '🐺'} <= state[0] and '⛵' not in state[0]:
return -100
if {'🐐', '🥦'} <= state[0] and '⛵' not in state[0]:
return -100
if {'🐐', '🐺'} <= state[2] and '⛵' not in state[2]:
return -100
if {'🐐', '🥦'} <= state[2] and '⛵' not in state[2]:
return -100
return -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment