First CS semester, we had to build an Othello player, then we were pitched against each other. Out of 50 students, more or less half implemented the standard algorithm and the other half implemented much more sophisticated stuff. The winner was one of the standard implementations.
I had a similar experience, where in a CS class (also first semester) we needed to program AI for a little tank thing in assembly and have it navigate mazes using distance info from three sensors. There was a race where first place got an auto-100 in the assignment, and me and my partner's tank won with the simple wall follow algorithm that was explained to us at the beginning of the assignment
Funny how they changed the structure of actual bot maze running competitions after one guy just had the bot follow the right wall and beat all the teams doing complex processing.
I actually made a very basic way to address that a few years ago for a similar competition, the bot would keep a an extremely basic map of the labirinth and basically upon completing a loop it would create a virtual wall so it could keep exploring the rest without being stuck in a loop
Ahh that’s clever. Essentially, if the bots location ever repeats, next intersection, create a fake wall down the path you’ve tried before. I wonder if that has any weaknesses….
Well it takes a bit of caution in how you mark where you have already been, my original version was extremely basic and really bad at distinguishing between backtracking and loops but it should be relatively easy to make it work reliably
That algorithm does solve most simple wall follower issues (by essentially converting complex mazes into simply connected ones over time), though IIRC it still fails on large open spaces like a standard wall follower would.
Also another penalty is that now you need a variable amount of memory based on the size of the maze, compared to a pure algorithmic approach that can operate with a fixed amount.
What would the alternatives be? "Follow the wall" is the actual strategy I use when I'm in a hedge maze or video game dungeon and need to make sure I find the exit and avoid circles
Not really certain, that's part of why we did the wall follow lol. I guess you could do some fancy stuff to try and detect when the wall has divets and cut across them, but that would be hard to pull off. Some students did try fancy stuff, but most of them just got stuck in a loop or hit the walls. The only things we did were adjust the numbers to turn as fast and tightly as possible, and added a goldilocks zone where the car would go full speed if the wall was in a certain range
Yeah I think if your sensors have sufficient range and precision you could try to spot the exit ahead of time and be able to skip some turns, or if it were an all-or-nothing competition you could try gambling on randomly skipping a couple turns in the hope you'll luck onto a faster path, but otherwise "follow the wall" is the best strategy
The mazes were really simple, they were more enclosures with random walls in the middle than anything else, so skipping turns wasn't really necessary since there weren't really "turns", just the walls going in slightly different directions. That's part of why the wall follow was so viable, because the walls were usually just a jagged path straight to the end. There were a lot of concessions that needed to be made since it was first semester students coding assembly for an actual object that needed to navigate around. It was still a fun project though
Pick a direction (helps if it's the rough direction of the exit) and "pledge" to always go in that direction when possible.
When you hit a wall hug it and follow it round but disconnect when you're facing in your pledged direction(and the sum of angles turned is a multiple of 360).
It stops you getting trapped in a disconnected segment in the middle of the maze.
Honestly my CS teacher said in life 90% of the time you'll enter a workplace where they have private optimized algorithms made for you already or the standard algorithm library in C++ is more than competent enough.
Standard libraries are made by people much smarter than the average dev and if they aren’t, lots of other devs have probably had the chance to look at it and optimize it. Normally you won’t be able to do any better on your own, because if you could whatever you came up with would probably be the standard. Obviously there are exceptions.
My "algorithm" for Othello which used a hardcoded matrix to rank every square of the board, using a ranking from a paper, went second place. Only behind a neural network trained for quite some time. It even surpassed all the other neural networks.
View all comments
1.6k
u/[deleted] Jun 10 '23
First CS semester, we had to build an Othello player, then we were pitched against each other. Out of 50 students, more or less half implemented the standard algorithm and the other half implemented much more sophisticated stuff. The winner was one of the standard implementations.