commit 4f45e0ec6ef76fa468e14d80d6bd1fdfacadc73c
Author: DerGrumpf
Date: Fri Sep 13 14:16:12 2024 +0200
init
diff --git a/Cactus.py b/Cactus.py
new file mode 100644
index 0000000..15ec980
--- /dev/null
+++ b/Cactus.py
@@ -0,0 +1,77 @@
+def Cactus():
+ size = get_world_size()
+ init_plant(size, Entities.Cactus)
+ goto((0,0))
+
+ field = []
+ for y in range(size):
+ row = []
+ for x in range(size):
+ goto((x,y))
+ better_plant(Entities.Cactus)
+ row.append(measure())
+ field.append(row)
+
+ for y in range(size):
+ curr = field[y]
+ while not is_sorted(curr):
+ for x in range(size):
+ goto((x,y))
+ if measure(East) < measure():
+ swap(East)
+ if measure(North) < measure():
+ swap(North)
+ for x in range(size):
+ goto((x,y))
+ curr[x] = measure()
+
+ for i in range(len(field)-1, 0, -1):
+ quick_print(field[i], is_sorted(field[i]))
+
+while num_items(Items.Cactus) < 3000:
+ harvest()
+ Cactus()
+
+def diag_sort(mat):
+ lst = []
+ n, m = len(mat), len(mat[0])
+ # leftmost column
+ for i in range(n):
+ lst.append([i, 0])
+
+ # rightmost row
+ for i in range(m):
+ lst.append([0, i])
+
+ lst.pop(0)
+
+ for el in lst:
+ i, j = el[0], el[1]
+ arr = []
+
+ # getting the diagonal elements
+ while i < n and j < m:
+ arr.append(mat[i][j])
+ i, j = i+1, j+1
+
+ arr = insertion_sort(arr)
+
+ i, j = el[0], el[1]
+ # setting the element in sorted order
+ while i < n and j < m:
+ mat[i][j] = arr.pop(0)
+ i, j = i+1, j+1
+ return mat
+
+
+m1 = [
+ [4,5,6],
+ [9,8,7],
+ [2,3,1]
+ ]
+for el in m1:
+ quick_print(el)
+m1 = diag_sort(m1)
+quick_print("")
+for el in m1:
+ quick_print(el)
\ No newline at end of file
diff --git a/Diagonalsort.py b/Diagonalsort.py
new file mode 100644
index 0000000..c9d31d0
--- /dev/null
+++ b/Diagonalsort.py
@@ -0,0 +1,32 @@
+def diagonalSort(self, mat: List[List[int]]) -> List[List[int]]:
+ lst = []
+ n, m = len(mat), len(mat[0])
+
+ # leftmost column
+ for i in range(n):
+ lst.append([i, 0])
+
+ # rightmost row
+ for i in range(m):
+ lst.append([0, i])
+
+ lst.pop(0)
+
+ for x, y in lst:
+ arr = []
+ i, j = x, y
+
+ # getting the diagonal elements
+ while i < n and j < m:
+ arr.append(mat[i][j])
+ i, j = i+1, j+1
+
+ arr.sort() # sort the elements
+
+ i, j = x, y
+ # setting the element in sorted order
+ while i < n and j < m:
+ mat[i][j] = arr.pop(0)
+ i, j = i+1, j+1
+
+ return mat
\ No newline at end of file
diff --git a/Dinosaur.py b/Dinosaur.py
new file mode 100644
index 0000000..cd8cbaa
--- /dev/null
+++ b/Dinosaur.py
@@ -0,0 +1,6 @@
+trade(Items.Egg, 100)
+field = field_grid(get_world_size())
+for cell in field:
+ goto(cell)
+ harvest()
+ use_item(Items.Egg)
\ No newline at end of file
diff --git a/Generics.py b/Generics.py
new file mode 100644
index 0000000..da8f409
--- /dev/null
+++ b/Generics.py
@@ -0,0 +1,166 @@
+def goto(coord):
+ x, y = coord[0], coord[1]
+ yDist = get_pos_y() - y # Positive if drone is north of the target space
+ xDist = get_pos_x() - x # Positive if drone is east of the target space
+ halfWorldSize = get_world_size()/2
+
+ while get_pos_y() != y:
+ if yDist >= halfWorldSize or (-halfWorldSize <= yDist and yDist < 0):
+ move(North)
+ else:
+ move(South)
+
+ while get_pos_x() != x:
+ if xDist >= halfWorldSize or (-halfWorldSize < xDist and xDist < 0):
+ move(East)
+ else:
+ move(West)
+
+def field_grid(size):
+ field = []
+ for x in range(size):
+ for y in range(size):
+ field.append((x,y))
+ return field
+
+def field_chess_grid(size, black):
+ field = []
+ for x in range(size):
+ for y in range(size):
+ if (x + y) % 2 == black:
+ field.append((x,y))
+ return field
+
+def field_plant_grid(size, element):
+ field = {}
+ for x in range(size):
+ for y in range(size):
+ field[(x,y)] = element
+ return field
+
+def index(x, y, width):
+ return x * width + y
+
+def get_inventory():
+ inventory = {}
+ for item in Items:
+ inventory[item] = num_items(item)
+ return inventory
+
+
+def init_plant(size, element):
+ if element == Entities.Grass:
+ clear()
+ do_a_flip()
+ return
+
+ # generate field
+ field = field_grid(size)
+ for cell in field:
+ goto(cell)
+ harvest()
+ better_plant(element)
+
+
+def harvest_field(size):
+ field = field_grid(size)
+ for cell in field:
+ goto(cell)
+ if can_harvest():
+ harvest()
+
+
+def replant(coords, element):
+ for coord in coords:
+ goto(coord)
+ plant(element)
+
+def is_sorted(arr):
+ for i in range(len(arr)-1):
+ if arr[i] > arr[i+1]:
+ return False
+ return True
+
+def check_seeds():
+ seeds = [Items.Carrot_Seed, Items.Pumpkin_Seed, Items.Sunflower_Seed, Items.Cactus_Seed]
+ inventory = get_inventory()
+ goal = {}
+ size = get_world_size()*get_world_size()
+
+ for seed in seeds:
+ diff = abs(inventory[seed] - size)
+ if diff > size:
+ goal[seed] = 0
+ else:
+ goal[seed] = diff
+
+ for g in goal:
+ amount = goal[g]
+ if amount > 0:
+ #quick_print("buying", g, amount)
+ if g == Items.Carrot_Seed:
+ if num_items(Items.Wood)/12 > amount and num_items(Items.Hay) > amount:
+ trade(g, amount)
+
+ if g == Items.Pumpkin_Seed:
+ if num_items(Items.Carrot)/9 > amount:
+ trade(g, amount)
+
+ if g == Items.Sunflower_Seed:
+ if num_items(Items.Carrot) > amount:
+ trade(g, amount)
+
+ if g == Items.Cactus_Seed:
+ if num_items(Items.Gold) > amount:
+ trade(g, amount)
+
+def sum(arr):
+ count = 0
+ for el in arr:
+ count += el
+ return count
+
+def sum_from_dict(d):
+ count = 0
+ for el in d:
+ count += d[el]
+ return count
+
+def better_plant(p):
+ if p == Entities.Grass or p == Entities.Bush or p == Entities.Tree:
+ if get_ground_type() != Grounds.Turf:
+ harvest()
+ till()
+ if p == Entities.Carrots or p == Entities.Pumpkin or p == Entities.Sunflower:
+ check_seeds()
+ if get_ground_type() != Grounds.Soil:
+ harvest()
+ till()
+ while get_water() < 0.8 and num_items(Items.Water_Tank) > 10:
+ use_item(Items.Water_Tank)
+ if num_items(Items.Pumpkin) > 10:
+ if num_items(Items.Fertilizer) < 1:
+ trade(Items.Fertilizer)
+ use_item(Items.Fertilizer)
+ if p == Entities.Cactus:
+ check_seeds()
+ if get_ground_type() != Grounds.Soil:
+ harvest()
+ till()
+ plant(p)
+
+def insertion_sort(array):
+ for step in range(1, len(array)):
+ key = array[step]
+ j = step - 1
+
+ # Compare key with each element on the left of it until an element smaller than it is found
+ # For descending order, change keyarray[j].
+ while j >= 0 and key < array[j]:
+ array[j + 1] = array[j]
+ j = j - 1
+
+ # Place key at after the element just smaller than it.
+ array[j + 1] = key
+ return array
+
diff --git a/Main.py b/Main.py
new file mode 100644
index 0000000..5193e45
--- /dev/null
+++ b/Main.py
@@ -0,0 +1,5 @@
+clear()
+while True:
+ #Tree()
+ #Mixed()
+ Pumpkin()
\ No newline at end of file
diff --git a/Maze.py b/Maze.py
new file mode 100644
index 0000000..ae9aaad
--- /dev/null
+++ b/Maze.py
@@ -0,0 +1,33 @@
+def start_maze(n_times):
+ init_maze()
+ while get_entity_type() != Entities.Hedge and get_entity_type() != Entities.Treasure:
+ trade(Items.Fertilizer)
+ use_item(Items.Fertilizer)
+ for i in range(n_times):
+ while get_entity_type() == Entities.Treasure:
+ trade(Items.Fertilizer)
+ use_item(Items.Fertilizer)
+ solve_maze()
+ harvest()
+
+def solve_maze():
+ facing = 0
+ directions = [North, East, South, West]
+
+ while get_entity_type() != Entities.Treasure:
+ x, y = get_pos_x(), get_pos_y()
+
+ move(directions[facing % 4])
+
+ facing += 1
+ if x == get_pos_x() and y == get_pos_y():
+ facing += 2
+
+def init_maze():
+ clear()
+ harvest()
+ better_plant(Entities.Bush)
+
+
+while num_items(Items.Gold) < 30000:
+ start_maze(1)
\ No newline at end of file
diff --git a/Polyculture.py b/Polyculture.py
new file mode 100644
index 0000000..bd5909b
--- /dev/null
+++ b/Polyculture.py
@@ -0,0 +1,19 @@
+def polyculture():
+
+ field = field_plant_grid(get_world_size(), Entities.Grass)
+
+ for cell in field:
+ goto(cell)
+ if get_companion() != None:
+ c, x, y = get_companion()
+ field[(x,y)] = c
+
+ p = field[(get_pos_x(), get_pos_y())]
+ better_plant(p)
+
+ if can_harvest():
+ harvest()
+
+init_plant(get_world_size(), Entities.Grass)
+while num_items(Items.Carrot) < 30000:
+ polyculture()
\ No newline at end of file
diff --git a/Pumpkins.py b/Pumpkins.py
new file mode 100644
index 0000000..7454ac4
--- /dev/null
+++ b/Pumpkins.py
@@ -0,0 +1,24 @@
+def pumpkin():
+ # init field
+ field = field_plant_grid(get_world_size(), 0)
+ init_plant(get_world_size(), Entities.Pumpkin)
+
+ while sum_from_dict(field) < get_world_size()*get_world_size():
+ for cell in field:
+ goto(cell)
+ if get_entity_type() == Entities.Pumpkin:
+ field[cell] = 1
+
+ for cell in field:
+ if field[cell] == 0:
+ goto(cell)
+ better_plant(Entities.Pumpkin)
+
+
+ harvest()
+
+
+while num_items(Items.Pumpkin) < 100000:
+ pumpkin()
+
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/Save0 b/Save0
new file mode 120000
index 0000000..492e713
--- /dev/null
+++ b/Save0
@@ -0,0 +1 @@
+/storage/SteamLibrary/steamapps/compatdata/2060160/pfx/drive_c/users/steamuser/AppData/LocalLow/TheFarmerWasReplaced/TheFarmerWasReplaced/Saves/Save0
\ No newline at end of file
diff --git a/Sunflowers.py b/Sunflowers.py
new file mode 100644
index 0000000..44df7ae
--- /dev/null
+++ b/Sunflowers.py
@@ -0,0 +1,22 @@
+def Sunflower():
+ field = field_plant_grid(get_world_size(), 0)
+
+ for cell in field:
+ goto(cell)
+ better_plant(Entities.Sunflower)
+ field[cell] = measure()
+
+ m = 15
+ while field:
+ delete = []
+ for cell in field:
+ if field[cell] == m:
+ goto(cell)
+ harvest()
+ delete.append(cell)
+ for d in delete:
+ field.pop(d)
+ m -= 1
+
+while num_items(Items.Power) < 10000:
+ Sunflower()
\ No newline at end of file
diff --git a/__builtins__.py b/__builtins__.py
new file mode 100644
index 0000000..cb865c3
--- /dev/null
+++ b/__builtins__.py
@@ -0,0 +1,974 @@
+from typing import Any, Optional
+
+
+# -------------------------------------------------------------------------------
+class Items:
+ @property
+ def Carrot(self):
+ """Obtained by harvesting carrots."""
+ ...
+
+ @property
+ def Carrot_Seed(self):
+ """Used to grow carrots by calling `plant(Entities.Carrots)` on empty soil."""
+ ...
+
+ @property
+ def Empty_Tank(self):
+ """Empty tanks automatically turn into water tanks over time."""
+ ...
+
+ @property
+ def Fertilizer(self):
+ """Call `use_item(Items.Fertilizer)` to instantly grow the plant under the drone by 2s."""
+ ...
+
+ @property
+ def Gold(self):
+ """Found in treasure chests in mazes."""
+ ...
+
+ @property
+ def Hay(self):
+ """Obtained by cutting grass."""
+ ...
+
+ @property
+ def Power(self):
+ """Obtained by harvesting sunflowers. The drone automatically uses this to move twice as fast."""
+ ...
+
+ @property
+ def Pumpkin(self):
+ """Obtained when harvesting pumpkins."""
+ ...
+
+ @property
+ def Pumpkin_Seed(self):
+ """Used to grow pumpkins by calling `plant(Entities.Pumpkin)` on empty soil."""
+ ...
+
+ @property
+ def Sunflower_Seed(self):
+ """Used to grow sunflowers by calling `plant(Entities.Sunflower)` on empty soil."""
+ ...
+
+ @property
+ def Water_Tank(self):
+ """Used to water the ground by calling `use_item(Items.Water_Tank)`."""
+ ...
+
+ @property
+ def Wood(self):
+ """Obtained from bushes and trees."""
+ ...
+
+ @property
+ def Cactus(self):
+ """Obtained when harvesting sorted cacti."""
+ ...
+
+ @property
+ def Cactus_Seed(self):
+ """Used to grow cacti by calling `plant(Entities.Cactus)` on empty soil."""
+ ...
+
+ @property
+ def Egg(self):
+ """Call `use_item(Items.Egg)` to hatch a majestic dinosaur."""
+ ...
+
+ @property
+ def Bones(self):
+ """The bones of an ancient creature."""
+ ...
+
+
+# -------------------------------------------------------------------------------
+class Entities:
+ @property
+ def Grass(self):
+ """
+ Grows automatically. Harvest it to obtain `Items.Hay`.
+
+ Average seconds to grow: 0.5
+ Grows on: turf or soil
+ """
+ ...
+
+ @property
+ def Bush(self):
+ """
+ A small bush that drops `Items.Wood`.
+
+ Average seconds to grow: 4
+ Grows on: turf or soil
+ """
+ ...
+
+ @property
+ def Tree(self):
+ """
+ Trees drop more wood than bushes. They take longer to grow if other trees grow next to them.
+
+ Average seconds to grow: 7
+ Grows on: turf or soil
+ """
+ ...
+
+ @property
+ def Carrots(self):
+ """
+ Carrots!
+
+ Average seconds to grow: 6
+ Grows on: soil
+ """
+ ...
+
+ @property
+ def Pumpkin(self):
+ """
+ Pumpkins grow together when they are next to other fully grown pumpkins. About 1 in 5 pumpkins dies when it grows up.
+ When you harvest a pumpkin you get `Items.Pumpkin` equal to the number of pumpkins in the mega pumpkin cubed.
+
+ Average seconds to grow: 2
+ Grows on: soil
+ """
+ ...
+
+ @property
+ def Sunflower(self):
+ """
+ Sunflowers collect the power from the sun. Harvesting them will give you `Items.Power` equal to the number of sunflowers in the farm.
+ If you harvest a sunflower that doesn't have the maximum number of petals all the sunflowers will die.
+
+ Average seconds to grow: 5
+ Grows on: soil
+ """
+ ...
+
+ @property
+ def Cactus(self):
+ """
+ Cacti come in 10 different sizes. When harvested, all cacti on the field will be harvested. Only those that are in sorted order will drop `Items.Cactus`.
+
+ Average seconds to grow: 1
+ Grows on: soil
+ """
+ ...
+
+ @property
+ def Hedge(self):
+ """Part of the maze. Grow a maze by fertilizing a fully grown bush."""
+ ...
+
+ @property
+ def Treasure(self):
+ """A treasure that contains gold equal to the side length of the maze in which it is hidden. It can be harvested like a plant."""
+ ...
+
+ @property
+ def Dinosaur(self):
+ """
+ A majestic dinosaur. It moves around randomly but won't move for a while after being measured. Harvesting it harvests all adjacent dinosaurs of the same type and makes them drop `Items.Bones`.
+
+ Average seconds to grow: 0.2
+ Grows on: turf or soil
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+class Grounds:
+ @property
+ def Turf(self):
+ """The default ground. Grass will automatically grow on it."""
+ ...
+
+ @property
+ def Soil(self):
+ """Calling `till()` turns the ground into this. Calling `till()` again changes it back to turf."""
+ ...
+
+
+# -------------------------------------------------------------------------------
+class Unlocks:
+ @property
+ def Trees(self):
+ """
+ Unlock: Unlocks trees.
+ Upgrade: Increases the yield of bushes and trees.
+ """
+ ...
+
+ @property
+ def Speed(self):
+ """Increases the speed of the drone."""
+ ...
+
+ @property
+ def Plant(self):
+ """Unlocks planting."""
+ ...
+
+ @property
+ def Loops(self):
+ """Unlocks a simple while loop."""
+ ...
+
+ @property
+ def Senses(self):
+ """The drone can see what's under it and where it is."""
+ ...
+
+ @property
+ def Expand(self):
+ """
+ Unlock: Expands the farm land and unlocks movement.
+ Upgrade: Expands the farm. This also clears the farm.
+ """
+ ...
+
+ @property
+ def Operators(self):
+ """Arithmetic, comparison and logic operators."""
+ ...
+
+ @property
+ def Pumpkins(self):
+ """
+ Unlock: Pumpkins!
+ Upgrade: Increases the yield of pumpkins and the cost of pumpkin seeds.
+ """
+ ...
+
+ @property
+ def Variables(self):
+ """Assign values to variables."""
+ ...
+
+ @property
+ def Functions(self):
+ """Define your own functions."""
+ ...
+
+ @property
+ def Watering(self):
+ """Water the plants to make them grow faster."""
+ ...
+
+ @property
+ def Carrots(self):
+ """
+ Unlock: Till the soil and plant carrots.
+ Upgrade: Increases the yield of carrots and the cost of carrot seeds.
+ """
+ ...
+
+ @property
+ def Lists(self):
+ """Use lists to store lots of values."""
+ ...
+
+ @property
+ def Costs(self):
+ """Allows access to the cost of things."""
+ ...
+
+ @property
+ def Fertilizer(self):
+ """Reduces the remaining growing time of the plant under the drone by 2 seconds."""
+ ...
+
+ @property
+ def Mazes(self):
+ """
+ Unlock: A maze with a treasure in the middle.
+ Upgrade: Increases the gold in treasure chests.
+ """
+ ...
+
+ @property
+ def Debug(self):
+ """Tools to help with debugging programs."""
+ ...
+
+ @property
+ def Debug_2(self):
+ """Functions to temporarily slow down the execution and make the grid smaller."""
+ ...
+
+ @property
+ def Benchmark():
+ """Functions to help measure performance."""
+ ...
+
+ @property
+ def Grass(self):
+ """Increases the yield of grass."""
+ ...
+
+ @property
+ def Multi_Trade(self):
+ """Trade multiple items at once."""
+ ...
+
+ @property
+ def Auto_Unlock(self):
+ """Automatically unlock things."""
+ ...
+
+ @property
+ def Polyculture(self):
+ """Use companion planting to increase the yield."""
+ ...
+
+ @property
+ def Sunflowers(self):
+ """
+ Unlock: Sunflowers and Power.
+ Upgrade: Increases the power gained from sunflowers.
+ """
+ ...
+
+ @property
+ def Leaderboard(self):
+ """Join the leaderboard for the fastest reset time."""
+ ...
+
+ @property
+ def Dictionaries(self):
+ """Get access to dictionaries and sets."""
+ ...
+
+ @property
+ def Utilities(self):
+ """Unlocks the `min()`, `max()` and `abs()` functions."""
+ ...
+
+ @property
+ def Cactus(self):
+ """
+ Unlock: Cactus!
+ Upgrade: Increases the yield of cactus and the cost of cactus seeds."""
+ ...
+
+ @property
+ def Dinosaurs(self):
+ """
+ Unlock: Majestic ancient creatures.
+ Upgrade: Increases the yield of dinosaurs and the cost of eggs.
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+class North:
+ """
+ The direction north, i.e. up.
+ """
+
+
+# -------------------------------------------------------------------------------
+class East:
+ """
+ The direction east, i.e. right.
+ """
+
+
+# -------------------------------------------------------------------------------
+class South:
+ """
+ The direction south, i.e. down.
+ """
+
+
+# -------------------------------------------------------------------------------
+class West:
+ """
+ The direction west, i.e. left.
+ """
+
+
+# -------------------------------------------------------------------------------
+def harvest() -> bool:
+ """
+ Harvests the entity under the drone.
+ If you harvest an entity that can't be harvested, it will be destroyed.
+
+ returns `True` if an entity was removed, `False` otherwise.
+
+ takes the time of `200` operations to execute if an entity was removed, `1` operation otherwise.
+
+ example usage:
+ ```
+ harvest()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def can_harvest() -> bool:
+ """
+ Used to find out if plants are fully grown.
+
+ returns `True` if there is an entity under the drone that is ready to be harvested, `False` otherwise.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if can_harvest():
+ harvest()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def plant(entity: Entities) -> bool:
+ """
+ Plants the specified `entity` under the drone if it can be planted.
+ Otherwise it just does nothing.
+
+ returns `True` if it succeeded, `False` otherwise.
+
+ takes the time of `200` operations to execute if it succeeded, `1` operation otherwise.
+
+ example usage:
+ ```
+ plant(Entities.Bush)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def move(direction: North | East | South | West) -> bool:
+ """
+ Moves the drone into the specified `direction` by one tile.
+ If the drone moves over the edge of the farm it wraps back to the other side of the farm.
+
+ - `East ` = right
+ - `West ` = left
+ - `North` = up
+ - `South` = down
+
+ returns `True` if the drone has moved, `False` otherwise.
+
+ takes the time of `200` operations to execute if the drone has moved, `1` operation otherwise.
+
+ example usage:
+ ```
+ move(North)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def swap(direction: North | East | South | West) -> bool:
+ """
+ Swaps the entity under the drone with the entity next to the drone in the specified `direction`.
+ - Doesn't work on all entities.
+ - Also works if one (or both) of the entities are `None`.
+
+ returns `True` if it succeeded, `False` otherwise.
+
+ takes the time of `200` operations to execute on success, `1` operation otherwise.
+
+ example usage:
+ ```
+ swap(North)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def till() -> None:
+ """
+ Tills the ground under the drone into soil. If it's already soil it will change the ground back to turf.
+
+ returns `None`
+
+ takes the time of `200` operations to execute.
+
+ example usage:
+ ```
+ till()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_pos_x() -> float:
+ """
+ Gets the current x position of the drone.
+ The x position starts at `0` in the `West` and increases in the `East` direction.
+
+ returns a number representing the current x coordinate of the drone.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ x, y = get_pos_x(), get_pos_y()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_pos_y() -> float:
+ """
+ Gets the current y position of the drone.
+ The y position starts at `0` in the `South` and increases in the `North` direction.
+
+ returns a number representing the current y coordinate of the drone.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ x, y = get_pos_x(), get_pos_y()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_world_size() -> float:
+ """
+ Get the current size of the farm.
+
+ returns the side length of the grid in the north to south direction.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ for i in range(get_world_size()):
+ move(North)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_entity_type() -> Entities | None:
+ """
+ Find out what kind of entity is under the drone.
+
+ returns `None` if the tile is empty, otherwise returns the type of the entity under the drone.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if get_entity_type() == Entities.Grass:
+ harvest()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_ground_type() -> Grounds:
+ """
+ Find out what kind of ground is under the drone.
+
+ returns the type of the ground under the drone.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if get_ground_type() != Grounds.Soil:
+ till()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_time() -> float:
+ """
+ Get the current game time.
+
+ returns the time in seconds since the start of the game.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ start = get_time()
+
+ do_something()
+
+ time_passed = get_time() - start
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_op_count() -> float:
+ """
+ Used to measure the number of operations performed.
+
+ returns the number of operations performed since the start of execution.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ do_something()
+
+ print(get_op_count())
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def trade(item: Items, n: Optional[float] = None) -> bool:
+ """
+ Tries to buy the specified `item`.
+ If the `item` cannot be bought or you don't have the required resources it simply does nothing.
+
+ overloads:
+ `trade(item)`: Buy the `item` once.
+ `trade(item, n)`: If `Unlocks.Multi_Trade` is unlocked, this will buy the `item` `n` times immediately. If you can't afford all `n` items, it won't buy any at all. If `Unlocks.Multi_Trade` is not unlocked, it throws an error.
+
+ returns `True` if it was able to buy the item(s), `False` otherwise.
+
+ takes the time of `200` operations to execute if it succeeded, `1` operation otherwise.
+
+ example usage:
+ ```
+ if num_unlocked(Unlocks.Multi_Trade) > 0:
+ trade(Items.Carrot_Seed, 10)
+ else:
+ for i in range(10):
+ trade(Items.Carrot_Seed)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def use_item(item: Items) -> bool:
+ """
+ Attempts to use the specified `item`. Can only be used with some items including `Items.Water_Tank`, `Items.Fertilizer` and `Items.Egg`.
+
+ returns `True` if an item was used, `False` otherwise.
+
+ takes the time of `200` operations to execute if it succeeded, `1` operation otherwise.
+
+ example usage:
+ ```
+ use_item(Items.Fertilizer)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_water() -> float:
+ """
+ Get the current water level under the drone.
+
+ returns the water level under the drone as a number between `0` and `1`.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if get_water() < 0.5:
+ use_item(Items.Water_Tank)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def do_a_flip() -> None:
+ """
+ Makes the drone do a flip! This action is not affected by speed upgrades.
+
+ returns `None`
+
+ takes 1s to execute.
+
+ example usage:
+ ```
+ while True:
+ do_a_flip()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def print(*something: Any) -> None:
+ """
+ Prints `something` into the air above the drone using smoke. This action is not affected by speed upgrades.
+ Multiple values can be printed at once.
+
+ returns `None`
+
+ takes 1s to execute.
+
+ example usage:
+ ```
+ print('ground:', get_ground_type())
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def set_execution_speed(speed: float) -> None:
+ """
+ Limits the speed at which the program is executed to better see what's happening.
+
+ - A `speed` of `1` is the speed the drone has without any speed upgrades.
+ - A `speed` of `10` makes the code execute `10` times faster and corresponds to the speed of the drone after `9` speed upgrades.
+ - A `speed` of `0.5` makes the code execute at half of the speed without speed upgrades. This can be useful to see what the code is doing.
+
+ If `speed` is faster than the execution can currently go it will just go at max speed.
+
+ If `speed` is `0` or negative, the speed is changed back to max speed.
+ The effect will also stop when the execution stops.
+
+ returns `None`
+
+ takes the time of `200` operations to execute.
+
+ example usage:
+ ```
+ set_execution_speed(1)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def set_farm_size(size: float) -> None:
+ """
+ Limits the size of the farm to better see what's happening.
+ Also clears the farm and resets the drone position.
+ - Sets the farm to a `size` x `size` grid.
+ - The smallest `size` possible is `3`.
+ - A `size` smaller than `3` will change the grid back to its full size.
+ - The effect will also stop when the execution stops.
+
+ returns `None`
+
+ takes the time of `200` operations to execute.
+
+ example usage:
+ ```
+ set_farm_size(5)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def num_items(item: Items) -> float:
+ """
+ Find out how much of `item` you currently have.
+
+ returns the number of `item` currently in your inventory.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if num_items(Items.Fertilizer) == 0:
+ trade(Items.Fertilizer)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_cost(thing: Entities | Items | Unlocks) -> dict[Items, float] | None:
+ """
+ Gets the cost of a `thing`
+
+ If `thing` is an item: get the cost of buying it when using `trade(item)`.
+ If `thing` is an entity: get the seed needed to plant it.
+ If `thing` is an unlock: get the cost of unlocking it.
+
+ - returns a dictionary with items as keys and numbers as values. Each item is mapped to how much of it is needed.
+ - returns `None` when used on an upgradeable unlock that is already at the max level.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ cost = get_cost(Unlocks.Carrots)
+ for item in cost:
+ if num_items(item) < cost[item]:
+ print('not enough items to unlock carrots')
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def clear() -> None:
+ """
+ Removes everything from the farm, and moves the drone back to position `(0,0)`.
+
+ returns `None`
+
+ takes the time of `200` operations to execute.
+
+ example usage:
+ ```
+ clear()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def get_companion() -> list[Entities, float, float] | None:
+ """
+ Get the companion preference of the plant under the drone.
+
+ returns a list of the form `[companion_type, companion_x_position, companion_y_position]`
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ companion = get_companion()
+ if companion != None:
+ print(companion)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def unlock(unlock: Unlocks) -> bool:
+ """
+ Has exactly the same effect as clicking the button corresponding to `unlock` in the research tree.
+
+ returns `True` if the unlock was successful, `False` otherwise.
+
+ takes the time of `200` operations to execute if it succeeded, `1` operation otherwise.
+
+ example usage:
+ ```
+ unlock(Unlocks.Carrots)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def num_unlocked(thing: Unlocks | Entities | Grounds | Items) -> float:
+ """
+ Used to check if an unlock, entity, ground or item is already unlocked.
+
+ returns `1` plus the number of times `thing` has been upgraded if `thing` is upgradable. Otherwise returns `1` if `thing` is unlocked, `0` otherwise.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ if num_unlocked(Unlocks.Multi_Trade) > 0:
+ trade(Items.Carrot_Seed, 10)
+ else:
+ for i in range(10):
+ trade(Items.Carrot_Seed)
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def measure(direction: Optional[North | East | South | West] = None) -> float | None:
+ """
+ Can measure some values on some entities. The effect of this depends on the entity.
+
+ overloads:
+ `measure()`: measures the entity under the drone.
+ `measure(direction)`: measures the neighboring entity in the `direction` of the drone.
+
+ Sunflower: returns the number of petals.
+ Treasure: returns the next position.
+ Cactus: returns the size.
+ Dinosaur: returns the number corresponding to the type.
+ All other entities: returns `None`.
+
+ takes the time of `1` operation to execute.
+
+ example usage:
+ ```
+ num_petals = measure()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def timed_reset() -> None:
+ """
+ Starts a timed run for the leaderboard. Saves the game before the run and then loads that save afterwards so you can't gain any items during the run.
+
+ returns `None`
+
+ takes the time of `200` operations to execute.
+
+ example usage:
+ ```
+ timed_reset()
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def quick_print(*something: Any) -> None:
+ """
+ Prints a value just like `print()` but it doesn't stop to write it into the air so it can only be found on the output page.
+
+ returns `None`
+
+ takes the time of `1` operations to execute.
+
+ example usage:
+ ```
+ quick_print('hi mom')
+ ```
+ """
+ ...
+
+
+# -------------------------------------------------------------------------------
+def random() -> float:
+ """
+ Samples a random number between 0 (inclusive) and 1 (exclusive).
+
+ returns the random number.
+
+ takes the time of `1` operations to execute.
+
+ example usage:
+ ```
+ def random_elem(list):
+ index = random() * len(list) // 1
+ return list[index]
+ ```
+ """
+ ...
diff --git a/save.json b/save.json
new file mode 100644
index 0000000..f73b016
--- /dev/null
+++ b/save.json
@@ -0,0 +1 @@
+{"items":{"serializeList":[{"name":"wood","nr":208818.0},{"name":"hay","nr":42146.0},{"name":"carrot","nr":22748.0},{"name":"pumpkin_seed","nr":272.0},{"name":"cactus","nr":74.0},{"name":"water_tank","nr":1407.0},{"name":"pumpkin","nr":85996.0},{"name":"sunflower_seed","nr":99.0},{"name":"gold","nr":14625.0},{"name":"carrot_seed","nr":100.0},{"name":"power","nr":10364.728347440716},{"name":"fertilizer","nr":314.0},{"name":"cactus_seed","nr":100.0},{"name":"empty_tank","nr":697.0},{"name":"bones","nr":559.0}]},"dockedFiles":[{"key":"Polyculture","value":"Sunflowers"}],"minimizedFiles":[],"openFilePositions":[{"key":"Generics","value":{"x":3310.22509765625,"y":810.1182861328125}},{"key":"Main","value":{"x":-2144.68115234375,"y":1238.615966796875}},{"key":"Maze","value":{"x":1683.6517333984375,"y":482.90380859375}},{"key":"Polyculture","value":{"x":1183.8134765625,"y":-1198.403564453125}},{"key":"Pumpkins","value":{"x":797.839599609375,"y":-221.3121337890625}},{"key":"Sunflowers","value":{"x":-893.687255859375,"y":-355.6046142578125}},{"key":"Dinosaur","value":{"x":-269.45458984375,"y":16.845458984375}},{"key":"docs2","value":{"x":1402.5185546875,"y":885.140380859375}},{"key":"docs0","value":{"x":-635.0411376953125,"y":751.6536865234375}},{"key":"Cactus","value":{"x":-497.6485595703125,"y":-135.11962890625}}],"openFileSizes":[{"key":"Generics","value":{"x":1139.496337890625,"y":3358.15625}},{"key":"Main","value":{"x":500.0,"y":239.07693481445313}},{"key":"Maze","value":{"x":1165.1561279296875,"y":1040.307373046875}},{"key":"Polyculture","value":{"x":905.2774658203125,"y":925.8458862304688}},{"key":"Pumpkins","value":{"x":1262.934326171875,"y":1383.6915283203125}},{"key":"Sunflowers","value":{"x":1508.768798828125,"y":1469.53759765625}},{"key":"Dinosaur","value":{"x":513.1248779296875,"y":267.6922912597656}},{"key":"docs2","value":{"x":900.0,"y":700.0}},{"key":"docs0","value":{"x":900.0,"y":700.0}},{"key":"Cactus","value":{"x":684.7567138671875,"y":925.8458862304688}}],"openDocPages":[{"key":"docs2","value":"docs/output.md"},{"key":"docs0","value":"docs/unlocks/dinosaurs.md"}],"unlocks":["grass","soil","harvest","pass","return","do_a_flip","turf","hay","loops","while","true","false","break","continue","functions","speed","can_harvest","if","else","elif","plant","wood","bush","entities","clear","expand","for","move","north","south","east","west","senses","get_entity_type","get_ground_type","grounds","get_pos_x","get_pos_y","none","num_items","items","sunflowers","range","get_world_size","operators","and","or","not","carrots","expand_9","carrot","till","can_trade","trade","carrot_seed","variables","assignments","trees","def","polyculture","watering","tree","mazes","debug","print","quick_print","unlocks","pumpkins","pumpkins_10","pumpkin","pumpkin_seed","trees_12","empty_tank","water_tank","use_item","get_water","multi_trade","dictionaries","sunflowers_5","sunflower_seed","sunflower","power","get_active_power","measure","lists","append","remove","pop","insert","len","list","grass_10","get_companion","fertilizer","utilities","min","max","abs","random","carrots_12","auto_unlock","hedge","treasure","gold","dicts","sets","add","dict","set","costs","get_cost","mazes_5","unlock","num_unlocked","benchmark","get_time","get_op_count","debug_2","set_execution_speed","set_farm_size","cactus","dinosaurs","swap","cactus_seed","cactus_2","dinosaurs_1","dinosaur","egg","bones","speed_20"],"grounds":[{"pos":{"x":0,"y":0},"data":"type = soil,water = 0.809482801536844"},{"pos":{"x":0,"y":1},"data":"type = soil,water = 0.817906937597231"},{"pos":{"x":0,"y":2},"data":"type = soil,water = 0.823832296901185"},{"pos":{"x":9,"y":9},"data":"type = soil,water = 0.849376573573664"},{"pos":{"x":9,"y":8},"data":"type = soil,water = 0.849376573573664"},{"pos":{"x":9,"y":7},"data":"type = soil,water = 0.849376573573664"},{"pos":{"x":9,"y":6},"data":"type = soil,water = 0.840882807837928"},{"pos":{"x":9,"y":5},"data":"type = soil,water = 0.770043145805155"},{"pos":{"x":1,"y":0},"data":"type = soil,water = 0.826168623835587"},{"pos":{"x":1,"y":1},"data":"type = soil,water = 0.823832296901185"},{"pos":{"x":1,"y":2},"data":"type = soil,water = 0.832153835253722"},{"pos":{"x":9,"y":4},"data":"type = soil,water = 0.849376573573664"},{"pos":{"x":9,"y":3},"data":"type = soil,water = 0.840882807837928"},{"pos":{"x":9,"y":2},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":9,"y":1},"data":"type = soil,water = 0.834689941938839"},{"pos":{"x":9,"y":0},"data":"type = soil,water = 0.851750447612198"},{"pos":{"x":2,"y":0},"data":"type = soil,water = 0.842943193383927"},{"pos":{"x":2,"y":1},"data":"type = soil,water = 0.732303369654397"},{"pos":{"x":2,"y":2},"data":"type = soil,water = 0.832153835253722"},{"pos":{"x":8,"y":9},"data":"type = soil,water = 0.770043145805155"},{"pos":{"x":8,"y":8},"data":"type = soil,water = 0.82634304251945"},{"pos":{"x":8,"y":7},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":8,"y":6},"data":"type = soil,water = 0.836994416262213"},{"pos":{"x":8,"y":5},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":8,"y":4},"data":"type = soil,water = 0.834800613704716"},{"pos":{"x":8,"y":3},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":8,"y":2},"data":"type = soil,water = 0.770043145805155"},{"pos":{"x":8,"y":1},"data":"type = soil,water = 0.832473979759548"},{"pos":{"x":8,"y":0},"data":"type = soil,water = 0.839210378441503"},{"pos":{"x":7,"y":9},"data":"type = soil,water = 0.840882807837928"},{"pos":{"x":7,"y":8},"data":"type = soil,water = 0.82634304251945"},{"pos":{"x":7,"y":7},"data":"type = soil,water = 0.835338711159753"},{"pos":{"x":7,"y":6},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":7,"y":5},"data":"type = soil,water = 0.834689941938839"},{"pos":{"x":7,"y":4},"data":"type = soil,water = 0.762342714347104"},{"pos":{"x":7,"y":3},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":7,"y":2},"data":"type = soil,water = 0.868482884118144"},{"pos":{"x":7,"y":1},"data":"type = soil,water = 0.828624472099591"},{"pos":{"x":7,"y":0},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":6,"y":9},"data":"type = soil,water = 0.822510091910518"},{"pos":{"x":6,"y":8},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":6,"y":7},"data":"type = soil,water = 0.82634304251945"},{"pos":{"x":6,"y":6},"data":"type = soil,water = 0.836994416262213"},{"pos":{"x":6,"y":5},"data":"type = soil,water = 0.828624472099591"},{"pos":{"x":6,"y":4},"data":"type = soil,water = 0.824149239961953"},{"pos":{"x":6,"y":3},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":6,"y":2},"data":"type = soil,water = 0.824149239961953"},{"pos":{"x":6,"y":1},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":6,"y":0},"data":"type = soil,water = 0.860058354641288"},{"pos":{"x":5,"y":9},"data":"type = soil,water = 0.832473979759548"},{"pos":{"x":5,"y":8},"data":"type = soil,water = 0.80774867008671"},{"pos":{"x":5,"y":7},"data":"type = soil,water = 0.824149239961953"},{"pos":{"x":5,"y":6},"data":"type = soil,water = 0.814284990991412"},{"pos":{"x":5,"y":5},"data":"type = soil,water = 0.747172094331596"},{"pos":{"x":5,"y":4},"data":"type = soil,water = 0.814284990991412"},{"pos":{"x":5,"y":3},"data":"type = soil,water = 0.747172094331596"},{"pos":{"x":5,"y":2},"data":"type = soil,water = 0.754719287203632"},{"pos":{"x":5,"y":1},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":5,"y":0},"data":"type = soil,water = 0.851457771094875"},{"pos":{"x":4,"y":9},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":4,"y":8},"data":"type = soil,water = 0.860058354641288"},{"pos":{"x":4,"y":7},"data":"type = soil,water = 0.84904992883759"},{"pos":{"x":4,"y":6},"data":"type = soil,water = 0.806142141081498"},{"pos":{"x":4,"y":5},"data":"type = soil,water = 0.820338227378595"},{"pos":{"x":4,"y":4},"data":"type = soil,water = 0.818188081491992"},{"pos":{"x":4,"y":3},"data":"type = soil,water = 0.851457771094875"},{"pos":{"x":4,"y":2},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":4,"y":1},"data":"type = soil,water = 0.806142141081498"},{"pos":{"x":4,"y":0},"data":"type = soil,water = 0.80774867008671"},{"pos":{"x":3,"y":9},"data":"type = soil,water = 0.851457771094875"},{"pos":{"x":3,"y":8},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":3,"y":7},"data":"type = soil,water = 0.732303369654397"},{"pos":{"x":3,"y":6},"data":"type = soil,water = 0.851457771094875"},{"pos":{"x":3,"y":5},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":3,"y":4},"data":"type = soil,water = 0.84904992883759"},{"pos":{"x":3,"y":3},"data":"type = soil,water = 0.851457771094875"},{"pos":{"x":3,"y":2},"data":"type = soil,water = 0.811452878209032"},{"pos":{"x":3,"y":1},"data":"type = soil,water = 0.842943193383927"},{"pos":{"x":3,"y":0},"data":"type = soil,water = 0.840559429549214"},{"pos":{"x":2,"y":9},"data":"type = soil,water = 0.840559429549214"},{"pos":{"x":2,"y":8},"data":"type = soil,water = 0.798080719670683"},{"pos":{"x":2,"y":7},"data":"type = soil,water = 0.842943193383927"},{"pos":{"x":2,"y":6},"data":"type = soil,water = 0.73970037338828"},{"pos":{"x":2,"y":5},"data":"type = soil,water = 0.732303369654397"},{"pos":{"x":2,"y":4},"data":"type = soil,water = 0.834513761450087"},{"pos":{"x":2,"y":3},"data":"type = soil,water = 0.832153835253722"},{"pos":{"x":1,"y":9},"data":"type = soil,water = 0.795973361687223"},{"pos":{"x":1,"y":8},"data":"type = soil,water = 0.82591858130481"},{"pos":{"x":1,"y":7},"data":"type = soil,water = 0.840559429549214"},{"pos":{"x":1,"y":6},"data":"type = soil,water = 0.834261193237182"},{"pos":{"x":1,"y":5},"data":"type = soil,water = 0.834513761450087"},{"pos":{"x":1,"y":4},"data":"type = soil,water = 0.832153835253722"},{"pos":{"x":1,"y":3},"data":"type = soil,water = 0.823832296901185"},{"pos":{"x":0,"y":9},"data":"type = soil,water = 0.826168623835587"},{"pos":{"x":0,"y":8},"data":"type = soil,water = 0.834513761450087"},{"pos":{"x":0,"y":7},"data":"type = soil,water = 0.815593973932173"},{"pos":{"x":0,"y":6},"data":"type = soil,water = 0.834513761450087"},{"pos":{"x":0,"y":5},"data":"type = soil,water = 0.823832296901185"},{"pos":{"x":0,"y":4},"data":"type = soil,water = 0.823832296901185"},{"pos":{"x":0,"y":3},"data":"type = soil,water = 0.724980335957853"}],"entities":[]}
\ No newline at end of file