Based on Griffpatch https://www.youtube.com/playlist?list=PLy4zsTUHwGJIqB6hg-sOxiwsJn7UfuCLw Mostly I just changed things like variable names to make the game operation more explicit