snake

所属分类:游戏机
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2022-06-21 22:32:05
上 传 者sh-1993
说明:  人类可以玩的蛇,具有遗传机器学习部分,可以学习玩游戏。,
(Snake that will be playable by humans and have a genetic machine learning part that will learn to play the game.,)

文件列表:
.idea/ (0, 2021-03-12)
.idea/inspectionProfiles/ (0, 2021-03-12)
.idea/inspectionProfiles/profiles_settings.xml (174, 2021-03-12)
.idea/misc.xml (193, 2021-03-12)
.idea/modules.xml (262, 2021-03-12)
.idea/other.xml (186, 2021-03-12)
.idea/snake.iml (352, 2021-03-12)
.idea/vcs.xml (180, 2021-03-12)
.vscode/ (0, 2021-03-12)
.vscode/launch.json (463, 2021-03-12)
.vscode/settings.json (55, 2021-03-12)
custom_network.py (2486, 2021-03-12)
display.py (2912, 2021-03-12)
game_state.py (9170, 2021-03-12)
genetics.py (12795, 2021-03-12)
graphs/ (0, 2021-03-12)
graphs/graph0.png (32596, 2021-03-12)
graphs/graph1.png (45188, 2021-03-12)
graphs/graph2.png (16942, 2021-03-12)
graphs/graph3.png (41279, 2021-03-12)
main.py (5504, 2021-03-12)
net.py (325, 2021-03-12)
node.py (1350, 2021-03-12)
notes.md (2065, 2021-03-12)
requirements.txt (96, 2021-03-12)
runs/ (0, 2021-03-12)
runs/run.txt (1, 2021-03-12)
settings.py (33, 2021-03-12)
snake.py (3432, 2021-03-12)
style.css (254, 2021-03-12)

# Snake Machine Learning ![snake](https://user-images.githubusercontent.com/3957023/63204709-afcb9f80-c068-11e9-99f2-9b570e2e733c.png) To Start, first run `python -m pip install -r './requirements.txt'` To get all the requirements. (Note: This program right now only works in python version 3.6, not 3.7) To play Snake: - Go to the legacy branch to play the game yourself To run the genetic program: - Make sure that the start method in snake.py is commented out - Run the main.py file - You can change the parameters in the UI that launches - `selection_rate`: the percentage of the population that will be used to breed the next generation (default = 0.1) - `mutation_rate`: the percentage that any gene (parameter) in a child will be mutated to a random value (default = 0.01) - `population_size`: the number of individuals that will be bred in each generation (default = 100) - `random_weight_range`: the range of the weights that are generated for the initial population (default = 1.0) - `max_generations`: the number of generations that the program will run through (default = 100) - `show_graphics`: if true, you will see every individual run through and play the game until it dies, if false you won't see anything and it will just create the final model (default = True) - `games_to_show`: the number of games to show at a time (default = 25) - `grid_count`: the number of grids in the actual snake games (default = 30) - `grid_size`: the size of each square in the snake game grids (default = 5) - `save_population`: if true, the program will save the last generation, so you can re-run the program (default = False) - `save_best`: if true the program will save the best individual from each generation (default = False) - `save_graph`: if true the graph will be saved as a png (default = True) Resources Used: - Article on doing something similar with a different game - Graphics Library (only for game) - Neural Network library - Source for looking at an example of the genetic algorithms - New Gui Library (Not for the game for now)

近期下载者

相关文件


收藏者