cleaning stuff up
This commit is contained in:
parent
48a708ac41
commit
b41e99a1e7
@ -10,6 +10,9 @@ import java.util.*
|
|||||||
enum class Move {
|
enum class Move {
|
||||||
F, F_, F2, B, B_, B2, L, L_, L2, R, R_, R2, U, U_, U2, D, D_, D2;
|
F, F_, F2, B, B_, B2, L, L_, L2, R, R_, R2, U, U_, U2, D, D_, D2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static methods for the Move object.
|
||||||
|
*/
|
||||||
companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Make a random set of moves that makes sense.
|
* Make a random set of moves that makes sense.
|
||||||
@ -28,6 +31,9 @@ enum class Move {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the given counter, which contains digits that correspond with the amount of Moves, to generate a list of Moves.
|
||||||
|
*/
|
||||||
fun combo(counter: Counter): List<Move> {
|
fun combo(counter: Counter): List<Move> {
|
||||||
val res = mutableListOf<Move>()
|
val res = mutableListOf<Move>()
|
||||||
for (i in 0 until counter.size()) {
|
for (i in 0 until counter.size()) {
|
||||||
@ -37,6 +43,10 @@ enum class Move {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this as `Move otherFace Move`, a quick way to check if the moves manipulate the same face or not.
|
||||||
|
* Example: `Move.F otherFace Move.U_ == false`
|
||||||
|
*/
|
||||||
infix fun otherFace(otherMove: Move): Boolean {
|
infix fun otherFace(otherMove: Move): Boolean {
|
||||||
return this.toString().substring(0, 1) != otherMove.toString().substring(0, 1)
|
return this.toString().substring(0, 1) != otherMove.toString().substring(0, 1)
|
||||||
}
|
}
|
||||||
@ -44,10 +54,8 @@ enum class Move {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a color into a letter.
|
* Convert the color into a single digit for print purposes.
|
||||||
*/
|
*/
|
||||||
val COLOR_LETTER = arrayOf("W", "Y", "O", "R", "G", "B")
|
|
||||||
|
|
||||||
fun l(c: Color): String {
|
fun l(c: Color): String {
|
||||||
return c.name.first().toString()
|
return c.name.first().toString()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user