Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy
- import time
- points = "Treasure Map Point Spot"
- gChest = "Golden Chest Spot"
- cChest = "Crystal Chest Spot"
- buff = "Buff Spot"
- bento = "Bento Spot"
- encounter = "Encounter Spot"
- empty = "Empty Spot"
- bird = "Bird Spot"
- rollUp = "Roll Increase Spot"
- rush = "Battle Rush Spot"
- start = "Starting Spot"
- record = { points: 0, gChest: 0, cChest: 0, buff: 0, bento: 0, encounter: 0, empty: 0, bird: 0, rollUp: 0, rush: 0, start: 0 }
- shortPath = [ start, bird, bird, bird, bird, bird, empty, empty, empty, empty, empty, empty, rollUp, empty, rollUp, empty, rollUp, empty, empty, empty, empty, empty, empty, rush ]
- bentoPath = [ start, bird, bird, bird, bird, bird, empty, empty, empty, empty, empty, empty, rollUp, empty, gChest, gChest, bento, buff, empty, encounter, points, buff, points, points, empty, empty, rush ]
- newBentoPath = [ start, bird, bird, bird, bird, bird, empty, empty, empty, empty, empty, rollUp, empty, empty, empty, empty, buff, buff, gChest, encounter, points, bento, buff, empty, rush ]
- secretPath = [ start, bird, bird, bird, bird, bird, buff, cChest, cChest, cChest, cChest, cChest, cChest, encounter, cChest, cChest, cChest, cChest, cChest, cChest, buff, empty, empty, buff, cChest, cChest, cChest, cChest, cChest, cChest, encounter, cChest, cChest, cChest, cChest, cChest, cChest, empty, rush ]
- mapTM = secretPath
- stamina = 1000000000
- #stamina = 200000
- currentPos = 0
- rollBonus = 0
- startingStamina = stamina
- staminaUsed = 0
- #for x in range(len(mapTM)):
- #print(x, mapTM[x])
- def roll(bonus = 0):
- global stamina
- global staminaUsed
- stamina -= 6
- staminaUsed += 6
- return(numpy.random.randint(1,5+1)+bonus)
- def move(position, amount):
- ahead = mapTM[position+1:position+amount+1]
- if encounter in ahead:
- return(position + ahead.index(encounter) + 1)
- elif rush in ahead:
- return(position + ahead.index(rush) + 1)
- else:
- return(position + amount)
- def bentoBonus():
- return([50, 75, 100][numpy.random.randint(0,3)])
- def markRecord():
- global record
- record[mapTM[currentPos]] += 1
- def runSimulation():
- global stamina
- global currentPos
- global rollBonus
- while (stamina > 6):
- #print(stamina, currentPos, rollBonus)
- markRecord()
- if (currentPos == len(mapTM) - 1):
- currentPos = 0 #reset back to start
- #Stamina and Roll modifiers
- if (mapTM[currentPos] == rollUp):
- rollBonus = 3
- if (mapTM[currentPos] == buff):
- rollBonus = 0
- if (mapTM[currentPos] == bento):
- stamina += bentoBonus()
- if (rollBonus > 0):
- currentPos = move(currentPos, roll(1))
- rollBonus -= 1
- else:
- currentPos = move(currentPos, roll(0))
- print("Secret Map Chest Path Test. Starting Stamina: " + format(startingStamina, ","))
- print("-"*(len("Secret Map Chest Path Test. Starting Stamina: " + format(startingStamina, ","))))
- startTime = time.time()
- runSimulation()
- endTime = time.time()
- #print(record)
- print("Summary:")
- print("Full Maps Completed: " + format(record[rush], ",") + " Map(s)")
- print("Bento Boxes Obtained: " +format(record[bento], ",") + " Box(es)")
- print("Gold Chests Obtained: " +format(record[gChest], ",") + " Chest(s)")
- print("Crystal Chests Obtained: " +format(record[cChest], ",") + " Chest(s)")
- print("")
- try:
- print("Stamina to complete Full Map: " + str(round(staminaUsed/record[rush],3)) + " Stam/Map")
- except ZeroDivisionError:
- print("Number of Full Maps is zero. Stam/Map not calculated")
- try:
- print("Bento per Full Map: " + str(round(record[bento]/record[rush],3)) + " Bento/Map")
- except ZeroDivisionError:
- print("Number of Full Maps is zero. Bento/Map not calculated")
- try:
- print("Full Map per Bento: " + str(round(record[rush]/record[bento],3)) + " Map/Bento")
- except ZeroDivisionError:
- print("Number of Bento Boxes is zero. Map/Bento not calculated")
- try:
- print("Crystal Chests per Bento: " + str(round(record[cChest]/record[rush],3)) + " Chests/Map")
- except ZeroDivisionError:
- print("Number of Crystal Chests is zero. Crystal Chests/Map not calculated")
- print("")
- print("Simulation elapsed in: " + str(round(endTime-startTime,5)) + " seconds")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement