Gobblet - a simple 2-player game that's difficult to win! *** This project is Touch Screen friendly *** Click the Green Flag then click (GO) to begin playing Click the ( i ) button any time for full Instructions Click Championship Cup, if visible, to see Leaderboard ** 6 & 11 Jan 22 partial Leaderboard reset. 4 issues! ** @KICK_THE_HABIT, @colinmacc, @CoconutGator ** & I all found easy ways to beat the AI every game. ** So I wrote code to counter them all. ** 11 Dec 23 found new super easy way to beat it ... so stopped it making a certain unnecessary move! ** 15 Dec 23 fixed AI move freeze Bug (last one?) ** 16 Dec 23 Nah, found another, but no fix, yet. ** 17 Dec 23 might've fixed all AI move freezing issues ** 18 Dec 23 fixed AI "failing to take win it had" Bug! ** 19 Dec 23 found another Freeze where AI should have conceded, but didn't, maybe I fixed it, but I won't know until a similar situation occurs again? Also fixed major bug in checking for move legality, when the Game Board is full & it said the player selected piece had no legal move, when it did! ** 20 Dec 23 tried to fix AI "failing to block my win when it could" Bug, unsure if I have yet (hope so)? ** 21 Dec 23 fixed bug where AI tried to move hidden piece, and one where AI tried to move a piece that had no legal move thus freezing. Well I think I did? ** 1 Jan 23 replaced the no longer very useful 8 slot Leaderboard with a proper 40 slot one I built myself Enjoy! Regards Greg NOTE: If you have never played Gobblet before, I would strongly recommend playing a few games against yourself before you take on playing against the AI, because the AI plays a pretty good game and is difficult to defeat. But it is beatable and I am sure some players who are already good at playing Gobblet, will be able to beat it most of the time. *** About the Thumbnail Image *** This win by me was achieved by me 13 Jan 22, against the AI on the current version of the code. It was a hard-fought game with attack & counter attack, block & counter block, over & over. All 24 pieces are on the Board, but half of them have been gobbled. When the AI gobbled my 6th visible piece a few moves prior, I assumed I was doomed with only 5 pieces in play. My 4 in the centre was one slot to the left where it had been since the very first move in the game. My 3 in the centre was one slot to the right covering the AI's 2. The AI had a 2 where my 3 is and it had a 1 where my 4 is in the Thumbnail. I covered his 1 with my 4 to set up 2 potential win lines and at best the AI could only block one of them. In that situation the AI virtually concedes and plays a random legal move. I then slid my 3 across one slot to the left, off one of his 2s onto the other for the win. It seems a most unlikely win on face-value but it was legitimately achieved in a very hard-fought game.
Created by @gregatku for ... well gregatku mainly. Thanks to Thierry Denoual for inventing the game. Thanks to Kids Unlimited for introducing me to it and my brother with whom I played the real game, most nights when he stayed for a week recently, reminding me what a great game it is. So I made it in Scratch. If you enjoy playing this game, I'd recommend buying yourself the real thing for playing against family & friends. You can order it online from "blue Orange" Games, a company founded by the Game's inventor Thierry Denoual. It is a beautifully packaged 2 player wooden Board Game. Thanks to @ONXPro4 for encouraging me to code his Duchess project in 2020, where I learnt heaps about what's required to build a good board Game. And a huge thank you to both @KICK_THE_HABIT & @colinmacc who pointed out to me, with extremely clever (but different) strategies they discovered, that the AI had no chance of beating at all! I also later discovered one of my own. So I have since written code to enable the AI to defend against them all! How the AI plays: - 1. If you give it a winning opportunity, it will take it! - 2. If you set up a next move winning opportunity for yourself, it will do everything in its power to block it, and it is very good at finding blocking moves. Furthermore, it won't make a blocking move that would hand you a winning opportunity anyway. - 3. If neither of 1 or 2 apply, it first checks to see if you have set up a certain win in 2 moves, which it then attempts a defence against it. - 4. After that it tries to mobilise the majority its pieces as quickly as possible, getting the bigger pieces on the Board 1st, where it goes for the 4 Central Slots first, then one of the 4 Corners before the edge Slots, then when the board is almost full, if it can safely do so it tries to make a line of 3 (without a 4-piece of yours in it), but after that it simply picks the first legal move it finds. What all that means is that the AI should be beatable, but be careful because it has a perfect memory of where all the hidden "gobbled" pieces are, which you are unlikely to have yourself. Try to force it into the situation where it "simply picks the first legal move it finds", that's when it makes mistakes and you can win. Now that the AI is playing pretty much as I intended it to, I could try to make it even smarter, but I don’t think I'll bother, because it seems hardly anybody can beat it as it is now, anyway! BUGS: If you discover a bug, I would really appreciate it, if you could tell me about it in the comments so I can fix it. The sorts of things that could easily happen, as they have all already occurred during development, quite a few times, are: 1. AI freezing on its turn as it can't find a legal move. 2. AI making an illegal or theoretically impossible move 3. AI placing a piece in the centre of the board 4. Giving you an incorrect error message when you have made a legal move. This may not be a Bug 5. AI failing to take a win it should have taken 6. AI missing a legal blocking move that gives you a win. Of course, this could be because the only pieces it had that could block, were pinned because moving them would have given you a win anyway. Speaking of Bugs, special thanks to @CoconutGator for finding several of them and giving me enough feedback to enable me to fix them. For the record he used to top the Leaderboard by winning 6 of 7 Games against the AI, but I had to reset it a couple of times, because of bug fixes that made the AI harder to beat. He's back on it now, winning 7 of 7 before losing one. Thanks also to @Codigate10 who found a couple of late bugs that I think I have fixed now. One in particular I am particularly grateful for, especially how truly honourable @Codigate was about it. He found a sneaky cheat's way to get on the Leaderboard, and could easily have pretended it was legitimate, but no, he reported it to me, and asked me to both fix it and restore to the Leaderboard, the person he kicked off it. I think it is quite possibly the best Scratch Project I have created so far. It was certainly the most difficult for me to code and debug. The code is certainly not my best work, due to my step-by-step approach to development. When I needed something I didn't have I built it, but often that would have made some of the earlier coding a lot simpler, but because I am a strong believer in the adage "if it ain't broke don't fix it", I tended not to revisit parts of the code that were working well as they were. Nonetheless, I am still very proud of it, because the AI plays a much better game than I was expecting I would be able to make it play. I hope you like it. #games #puzzle #logic #strategy #mobile