1. The Farmer Was Replaced
  2. News

The Farmer Was Replaced News

Small Update

-`from file import *` no longer imports variable names starting with an underscore.
-All import statements are now free (take 0 ticks).
-Added a special error message if a function is used before it's defined.
-Added a special error message when importing filenames with invalid characters.

Import Cost Changes

This update fixes some issues with the number of simulation ticks spent on imports.
-`from file import` now costs 1 tick.
-`import file` is still free.
-Reading from a module like `y = file.x` is now free as long as the variable `file` has been assigned by an import statement. This is analogous to functions being free as long as they have been directly assigned by a def statement, and prevents exploits that abuse the dynamic nature of modules to do completely free computations.
-Writing to modules like `file.x = y` now costs the same as reading from them.
-`def` and `import` statements inside an `if`, `while` or `for` block no longer make the functions/modules they create free, because this could also be used to do free computations.

-Fixed importing into local scope.

Imports And Global Variables

Breaking Changes:
You'll have to change these in your code.

Functions defined in other files (windows in the game) are no longer imported implicitly. You now have to unlock and use explicit import statements like in Python (See the import unlock).

Breaking Changes from older Patches that you might have missed:
-`Items.Bones` has been renamed to `Items.Bone` so all items are singular.
-`Entities.Carrots` has been renamed to `Entities.Carrot` so all entities are singular.
-`Grounds.Turf` has been renamed to `Grounds.Grassland` to make it easier to understand.
-`Items.Water_Tank` has been renamed to `Items.Water` because the tank refill feature has been removed.
-`Unlocks.Benchmark` has been replaced with `Unlocks.Timing`.
-`get_op_count()` has been renamed to `get_tick_count()`.
-`set_farm_size()` has been renamed to `set_world_size()` to be consistent with `get_world_size()`.
-`get_companion()` now returns a tuple of the form (entity, (x, y)) instead of a list.
-`trade()` has been removed from the game.

Global Variabels:
-Scopes and global variable have been changed to work like in Python. This means you can now use the `global` keyword to write to the global scope.
-There is now an error for using a local variable before it was assigned locally even if there is a global variable with the same name.
-The shadowing error messages have been removed.

Imports:
The old import system automatically imported all functions from all files. This had the big disadvantage that global variables from other files could not be imported and were therefore inaccessible.
The new import system is a slightly simplified version of how imports work in Python. You can import a module using the `import file` or `from file import *` syntax.

Other Changes:
-Added `str()` function.
-Added destructuring support in for loops.
-Various docs changes.
-Fixed passing functions into simulations.
-Fixed using `in` and `not in` with functions.
-Fixed set function allowing lists as keys.

Documentation fix

-Added more crosslinks between docs pages.
-Fixed the messed up expand page.

Fixes

-Fixed Expand_2 page missing in the table of contents and added a link from Expand_1.
-Polyculture now actually starts at 5x like documented.
-Fixed the displayed plant cost in entity tooltips.
-Using a negative number of items now throws an error instead of giving you items.
-Division by 0 now throws an error instead of returning NaN.
-Fixed the invalid key error message of `set.add()`.
-Indexing dicts with empty tuples is no longer free.
-Fixed leaderboard UI blocking mouse clicks.
-Resolved the issues that sometimes caused an older version of the code to execute.
-Fixed a bug preventing the drone to move onto the end of the dinosaur tail one move after picking up an apple.
-Fixed a bug that caused window sizes to stop snapping to the code after moving the window.