-
-
Save pranavgade20/dbd6180dbfbc657437ccf5d3d9dd25a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def strategy(opponent_source: str) -> str: | |
# a very simple strategy - defect if we have the slightest suspicion that the opponent will defect, cooperate otherwise | |
return 'defect' if 'defect' in opponent_source else 'cooperate' | |
# you can remove this driver code as long as you make sure that you read the opponent's code from stdin, and write your decision to stdout | |
def driver(): | |
import sys | |
opponent_source = ''.join(l for l in sys.stdin) | |
print(strategy(opponent_source)) | |
driver() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment