summaryrefslogtreecommitdiff
path: root/core/src/commonMain/kotlin/coffee/liz/rookery/model/Event.kt
blob: db7fcb8742386754c0f8f12caca89ea01684fc8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package coffee.liz.rookery.model

/** Puzzles the engine knows how to scramble (and, over time, render and simulate). */
enum class Puzzle { CUBE2, CUBE3, CUBE4, CUBE5, CUBE6, CUBE7, PYRAMINX, SKEWB, MEGAMINX, SQUARE1, CLOCK, FTO;
    /** Layers per side for NxN puzzles, otherwise null. */
    val cubeSize: Int? get() = when (this) {
        CUBE2 -> 2; CUBE3 -> 3; CUBE4 -> 4; CUBE5 -> 5; CUBE6 -> 6; CUBE7 -> 7; else -> null
    }
}

/** Events, keyed by WCA event id where one exists. */
enum class Event(val id: String, val title: String, val short: String, val puzzle: Puzzle, val wca: Boolean = true) {
    E333("333", "3x3x3", "3x3", Puzzle.CUBE3),
    E222("222", "2x2x2", "2x2", Puzzle.CUBE2),
    E444("444", "4x4x4", "4x4", Puzzle.CUBE4),
    E555("555", "5x5x5", "5x5", Puzzle.CUBE5),
    E666("666", "6x6x6", "6x6", Puzzle.CUBE6),
    E777("777", "7x7x7", "7x7", Puzzle.CUBE7),
    E333BF("333bf", "3x3x3 Blindfolded", "3BLD", Puzzle.CUBE3),
    E333FM("333fm", "3x3x3 Fewest Moves", "FMC", Puzzle.CUBE3),
    E333OH("333oh", "3x3x3 One-Handed", "OH", Puzzle.CUBE3),
    CLOCK("clock", "Clock", "Clock", Puzzle.CLOCK),
    MINX("minx", "Megaminx", "Mega", Puzzle.MEGAMINX),
    PYRAM("pyram", "Pyraminx", "Pyra", Puzzle.PYRAMINX),
    SKEWB("skewb", "Skewb", "Skewb", Puzzle.SKEWB),
    SQ1("sq1", "Square-1", "Sq-1", Puzzle.SQUARE1),
    E444BF("444bf", "4x4x4 Blindfolded", "4BLD", Puzzle.CUBE4),
    E555BF("555bf", "5x5x5 Blindfolded", "5BLD", Puzzle.CUBE5),
    E333MBF("333mbf", "3x3x3 Multi-Blind", "MBLD", Puzzle.CUBE3),
    FTO("fto", "Face-Turning Octahedron", "FTO", Puzzle.FTO, wca = false);

    val blind: Boolean get() = this == E333BF || this == E444BF || this == E555BF || this == E333MBF

    companion object {
        fun byId(id: String): Event? = entries.firstOrNull { it.id == id }
    }
}