Commit Graph

191 Commits

Author SHA1 Message Date
daniel156161 5796ce0a6e add function to calculate where the new snake body is with or with no tail based on the move that is taken 2024-04-18 17:14:49 +02:00
daniel156161 5522a52227 set TemplateSnake as default loaded snake 2024-04-18 16:59:28 +02:00
daniel156161 5743f5c111 print moves only if debug is on and better error handeling if running game into found in dict 2024-04-18 08:23:10 +02:00
daniel156161 9950fa1952 create env variable that allow to create a .env file if neaded 2024-04-17 20:09:57 +02:00
daniel156161 4620ee31eb split class name and print out with spaces 2024-04-17 20:09:34 +02:00
daniel156161 9103e3e139 store history into data folder 2024-04-17 19:57:39 +02:00
daniel156161 04eef9229c not store config file just read if exist or overwrite default_snake_config 2024-04-17 19:53:02 +02:00
daniel156161 7cb1fdc57d add sample env config to docker file 2024-04-17 19:29:49 +02:00
daniel156161 cceded8468 add function to overwrite snake config when its set as env and use smaller python alpine container as base 2024-04-17 19:29:18 +02:00
daniel156161 8c57e48f60 if got Key Error in move function create a new snake and calculate next best move 2024-04-17 15:55:37 +02:00
daniel156161 5ce12d70c1 remove pos where other snake head is to not go into a dead end or use the pos where the snake head could be to find new food 2024-04-17 15:17:09 +02:00
daniel156161 950351b407 add code to not get eaten when head is by food 2024-04-17 15:15:25 +02:00
daniel156161 12ac257d19 add option to overwrite color with env param 2024-04-17 13:43:58 +02:00
daniel156161 d4b54d48b9 when both posisions are not save keep them in safe posisions - remove other useless MasterSnake 2024-04-17 13:35:42 +02:00
daniel156161 034b0e361a save direction to kill the snake use the correct kill direction in overwrite_eat_the_other_snake can end in a draw when both heads are by the food 2024-04-17 12:22:54 +02:00
daniel156161 a57536b7cb remove functions that are in the TemplateSnake now and at to do if eating the food would kill the snake 2024-04-17 11:54:24 +02:00
daniel156161 a606ae6f94 add template code for a smart random snake 2024-04-17 11:53:21 +02:00
daniel156161 b364c6454e optimise game type constrictor to fill up most of the game board 2024-04-17 11:15:06 +02:00
daniel156161 b9a0bca4c6 remove not used function is_food_nearby 2024-04-17 10:54:18 +02:00
daniel156161 ea36d60b4d change code to not have a big choose_move function and add todos to try fix some problems in game 2024-04-17 09:33:35 +02:00
daniel156161 0fe4e6ac83 fix a error where self.safe_positions[0] can't be accest 2024-04-17 08:19:32 +02:00
daniel156161 93b2c8ba99 cleanup the code a bit more to use the self params 2024-04-16 21:47:40 +02:00
daniel156161 f6db5cb96a fix error in eat_the_snake_overwrite when more moves are posible 2024-04-16 00:52:18 +02:00
daniel156161 e3d7cccb64 remove my_snake output into server console 2024-04-16 00:35:46 +02:00
daniel156161 0eecbb774b store game turn in history file and add safe_positions output to ensure_escape_route calculation 2024-04-15 23:56:03 +02:00
daniel156161 9e0a919233 fix not used code for flood_fill_count 2024-04-15 23:44:47 +02:00
daniel156161 6d9df32076 add more debug outputs and use all the self.args when neaded in a specific function, make own variable to only store other snakes 2024-04-15 23:16:15 +02:00
daniel156161 863ca1b277 fix calculations and not run in snake tail when in constrictor game mode 2024-04-15 22:20:15 +02:00
daniel156161 16cab3a9ca change code to store safe_positions in class and remove self.directions 2024-04-15 21:56:53 +02:00
daniel156161 281b52e71d remove moving tail of snake when begin moves are done and not calculate own body in avoid_snakes because already avoid own body 2024-04-15 14:51:28 +02:00
daniel156161 38ba576de9 add .env var to set no save when win and turns are less or the same as the var 2024-04-15 03:29:20 +02:00
daniel156161 7457e66339 add in init to not store when win and moves are smaller or the param 2024-04-15 03:17:21 +02:00
daniel156161 b601b378c8 add game url in GameStorage if its not local 2024-04-15 03:06:01 +02:00
daniel156161 24e744f705 remove print in _get_correct_folder_for_save_file because its not neaded 2024-04-15 02:21:36 +02:00
daniel156161 39b16a1702 add function to avoid get eaten by head to head collisons when my snake is smaller else eat the other snake 2024-04-15 02:13:11 +02:00
daniel156161 87fe6550b2 change folder names to add numbers an the beginning of the folder name 2024-04-14 23:56:25 +02:00
daniel156161 c854b5fec9 remove prints and add a note that i neat to fix later 2024-04-14 23:33:11 +02:00
daniel156161 51108ce21c change game storage to save it into a nice folder structure 2024-04-14 23:32:49 +02:00
daniel156161 2f8e35aced create a better Master Snake that try to not hit itself 2024-04-14 21:32:43 +02:00
daniel156161 9869f14bbe Output Turns in server logs when doing moves 2024-04-14 21:32:10 +02:00
daniel156161 1154127a40 change history of GameStorage to calculations and remove snake_start add constrictor test in test_run scripts 2024-04-14 21:31:32 +02:00
daniel156161 ae1489240d use a specific seed 2024-04-14 16:39:28 +02:00
daniel156161 0af6d862d4 create .env file if its not exists 2024-04-14 13:36:59 +02:00
daniel156161 f472ddd0d9 fix error when creating GameStorage object 2024-04-13 12:06:51 +02:00
daniel156161 b48cfe811e add methode to create more snake and use them when more games are running v1.0 2024-04-13 10:48:08 +02:00
daniel156161 22b8746972 store better winning snake and add final turns and not sive where i win and moves are less the 10 turns 2024-04-13 10:03:42 +02:00
daniel156161 615acfc75a store game history into dict to not mix data with other games 2024-04-13 10:02:51 +02:00
daniel156161 9fc0c9f82b add better typeing of knowing what GameBoard it is in GameStorage 2024-04-13 08:34:58 +02:00
daniel156161 b3f9b63df0 Merge pull request 'main (#1)' (#2) from dev into main
Reviewed-on: #2
2024-04-13 03:06:58 +02:00
daniel156161 00a695f838 Merge branch 'main' into dev 2024-04-13 03:05:08 +02:00