From 3dc9f6d09da4eafc989e2775254315064c603d79 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 9 Jan 2022 23:32:40 +0100 Subject: 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. --- draughts/color.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 draughts/color.js 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 -- cgit v1.2.3