Quoridor Board game
2020-12-14Ah Java, takes me back to a simpler time with much less simple code. Back in high school (which really was not that long ago), for my final I had to make a board game with Java Applets and well this is the result. I choose Quoridor as it was a very interesting game, and honestly, it looked like an actual challenge. Looking back on the assignment, I am really proud of what I made, as I really had to learn a lot of extra stuff beyond what was taught to me in class, with the biggest offender being how to use backtracking algorithms. Also, I don’t know if I was just not taught correctly, but using graphics in Java Applets was just awful, and I am very grateful for other languages/frameworks like Processing because I do not think I would ever want to do graphics in Java Applets ever again. Either way, let’s take a look at the digital version of Quoridor!
Game Rules
To win Quoridor you need to navigate your player to the other side of the board. As for the other rules, I created some graphics for use in my actual game to explain how to play, so I’m gonna show you those, I’m not too lazy to type it out trust me.
⠀⠀
TLDR; To win get your player to the other side of the game board. On your turn, you can either place 2 connected whirlpools (can’t trap opponent) or instead move your player in a direction that is not cut off by a whirlpool. Note that each player only has 10 whirlpools to use (2 connected whirlpools counts as 1 overall whirlpool).
For your reference, here is a blank game board, and a gameboard from when I played a game with one of my friends!
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Figure 1: Blank Game board
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Figure 2: An example of a game board
Try it yourself
Did my elite Photoshop and Java skills persuade you to try my game? You can easily get the game by downloading the .jar file from here. Or if instead, you would like to look at the code behind this game you can access it from the repository located here. Or if you prefer to use git, open bash in whatever directory you want and execute:
git clone https://github.com/LangLazy/QuoridorBoardGame
The Challenges
There were a lot of challenges in making this, however, the hardest mechanic to implement was the feature that prevented players from caging in themselves or the other player. The issue with this was that it was essentially a maze-solving algorithm, which needs to see if it was possible to solve the given maze for both players given their current position. Now, for some such a problem may prove to be trivial, however to me when I was first learning to code, it was a very daunting task. Moreover, I took on the extra challenge of using no graphical imports, meaning that I could not rely on graphics libraries developed for creating visual applications. I mainly did this as I usually try to do everything myself before looking to the outside for help, in order to better develop my understanding of the subject and overall problem solving skills. Overall, the backtracking implementation was something I had to recode at least 5 times over to get right, and even then it initially had way too many bugs. I guess the moral of the story is either, to not be so uptight, or to just plan better beforehand.
Another huge issue was how to actually make the GUI look not horrible. I think in the end I got a pretty good looking GUI, however, the code behind it is very messy, as I had to use screen builder, an extension used to generate screens in Eclipse. Even though it was leagues better than whatever I was doing in vanilla Java, it still was incredibly hard to use at times. I think such difficulties are an issue with Java Applets, which this game was built on, however, I could be wrong and just end up looking massively stupid.
Improvements:
I think the GUI and graphics are things I would like to improve a lot, as they still look a bit rough and definitely need some quality of life updates. Ever since I have made this, I have gone on to create a lot of other GUIs/visual applications via Processing, and as such, I think I have a better grasp of how to make a half decent UI now. Also, as you play through the game, you may find bugs in the actual game, some of which I am aware of, but there very well maybe more. If you do find any feel free to let me know by shooting me an email at rgudise@uwaterloo.ca so I could improve this game!