You'll notice if you have multiple embedded devices that you wish to control that this pattern of programming will start to cause problems. This particular pattern is known as a "busy wait loop" it will keep the python process completely locked up trying to service the input from that one Arduino device. Depending on your requirements there are various options to deal with this but most approaches will involve some form of concurrency that lets your game keep chugging along while it's servicing the input from various devices (Threading vs asyncio vs other approaches).
You may find a queue useful for these situations whereby commands for incoming devices are placed onto the queue and some central processing occurs to clear these events out of the queue.
https://github.com/JamesDevJim/game-zulu/blob/4b46243499803992d0ef07bb856fb49bb8f72240/test_light_strip.py#L14-L17
You'll notice if you have multiple embedded devices that you wish to control that this pattern of programming will start to cause problems. This particular pattern is known as a "busy wait loop" it will keep the python process completely locked up trying to service the input from that one Arduino device. Depending on your requirements there are various options to deal with this but most approaches will involve some form of concurrency that lets your game keep chugging along while it's servicing the input from various devices (Threading vs asyncio vs other approaches).
You may find a queue useful for these situations whereby commands for incoming devices are placed onto the queue and some central processing occurs to clear these events out of the queue.