Created
January 12, 2021 21:31
-
-
Save greebie/61f75527a2217a5ca53b501238e85a4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Color { | |
final int value; | |
const Color._internal(this.value); | |
static const Color WHITE = const Color._internal(0); | |
static const Color BLACK = const Color._internal(1); | |
@override | |
bool operator==(Object o) => identical(this, o) || | |
o is Color && value == o.value; | |
@override | |
int get hashCode => value.hashCode; | |
String toString() => (this == WHITE) ? 'w' : 'b'; | |
} | |
Map<Color, List> PAWN_OFFSETS = { | |
Color.BLACK: const [16, 32, 17, 15], | |
Color.WHITE: const [-16, -32, -17, -15] | |
}; | |
void main() { | |
print(PAWN_OFFSETS[Color.BLACK]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment