King of rock paper scissors
- 8 Devlogs
- 17 Total hours
Machine learning algorithm that learns in real time based on the games you play with it.
Machine learning algorithm that learns in real time based on the games you play with it.
This will probably be my last devlog before the ship. I have overhauled the manager to include feature engineering, which should help the model make connections much faster. It now receives choice shifts, match outcomes and overall move frequencies instead of just the history of past rounds. Changed the algorithm to predict the user’s next move instead of the counter. This makes it easier to understand how it was thinking that you would act. It still returns the counter to the player move tho. Also changed back from the probability weighted selection method to the epsilon greedy strategy (highest probability move is chosen 90% of the time and 10% is random). The only thing left is to tweak all the values until I am satisfied with the result and then off it goes into the sea.
Completely overhauled the UI and I think it looks much better now. The bot has taunts now, but performance is marginal at best right now. Taking all the different strategies I’ve tried to make the bot better and consolidating them to find the best possible parameters for it will be the next and probably final problem the project will face before shipping. Might try the round robbin style face offs with different parametered bots facing each other. Overall it’s been a very interesting journey learning about all these concepts in machine learning.
So I did a lot of digging to find out how to improve the model and found some interesting stuff, but the main problem was that i was telling the model that the target move was a draw (immitating the player’s move) instead of beating them -_-. Also the idea of the round robbin to find the best bot parametersalso fell out because the models just trained to draw each other, but it took forever to execute so I don’t know if I should maybe retry it. There is still the very valid concern that the best bot would be the one that’s the best against other bots and not players so. On a more positive note, I introduced momentum. It keeps a running memory of the past updates, like a rolling bolder that builds speed. This enables it to recongnize patterns much quicker by stacking the past changes together. Caught onto patterns of length 1, 2, 3 and 4 in 1, 4, 12, and 17 moves, respectively. Below is a comparison (100 games of normal human rock paper scissors, not repeating a pattern, or atleast not conciously) vs random ouput (left) and the new bot (right). Glad to see it’s doing better. Will do more research on improving but polishing the game now is a better priority.
So clearly what I said earlier about the algorithm was wrong. I tested it some more and it seems like sometimes it is just reading my mind and other attemps it’s like it’s not even trying. I have fiddled around with the number of games the algorithm sees and it’s learning rate, and every time I think I got it I ask my brother (unbiased third party) to test it where it promptly fails. So, I have devised a plan to find the ultimate round robbin with about 200 different algorithms playing a total of 30 000 000 games of rock paper scissors to find the true champion. Hopefully this will let me find the best learning rate and sample size for the ai, therefore improving it’s game. might take a little while to execute, so we’ll see when that happens. also if there’s anyone who knows more about machine learning, please don’t hesitate to tell me what i could try. Thanks!
Got the basic UI working with a simple animation, just need to transfer the text from the terminal to the app instead. Still have to work on making the algorithm better, as spamming the same move 20 times in a row, the AI was still picking the wrong options sometimes (maybe trying to predict when i would switch it up?). Cool to see everything coming together
Very scary progress, I am barely winning now. All it took was some minor adjustements to the layer sizes, learning rate, and number of games stored, as well as making the output a weighted random choice based on the probabilities given by the algorithm, and changing the input for the bot from just the human inputs to also include the bot inputs. I bet there’s even more to make it better which is even more scary. Very nice to see the progress showing though!
Second deblog working on the machine learning algorithm. I got the backpropagation working after some time, but clearly I have to tweak some things, like the learning rate, game history size, number of neurons per layer, etc. The issue probably also lies beyond that, so more research will have to be done. The algorithm easily gets outsmarted. So for now, humans still reign as rock paper scissors champions!
New project: a machine learning algorithm that plays rock paper scissors against you and learns in real time to predict your next move to beat you. Figured it was a pretty good way to get into machine learning as AI is on the rise, and coding my own will force me to truly understand how it works. I got the forward propagation working, and set everything up for back propagation for the next session. Can’t wait