From 4ffbd5a1fde2538139d2e05e3f889f900c93b786 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Wed, 26 Nov 2025 16:48:30 +0000 Subject: [PATCH] Add README.md --- README.en.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..a25b469 --- /dev/null +++ b/README.en.md @@ -0,0 +1,80 @@ +# Programming Farm Game + +This is a Python-based farm game project designed to control various in-game operations through programming, such as planting, harvesting, and movement. The project provides a rich set of built-in functions and utility tools to help players navigate the game more effectively. + +## Project Structure + +- `__builtins__.py`: Defines various classes and functions for the game, including items, entities, ground types, unlocks, and more. +- `tools.py`: Provides utility functions for performing specific in-game actions. +- `main.py`: The main program file for the game. +- `save.json`: File for saving game data. +- `.prettierignore`, `.prettierrc`, `.vscode/settings.json`: Configuration files related to code formatting and editor settings. + +## Main Features + +### Class Definitions + +- `Item`, `Items`: Represent in-game items and their collections. +- `Hat`, `Hats`: Represent hats and their collections. +- `Leaderboard`, `Leaderboards`: Represent leaderboards and their collections. +- `Entity`, `Entities`: Represent entities and their collections. +- `Ground`, `Grounds`: Represent ground types and their collections. +- `Unlock`, `Unlocks`: Represent unlock features and their collections. +- `Direction`: Represents directional movement. + +### Core Functions + +- `harvest()`, `can_harvest()`: Harvest crops from the current tile. +- `plant(entity: Entity)`: Plant the specified entity on the current tile. +- `move(direction: Direction)`, `can_move(direction: Direction)`: Move to the tile in the specified direction. +- `swap(direction: Direction)`: Swap positions with the tile in the specified direction. +- `till()`: Till the current tile. +- `get_pos_x()`, `get_pos_y()`: Get the coordinates of the current tile. +- `get_world_size()`: Get the size of the world. +- `get_entity_type()`: Get the entity type on the current tile. +- `get_ground_type()`: Get the ground type of the current tile. +- `get_time()`, `get_tick_count()`: Get the current time and game tick count. +- `use_item(item: Item, n: 1)`: Use a specified quantity of an item. +- `get_water()`: Get the current water level. +- `do_a_flip()`, `pet_the_piggy()`: Special actions. +- `print(*something)`: Print information. +- `set_execution_speed(speed)`: Set execution speed. +- `set_world_size(size)`: Set world size. +- `num_items(item)`: Get the quantity of a specified item. +- `get_cost(thing, level)`: Get the cost to unlock or purchase something. +- `clear()`: Clear the content of the current tile. +- `get_companion()`: Get companion information. +- `unlock(unlock)`: Unlock a specified feature. +- `num_unlocked(thing)`: Get the number of unlocked items. +- `measure(direction)`: Measure the distance in the specified direction. +- `leaderboard_run(leaderboard, file_name, speedup)`: Run a leaderboard script. +- `simulate(...)`: Simulate game execution. +- `quick_print(*something)`: Quickly print information. +- `random()`: Generate a random number. +- `len(obj)`, `range(start, stop, step)`, `str(obj)`, `min(*args)`, `max(*args)`, `abs(x)`: Common built-in functions. +- `change_hat(hat)`: Change the equipped hat. +- `spawn_drone(function)`, `wait_for(drone)`, `has_finished(drone)`, `max_drones()`, `num_drones()`: Drone-related operations. + +## Utility Functions + +- `do_hay()`: Harvest hay. +- `do_tree()`: Plant trees. +- `do_bush()`: Plant bushes. +- `do_pumpkin()`: Plant pumpkins. +- `fix_pumpkin()`: Repair pumpkins. +- `do_carrot()`: Plant carrots. + +## Usage + +1. Ensure Python environment is installed. +2. Clone the repository to your local machine. +3. Run `main.py` to start the game. +4. Use the provided functions and tools to interact with the game. + +## Contributing + +Pull requests and issues are welcome to help improve this project. + +## License + +This project is licensed under the MIT License. See the LICENSE file in the repository for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe26923 --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +# 编程农场游戏 + +这是一个基于 Python 的农场游戏项目,旨在通过编程控制游戏中的各种操作,如种植、收获、移动等。项目提供了丰富的内置函数和工具函数,帮助玩家更好地进行游戏。 + +## 项目结构 + +- `__builtins__.py`: 定义了游戏中的各种类和函数,包括物品、实体、地面、解锁等功能。 +- `tools.py`: 提供了一些工具函数,用于执行特定的游戏操作。 +- `main.py`: 游戏的主程序文件。 +- `save.json`: 保存游戏数据的文件。 +- `.prettierignore`, `.prettierrc`, `.vscode/settings.json`: 与代码格式化和编辑器设置相关的配置文件。 + +## 主要功能 + +### 类定义 + +- `Item`, `Items`: 表示游戏中的物品及其集合。 +- `Hat`, `Hats`: 表示帽子及其集合。 +- `Leaderboard`, `Leaderboards`: 表示排行榜及其集合。 +- `Entity`, `Entities`: 表示实体及其集合。 +- `Ground`, `Grounds`: 表示地面类型及其集合。 +- `Unlock`, `Unlocks`: 表示解锁功能及其集合。 +- `Direction`: 表示方向。 + +### 核心函数 + +- `harvest()`, `can_harvest()`: 收割当前地块的作物。 +- `plant(entity: Entity)`: 在当前地块种植指定的实体。 +- `move(direction: Direction)`, `can_move(direction: Direction)`: 移动到指定方向的地块。 +- `swap(direction: Direction)`: 与指定方向的地块交换位置。 +- `till()`: 翻耕当前地块。 +- `get_pos_x()`, `get_pos_y()`: 获取当前地块的坐标。 +- `get_world_size()`: 获取世界大小。 +- `get_entity_type()`: 获取当前地块的实体类型。 +- `get_ground_type()`: 获取当前地块的地面类型。 +- `get_time()`, `get_tick_count()`: 获取当前时间和游戏 ticks 数。 +- `use_item(item: Item, n: 1)`: 使用指定数量的物品。 +- `get_water()`: 获取当前水分。 +- `do_a_flip()`, `pet_the_piggy()`: 特殊动作。 +- `print(*something)`: 打印信息。 +- `set_execution_speed(speed)`: 设置执行速度。 +- `set_world_size(size)`: 设置世界大小。 +- `num_items(item)`: 获取指定物品的数量。 +- `get_cost(thing, level)`: 获取解锁或购买某物的成本。 +- `clear()`: 清除当前地块的内容。 +- `get_companion()`: 获取同伴信息。 +- `unlock(unlock)`: 解锁指定功能。 +- `num_unlocked(thing)`: 获取已解锁的数量。 +- `measure(direction)`: 测量指定方向的距离。 +- `leaderboard_run(leaderboard, file_name, speedup)`: 运行排行榜脚本。 +- `simulate(...)`: 模拟游戏运行。 +- `quick_print(*something)`: 快速打印信息。 +- `random()`: 生成随机数。 +- `len(obj)`, `range(start, stop, step)`, `str(obj)`, `min(*args)`, `max(*args)`, `abs(x)`: 常用内置函数。 +- `change_hat(hat)`: 更换帽子。 +- `spawn_drone(function)`, `wait_for(drone)`, `has_finished(drone)`, `max_drones()`, `num_drones()`: 无人机相关操作。 + +## 工具函数 + +- `do_hay()`: 收割草。 +- `do_tree()`: 种植树木。 +- `do_bush()`: 种植灌木。 +- `do_pumpkin()`: 种植南瓜。 +- `fix_pumpkin()`: 修复南瓜。 +- `do_carrot()`: 种植胡萝卜。 + +## 使用方法 + +1. 确保已安装 Python 环境。 +2. 克隆仓库到本地。 +3. 运行 `main.py` 启动游戏。 +4. 使用提供的函数和工具进行游戏操作。 + +## 贡献 + +欢迎提交 Pull Request 和 Issue 来帮助改进本项目。 + +## 许可证 + +本项目遵循 MIT 许可证。详情请查看仓库中的 LICENSE 文件。 \ No newline at end of file -- Gitee