rubik

package
v0.0.0-...-25c83c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: ISC Imports: 1 Imported by: 0

Documentation

Overview

Package rubik models the standard 3x3 Rubik's Cube.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color int

Color represents one of the six colors in the standard 3x3 Rubik's Cube.

const (
	White Color = iota
	Yellow
	Blue
	Green
	Orange
	Red
)

The standard six colors in the standard 3x3 Rubik's Cube.

func (Color) String

func (c Color) String() string

type Cube

type Cube interface {
	F(Rotation)
	B(Rotation)
	R(Rotation)
	L(Rotation)
	U(Rotation)
	D(Rotation)
	Solved() bool
}

Cube represents a standard 3x3 Rubik's Cube.

func NewCube

func NewCube() Cube

NewCube creates a new standard 3x3 Rubik's Cube. The created cube is in solved state and the white face is in the front.

type Rotation

type Rotation int

Rotation represents a face rotation.

const (
	// C90 is a clockwise 90-degrees rotation.
	C90 Rotation = iota
	// CC90 is a counterclockwise 90-degrees rotation.
	CC90
	// C180 is a clockwise 180-degrees rotation.
	C180
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL