-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfastreset.py
More file actions
150 lines (118 loc) · 3.72 KB
/
fastreset.py
File metadata and controls
150 lines (118 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import autocollect
import planter
import misc
import sunflower
import maze
import snake
import pumpkin
import cactus
import polyculture
import weirdsubstance
def getAvailableUnlocks():
unlockList = []
for u in Unlocks:
unlockCost = get_cost(u)
if( len(unlockCost) == 0):
continue #already unlocked
isUnlockable = True
for requiredItem in unlockCost:
if( num_unlocked(requiredItem) == 0 ): #item required is not unlocked!
isUnlockable = False
if( isUnlockable == False):
continue #not possible to unlock
unlockList.append(u)
return unlockList
def getNextUnlock():
unlockList = getAvailableUnlocks()
for u in unlockList:
if( u == Unlocks.Expand ):
return u #select this as first priority
savedAmount = 0
savedUnlock = None
for u in unlockList:
thisAmount = 0
unlockDict = get_cost(u)
for item in unlockDict:
thisAmount = thisAmount + unlockDict[item]
if(savedUnlock == None or thisAmount < savedAmount):
savedUnlock = u
savedAmount = thisAmount
return savedUnlock
def getItemLowInventory():
itemAmountDict = {
Items.Hay:2*12*misc.getEntityMaxCount(),
Items.Wood:2*12*misc.getEntityMaxCount(),
Items.Carrot:4*10*misc.getEntityMaxCount(),
Items.Pumpkin:2*20*misc.getEntityMaxCount(),
Items.Weird_Substance:10*get_world_size()*num_unlocked(Unlocks.Mazes)
}
for item in itemAmountDict:
if( item == Items.Wood and num_unlocked(Unlocks.Plant) == 0):
continue
if( item == Items.Carrot and num_unlocked(Unlocks.Carrots) == 0):
continue
if( item == Items.Pumpkin and num_unlocked(Unlocks.Pumpkins) == 0):
continue
if( item == Items.Weird_Substance and num_unlocked(Unlocks.Fertilizer) == 0 ):
continue
requiredAmount = itemAmountDict[item]
if( num_items(item) < requiredAmount):
return item
def autoRun(filename, speedup):
if( num_unlocked(Unlocks.Leaderboard) > 0 ):
leaderboard_run(Leaderboards.Fastest_Reset, filename, speedup)
while( num_unlocked(Unlocks.Leaderboard) == 0 ):
thisUnlock = getNextUnlock()
if(thisUnlock == None):
break
thisCostDict = get_cost(thisUnlock)
canPlant = num_unlocked(Unlocks.Plant) > 0
canMove = num_unlocked(Unlocks.Expand) > 0
canZigZag = num_unlocked(Unlocks.Expand) > 1
for item in thisCostDict:
entity = misc.getItemEntity(item)
lastItem = None
while( num_items(item) < thisCostDict[item] ):
lowItem = getItemLowInventory()
if( lowItem != None or item == Items.Hay or item == Items.Wood or item == Items.Carrot ):
if( lowItem == None ):
plantItem = item
else:
plantItem = lowItem
if( plantItem == Items.Pumpkin ):
pumpkin.autoFarm()
elif( plantItem == Items.Weird_Substance):
weirdsubstance.autoFarm()
elif( canZigZag ):
polyculture.autoFarmEntity( misc.getItemEntity(plantItem) )
else:
entity = misc.getItemEntity(plantItem)
if( can_harvest() ):
harvest()
entityType = get_entity_type()
if( canPlant == True and entityType != entity and (entityType == None or entityType == Entities.Grass) ):
plant(entity)
if( canMove ):
move(North)
elif( item == Items.Power ):
if( sunflower.autoFarm() == False ):
break
elif(item == Items.Gold ):
if( maze.findTreasure() == False ):
break
elif( item == Items.Bone ):
tillFirst = (minItem != lastItem)
if(snake.runGame(tillFirst) == False ):
break
elif( item == Items.Pumpkin ):
if( pumpkin.autoFarm() == False ):
break
elif( item == Items.Cactus ):
if( cactus.autoFarm() == False ):
break
else:
break
lastItem = item
unlockSuccess = unlock(thisUnlock)
quick_print(thisUnlock, "unlock", unlockSuccess)
return num_unlocked(Unlocks.Leaderboard) > 0