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.
$ 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 ...
Copyright (C) 2020 Iván Ávalos <email@example.com>, Sebastian Solano <firstname.lastname@example.org> 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <https://www.gnu.org/licenses/>.