4-player snake with AI
by kiveon
~VANILLA~ 16,523 logic gates Just hop in a seat and start playing with WASD. When you get out of the seat, the AI will take control. So every snake can be either player or AI controlled. controls WASD: control snake 1: spawn your snake 2: spawn all snakes . . . fun technical facts - the AI is very simple, it just goes towards the fruit and avoids walls directly in front and next to it's head - the screen is 20x20 pixels and every pixel is 2x2 with RGB colors - the snakes move at 1.25 Hz so every 0.8 seconds - this build is very close to being too big for the lift to spawn, just 4 extra wires would be too much - the AI controller, head coordinate demux, screen logic and fruit coordinate comparators are all pipelined, meaning that all the snakes use the same logic for those functions, but in turns - there's a couple bugs that I couldn't fix anymore due to lift spawn limit, like head on collisions being survivable and snakes getting infinite length sometimes - the AI snakes can only see 1 pixel next to their head so they only avoid obstacles right next to them, this also makes them very prone to head on collisions because 2 snakes can move to the same pixel without seeing each other... fortunately they can survive it ;) - tho there's 2 fruits, the AI snakes only go after one of them, blue and pink snakes go for the same one, and red and yellow go for the other - fruits can't spawn inside snakes, well they actually can but just try again if that happens, that is why sometimes the fruit has to spawn multiple times before they find a spot - every snake has a unique sound when turning, when they all turn they make a nice melody of E B c# A
Comments
0 total- No comments yet. Be first.
