16 January 2018
Clojure Koans is a project of failing assertions with blanks that are to be filled by the student. I’ve completed them previously, but I’m sure I didn’t understand everything, so I’m going through them again. Here are my solutions for the first 7 sections.
15 January 2018
I got some much-needed help from the Vancouver Clojure Meetup on a remote Clojure(Script) hack night. They helped me clean up my code a bit, and they pointed out some next steps, like a generic method for accessing nodes in the XML. I really appreciate the help, since I don’t even know how good Clojure code looks.
14 January 2018
Polarity is a game of placing magnetic discs so that they lean on the magnetic fields of others. It went out of print a while ago, so I wanted to make a scaled-down version of my own with some 3D-printed pieces. I left out some aspects of the original game.
The rules had always been a bit confusing, so I’ll try to distill a set of my own rules here.
Be the first to play all discs in your supply.
Collect the most discs in towers, stacks of discs.
Roll out the playing mat flat on a stable surface.
Give each player half the discs for their supply: 19 to each player.
Players take turns placing foundation discs flat on the mat, touching no others, until each player has placed 4 foundations.
Take turns leaning discs from your supply on magnetic fields of your discs on the mat.
Play only on the mat.
Play only on your own discs with your color facing up, not on your opponent’s discs.
A turn ends by successfully placing a disc or by causing a fault.
Faults occur 4 ways:
A leaning disc falls flat.
2 or more discs touch each other.
Moving a tower or foundation disc more than its diameter.
Knocking a disc off the mat.
A player can intentionally cause a fault to convert a leaning disc into a new foundation.
A player can only convert their own discs.
The fault still ends their turn.
Faults are resolved by:
If discs snap to the disc being placed while still in the hand, the player removes the touching discs and returns them to their supply.
If discs on the board are touching, the opponent carefully retrieves the discs allowing them to snap the rest of the way to form a tower, and places it anywhere on the mat.
While retrieving or placing a tower, the tower is treated like a disc being placed, so causing a fault should be resolved the same way as when placing a piece.
If a disc just fell, but stayed the same color (a conversion), it stays where it is, but the turn ends.
If a fault flips one disc from one color to the other, without otherwise touching other discs, the opponent can choose to retrieve the disc and place it anywhere on the mat.
A player is responsible for any faults after a move until the opponents hand approaches the mat.
The game ends when one player depletes their supply.
A player no longer has any discs with their color showing left on the board.
Each disc in a tower is worth +1 point.
Each disc in the supply is worth -1 point.
13 January 2018