Software

Mora Jai Box Solution Space Analysis
Mora Jai Box Solution Space Analysis

Introduction

Mora Jai boxes are simple-looking puzzles that can be configured into a huge variety of challenges. The original set of puzzles from Blue Prince mostly have short, simple solutions (2-20 moves), but lengthy and difficult solutions can be constructed by exploring deeper state spaces of the tile grid.

Initially, I wanted to create a list of the most difficult configurations by cataloging the longest solutions, but it turns out that length is not the best predictor of difficulty. Many of the longest solutions rely on repetitive patterns rather than complex logic and novel mechanics.

Mora Jai Box Simulator
Mora Jai Box Simulator

Mora Jai Box

A Mora Jai Box is a lock box that involves solving a 3x3 grid of colored tiles. Each color has a unique behavior (see rules). They are originally found in the puzzle/adventure game Blue Prince, but are interesting to analyze on their own.

Warning: leave Spoiler Mode turned off if you’re still playing Blue Prince—it will reveal information relevant to post-endgame puzzles.


Simulator

 

Rules

  • To Solve: Press all 4 outer buttons after the corner tiles’ colors match the target color
  • To Reset: Press any outer button that does NOT match its corresponding corner tile
  • Color Actions: [Reveal All]
    •  ◦ These descriptions are minor spoilers - if you haven't encountered a certain color in-game yet, or want to figure it out yourself, proceed with caution.
    • Gray does nothing.
    • White causes adjacent white tiles (and itself) to turn gray. Adjacent gray tiles turn white.
    • Violet swaps with the tile below it.
    • Yellow swaps with the tile above it.
    • Green swaps positions with the tile opposite it.
    • Pink rotates all the tiles surrounding it clockwise.
    • Black shifts its row to the right.
    • Red changes every black tile into red, and every white tile into black.
    • If a majority of adjacent tiles are the same color, Orange changes to match that color.
    • Blue copies the behavior of whichever tile is in the center (with some quirks).
      • See Yellow Box 3, Blueprint - Pool RoomRed Box 3, Blueprint - FurnaceBlue Box 2, and Blueprint - BallroomBlue Box 3 for examples.

Challenge Puzzles

Based on computer analysis, I included several challenge puzzles that are not found in Blue Prince. The list is curated from a large set of puzzles with lengthy solutions, and arranged in order of perceived difficulty.

Crammed Cube & Simulator
Crammed Cube & Simulator

The Crammed Cube is an internally geared twisty puzzle that expresses the Mathieu M11 group over its 12 edge pieces. The puzzle features a modified Compy Cube mechanism with 6 axes, which are mechanically linked into two sets using universal joints and gears. It is called the ‘Crammed Cube’ because, while the axis system would normally have 11 moving edges, I’ve crammed an extra one into the red/white edge and lifted the corner angle to make space. This edge duplication is necessary to make the group actions fit over cubic geometry.

Fano Gem Puzzle & Simulator
Fano Gem Puzzle & Simulator

The Fano Gem is a twisty puzzle that I designed to showcase the symmetries of the Fano Plane, which is a familiar object in combinatorics, coding theory, and algebra. The Fano Plane is the smallest possible finite projective plane, constructed from 7 points and 7 lines, where each line contains exactly 3 points.

From the red face (pictured left), the numbers on the corners of the puzzle match up with the numbers on the plane (with number 7 on the back of the puzzle, out of view).

Hotfixing ZipInputStream
Hotfixing ZipInputStream

This bug is fixed in Java 23u10

I came across an apparent bug in java.util.zip.ZipInputStream where reading a certain type of zip file causes an exception:

java.util.zip.ZipException: invalid entry size (expected 0 but got 199 bytes)
	at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:384)
	at java.util.zip.ZipInputStream.read(ZipInputStream.java:196)
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122)

The file in question reads fine using archiving utilities and Java’s ZipFile, so the issue is likely rooted in ZipInputStream. My application requires reading the zip file sequentially, so ZipInputStream is my only option besides a third-party library. I decided to search for a solution using vanilla Java rather than pulling in a new dependency.

HTTP Cheatsheet

This post will be continuously updated with useful commands related to HTTP.

Python3 HTTP Server

Launches an HTTP server in the current directory for serving files

1python3 -m http.server [port]

cURL - Post Multipart Form

Post two files

1curl -X POST -F "file1=@file1.png" -F "file2=@file2.png" --no-buffer https://chandler.io/test