A Rush Hour game made with Cakelisp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Macoy Madson 380b8df2ba Rearranged readme and improved it 3 years ago
Dependencies Got pieces drawing 3 years ago
assets Render move counts 3 years ago
data Got Kitty Gridlock working on Android! 3 years ago
src Remove unnecessary code 3 years ago
.gitattributes Added phone specs and dot git files 3 years ago
.gitignore Tween to position, reading from database 3 years ago
.gitmodules Added phone specs and dot git files 3 years ago
Build.sh Read puzzles and randomly select one to play 3 years ago
COPYING Initial commit 3 years ago
LICENSE Initial commit 3 years ago
ReadMe.org Rearranged readme and improved it 3 years ago


Kitty Gridlock

This is a project for V. She loves Rush Hour puzzles. For her birthday (April 2021), I have a goal to make a Rush Hour player for her Android phone, using my Cakelisp and GameLib tools.

I am using Michael Fogleman's Rush Hour database (archive.org) in order to provide her tons of puzzles.



Clone the repository and its dependencies:

git clone https://macoy.me/code/macoy/kitty-gridlock.git
git submodule update --init --recursive



Note that the build currently builds Ogre, which is completely unnecessary. Removing Ogre from the build script in Dependencies/gamelib is a quick fix for avoiding that.


See SDL's README-android.md for instructions I followed for setting up Android. You need to download Android Studio. (You could get away with only the SDK and build tools, but you'll probably want the debugger when things don't work out of the box anyways.)

Known working version(s)

My local build was tested the following software versions:

Component Version
Android 10
SDK Build-Tools 29.03, 28.03¹
NDK 21.4.7075529²

¹= I'm not actually sure which SDK version is being used, because I didn't explicitly specify one.

²= I had to downgrade from version 22 due to platforms folder missing. See below section.

Fix SDL_main() not found in libmain.so error

  • Ensure you have main() defined with its full signature: int main(int numArgs, char* args[])

  • Note that SDL defines main() as a macro to be SDL_main(), which is a bit confusing, but works okay as long as you have the full signature

Fix no platforms folder in NDK

I had to downgrade from version 22 due to platforms folder missing. To do so:

  • Open Android Studio

  • Tools -> SDK Manager

  • Switch to tab SDK Tools

  • Check Show Package Details

  • Expand the NDK tree and check 21.4.7075529, then click OK

Building from the command line

Follow the SDL README-android.md for using androidbuild.sh, which is how I got the first version going. For reference, here is the command sequence:

cd Dependencies/gamelib/Dependencies/SDL/build-scripts

export ANDROID_HOME=/home/macoy/Android/Sdk
export ANDROID_NDK_HOME=/home/macoy/Android/Sdk/ndk/21.4.7075529/

./androidbuild.sh org.libsdl.testgles ../test/testgles.c

cd ../build/org.libsdl.testgles
# Note: This will only succeed if you have an Android device plugged in to USB, with Developer mode enabled
./gradlew installDebug

All I had to do for my project was copy some files as the Readme instructs, then edit SDL/build/org.libsdl.testgles/app/jni/src/Android.mk, to add the files and flags, e.g.:

# Work around "bug" in cakelisp where there are extraneous parens
LOCAL_CFLAGS += -Wno-parentheses-equality

# Copied straight from cakelisp_cache
LOCAL_SRC_FILES := Main.cake.cpp Math.cake.cpp SDL.cake.cpp

Fix Android Studio not knowing how to build/debug project

Click File -> Sync Project files with Gradle files.

Target device

V has a OnePlus 6T Android phone with the following specifications (from here):

Thing Value
Display Type Optic AMOLED
Display Size 6.41 inches, 100.9 cm2
Display Resolution 1080 x 2340 pixels, 19.5:9 ratio (~402 ppi density)
CPU Chipset Qualcomm SDM845 Snapdragon 845 (10 nm)
CPU Octa-core (4x2.8 GHz Kryo 385 Gold & 4x1.7 GHz Kryo 385 Silver)
GPU Adreno 630
Android Version 10

The two main specs I need to care about are Android Version and Display Resolution. Additionally, AMOLED hints that pure black is going to look nice.

Database format

(The following text is copied from Michael Fogleman's Rush Hour database (archive.org), for easier reference)

The database is a simple text file with just a few columns. There is one row for every valid (solvable, minimal) cluster. The columns are: number of moves, board description, and cluster size (number of reachable states).

The board description is a 36-character string representing the state of the unsolved board. It is a 6x6 2D array in row-major order. The characters in the description follow these simple rules:

  • o empty cell

  • x wall (fixed obstacle)

  • A primary piece (red car)

  • B - Z all other pieces

I used lowercase o instead of periods . for the empty cells in the database so that the entire board description can be selected with a double-click.

An example board: