Last active
April 24, 2018 17:41
-
-
Save fohria/aed4b538bba049b750c376657defece8 to your computer and use it in GitHub Desktop.
adding reward values to galaxy map file
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
# define our comma separated sequences of reward values | |
# average of first 50 is 6.04, average of 51-100 is 4.5 | |
green_rewards = [6, 8, 4, 3, 9, 5, 3, 6, 6, 5, 3, 4, 8, 4, 9, 2, 7, 5, 8, 3, 4, 5, 5, | |
3, 9, 3, 7, 8, 8, 9, 7, 6, 9, 4, 8, 9, 9, 8, 8, 5, 8, 3, 7, 7, 7, 3, | |
2, 8, 8, 7, 1, 4, 1, 5, 2, 6, 7, 6, 4, 7, 7, 7, 5, 7, 4, 4, 4, 2, 1, 7, 6, 5, 6, 6, 6, 6, 5, 6, 1, 3, 2, 5, 7, 7, 1, 4, 3, 3, 6, 2, 6, 4, 4, 5, 7, 7, 7, 2, 1, 1] | |
# average of first 50 is 4.46, average of 51-100 is 6.02 | |
orange_rewards = [4, 5, 4, 4, 4, 1, 2, 6, 5, 7, 7, 2, 5, 6, 4, 5, 6, 5, 5, 1, 4, 1, 3, 6, 2, 7, 3, 7, 5, 1, 6, 6, 1, 6, 6, 1, 3, 4, 7, 5, 2, 6, 6, 4, 7, 6, 7, 7, 2, 4, 7, 4, 9, 9, 9, 2, 3, 9, 8, 7, 5, 6, 4, 5, 6, 7, 7, 4, 9, 6, 6, 3, 4, | |
7, 7, 9, 7, 5, 4, 6, 5, 8, 8, 3, 2, 6, 3, 7, 5, 2, 8, 8, 9, 3, 4, 7, | |
7, 7, 6, 9] | |
# open starcraft galaxy file and save contents | |
contents = [] | |
with open("MoveToBeacon_probtask_7_bluebeacon.SC2Map/scripts/rewardfiller.galaxy", "r") as script: | |
contents = script.readlines() | |
## find the line after which we insert the reward values | |
insert_index = 0 | |
for index, line in enumerate(contents): | |
if "assign all reward values here" in line: | |
insert_index = index + 1 | |
# insert our reward values for green/good arm to the contents list | |
for index, value in enumerate(green_rewards): | |
insert_string = " gv_rewardArrayGreen[{}] = {};\n".format(index, value) | |
contents.insert(insert_index, insert_string) | |
contents.insert(insert_index, " // GREEN/GOOD ARM 1 (starts as good arm) REWARDS\n") | |
# insert our reward values for orange/bad arm to the contents list | |
for index, value in enumerate(orange_rewards): | |
insert_string = " gv_rewardArrayOrange[{}] = {};\n".format(index, value) | |
contents.insert(insert_index, insert_string) | |
contents.insert(insert_index, " // ORANGE/BAD REWARDS (starts as bad arm)\n") | |
# write completed contents back to the file | |
with open("MoveToBeacon_probtask_7_bluebeacon.SC2Map/scripts/rewardfiller.galaxy", "w") as script: | |
script.writelines(contents) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment