Skip to content

Instantly share code, notes, and snippets.

@greebie
Created January 12, 2021 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greebie/61f75527a2217a5ca53b501238e85a4d to your computer and use it in GitHub Desktop.
Save greebie/61f75527a2217a5ca53b501238e85a4d to your computer and use it in GitHub Desktop.
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