Paskahousu is a classic Finnish card game, lit. shitpants. You are dealt cards in the start, and your objective is to get rid all of those cards. The last player who has cards in their hand is, according to the classic Finnish tradition, called paskahousu.
This is my first proper HTML5 game, and also the first proper game I’ve implemented outside of assignments. I chose to do Paskahousu specifically because there are countless versions of classic poker, blackjack and solitaire - but only very few versions of paskahousu. It was an interesting exercise to implement, all the way from textures and fonts to the actual game logic and AI.
The game is technically relatively simple and split between UI and backend. The user interface interacts with the backend using defined transactions, allowing decoupling which I believe substantially helped with unit testing. After backend testing was done, it was a relatively breezy effort to implement frontend, as I only had to ensure it follows the specified transaction rules - backend had already been tested to follow them!
The AI is also relatively simple, selecting its moves mostly based on calculated probabilities. Be mindful though - the AI can do certain cheating actions which are not blatantly invalid moves, but may result in unexpected occurences like seeing same card pop twice from the deck (hinting that someone has manipulated it). Good thing that there is a fail-safe, causing the AI to fail its cheating every now and then ;)
There are many variants of the rules, and just about everyone has their own. Below are the rules this game uses, as quoted from my Itch.io page
Each player is dealt five cards in the beginning. The objective is to get rid of your entire hand. The game is played turn by turn, and the first one to get rid of all their cards wins.
The starting player is the one with the largest amount of 3:s. If this does not render an unambiguous result, then 4:s, 5:s, et cetera.
After each turn, you will draw cards from the deck until you have at least 5 cards.
You can place cards on the pile as follows:
If you are unable to place a card, you must take the entire pile to your hand. You may also do this voluntarily at any point instead of placing a card. If nothing in your hand fits, you may also attempt a last chance, publicly drawing a card from the deck. If this succeeds by the card being appropriate for the pile, your turn immediately ends.