Rubik Scheme

Rubik Cube on Chicken Scheme

This is a basic implementation of a Rubik's cube in Scheme, that supports any cube size, from 2x2 to infinity and beyond! It is based on a Python implementation called MagicCube (created by David W. Hogg and Jacob Vanderplas under GPLv2 license). It currently doesn't support 3D plotting and it is entirely text based.

Example (5x5)

$ csi cube.scm
#;1> (define cube (make-cube 5))
#;2> (cube-move cube 'U 0 1 #f)  ;move layer 0 parallel to face 'U, 90º clockwise
#;3> (cube-move cube 'F 1 -2 #f) ;move layer 1 parallel to face 'F, 180º counter-clockwise
#;4> (cube-move cube 'L 4 -1 #f) ;move layer 4 parallel to face 'L, 90º counter-clockwise
#;5> (cube-print cube)           ;print cube
#;6> (cube-randomize cube 10)    ;scramble n number of times

Licence (GPLv3)

Copyright (C) 2020  Iván Ávalos <>, Sebastian Solano <>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <>.