diff options
author | Thomas Voss <thomasvoss@live.com> | 2022-01-09 23:32:40 +0100 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2022-01-09 23:32:40 +0100 |
commit | 3dc9f6d09da4eafc989e2775254315064c603d79 (patch) | |
tree | bcdd95a8d57e9a5c49476e1ec4bd7003683b7f5a | |
parent | 2a1bf9bf871ff0354f05fa8cdfdfe11cc3bfad2f (diff) |
Add a Color enumeration
This enumeration represents the two colors of the pieces on the board,
it should allow you to refer to a color as `Color.BLUE' or `Color.RED'
as opposed to having to use strings or random numbers or whatever. It
also means that if for whatever reason we decide to flip the positions
of blue and red or something similiar, it should be a very quick and
easy fix.
-rw-r--r-- | draughts/color.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/draughts/color.js b/draughts/color.js new file mode 100644 index 0000000..72361e8 --- /dev/null +++ b/draughts/color.js @@ -0,0 +1,7 @@ +/* A basic enumeration representing the two possible piece colors */ +const Color = { + BLUE: 0, + RED: 1 +} + +module.exports = Color |