Created
November 17, 2018 14:31
-
-
Save TWolverson/d2fcefb9adca287cb224e7915f58d254 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Poly | |
{ | |
enum X | |
{ | |
Left = 0b00, | |
Zero = 0b01, | |
Right = 0b10 | |
} | |
enum Y | |
{ | |
Back = 0b0000, | |
Zero = 0b0100, | |
Fore = 0b1000 | |
} | |
enum Z | |
{ | |
Down = 0b000000, | |
Zero = 0b010000, | |
Up = 0b100000 | |
} | |
enum Vacancy | |
{ | |
// lower plane x,y,-1 | |
LeftZeroDown = X.Left | Y.Zero | Z.Down, | |
ZeroBackDown = X.Zero | Y.Back | Z.Down, | |
RightZeroDown = X.Right | Y.Zero | Z.Down, | |
ZeroForeDown = X.Zero | Y.Fore | Z.Down, | |
// middle plane x,y,0 | |
LeftBackZero = X.Left | Y.Back | Z.Zero, | |
LeftForeZero = X.Left | Y.Fore | Z.Zero, | |
RightForeZero = X.Right | Y.Fore | Z.Zero, | |
RightBackZero = X.Right | Y.Back | Z.Zero, | |
// upper plane x,y,1 | |
LeftZeroUp = X.Left | Y.Zero | Z.Up, | |
ZeroBackUp = X.Zero | Y.Back | Z.Up, | |
RightZeroUp = X.Right | Y.Zero | Z.Up, | |
ZeroForeUp = X.Zero | Y.Fore | Z.Up, | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var vacancyValues = (int[])Enum.GetValues(typeof(Vacancy)); | |
foreach (var vacancy in vacancyValues) | |
{ | |
var x = ((vacancy >> 0) & 0b11) - 1; | |
var y = ((vacancy >> 2) & 0b11) - 1; | |
var z = ((vacancy >> 4) & 0b11) - 1; | |
Console.WriteLine($"({x},{y},{z})"); | |
} | |
Console.Read(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment