Add optional callback for grid planting and integrate maze utilities
This commit is contained in:
34
main.py
34
main.py
@@ -1,5 +1,6 @@
|
||||
import cactus
|
||||
import utils
|
||||
import maze
|
||||
import pumpkins
|
||||
import sunflowers
|
||||
from __builtins__ import *
|
||||
@@ -12,8 +13,8 @@ def plant_carrots(width, height):
|
||||
def plant_grass(width, height):
|
||||
utils.plant_grid(width, height, [Entities.Grass], 0.75, False)
|
||||
|
||||
def plant_alternating(width, height, plantWith):
|
||||
utils.plant_grid(width, height, plantWith, 0.75, False)
|
||||
def plant_alternating(width, height, plantWith, fn = None):
|
||||
utils.plant_grid(width, height, plantWith, 0.75, False, fn)
|
||||
|
||||
# Entire grid utils:
|
||||
# These are utilities to plant & harvest the entire grid with specific plants.
|
||||
@@ -38,6 +39,16 @@ def entire_grid_trees_and_grass():
|
||||
utils.move_to(0, 0)
|
||||
plant_alternating(world_size, world_size, [ Entities.Tree, Entities.Grass ])
|
||||
|
||||
def entire_grid_trees_and_grass_fertilizer():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
|
||||
def on_plant(x, y):
|
||||
use_item(Items.Fertilizer)
|
||||
|
||||
plant_alternating(world_size, world_size, [ Entities.Tree, Entities.Grass ], on_plant)
|
||||
|
||||
|
||||
def entire_grid_cactus():
|
||||
world_size = get_world_size()
|
||||
utils.move_to(0, 0)
|
||||
@@ -76,12 +87,21 @@ if __name__ == "__main__":
|
||||
while num_items(Items.Pumpkin) < 500000:
|
||||
entire_grid_pumpkins()
|
||||
|
||||
for i in range(10):
|
||||
entire_grid_trees_and_grass()
|
||||
utils.move_to(0, 0)
|
||||
|
||||
entire_grid_carrots()
|
||||
entire_grid_carrots()
|
||||
entire_grid_pumpkins()
|
||||
maze.place(utils.world_size)
|
||||
maze.solve(utils.world_size)
|
||||
|
||||
|
||||
# entire_grid_trees_and_grass_fertilizer()
|
||||
# utils.harvest_grid(get_world_size(), get_world_size())
|
||||
|
||||
# for i in range(10):
|
||||
# entire_grid_trees_and_grass()
|
||||
|
||||
# entire_grid_carrots()
|
||||
# entire_grid_carrots()
|
||||
# entire_grid_pumpkins()
|
||||
|
||||
while True:
|
||||
worldSize = get_world_size()
|
||||
|
||||
Reference in New Issue
Block a user