public PlacedTetraStick(TetraStick tetraStick, Coords location, Orientation orientation, ReflectionMode reflectionMode)
 {
     TetraStick = tetraStick;
     Location = location;
     Orientation = orientation;
     ReflectionMode = reflectionMode;
     _lazyWidth = new Lazy<int>(CalculateWidth);
     _lazyHeight = new Lazy<int>(CalculateHeight);
     _lazyInteriorJunctionPoints = new Lazy<IImmutableList<Coords>>(CalculateInteriorJunctionPoints);
     _lazyLines = new Lazy<IEnumerable<IImmutableList<Coords>>>(CalculateLines);
 }
Exemple #2
0
 public PuzzleSolver(
     TetraStick tetraStickToOmit,
     Action<IImmutableList<PlacedTetraStick>> onSolutionFound,
     Action<IImmutableList<PlacedTetraStick>> onSearchStep,
     Action onDoneSolving,
     SynchronizationContext synchronizationContext,
     CancellationToken cancellationToken)
 {
     _tetraStickToOmit = tetraStickToOmit;
     _onSolutionFound = onSolutionFound;
     _onSearchStep = onSearchStep;
     _onDoneSolving = onDoneSolving;
     _synchronizationContext = synchronizationContext;
     _cancellationToken = cancellationToken;
 }
 public static Color TetraStickToColour(TetraStick tetraStick)
 {
     switch (tetraStick.Tag)
     {
         case "F":
             return Color.FromRgb(0xFF, 0x73, 0x66);
         case "H":
             return Color.FromRgb(0x00, 0xE6, 0x1A);
         case "I":
             return Color.FromRgb(0x66, 0x00, 0x66);
         case "J":
             return Color.FromRgb(0xE6, 0xE6, 0xFF);
         case "L":
             return Color.FromRgb(0x59, 0x66, 0x73);
         case "N":
             return Color.FromRgb(0xFF, 0xFF, 0x00);
         case "O":
             return Color.FromRgb(0xCC, 0xCC, 0x1A);
         case "P":
             return Color.FromRgb(0x99, 0x4D, 0x33);
         case "R":
             return Color.FromRgb(0x99, 0x26, 0xB2);
         case "T":
             return Color.FromRgb(0x33, 0x00, 0xB2);
         case "U":
             return Color.FromRgb(0xFF, 0x26, 0x99);
         case "V":
             return Color.FromRgb(0x00, 0xFF, 0xFF);
         case "W":
             return Color.FromRgb(0xCC, 0xFF, 0x00);
         case "X":
             return Color.FromRgb(0xE6, 0x00, 0x00);
         case "Y":
             return Color.FromRgb(0x66, 0x59, 0xE6);
         case "Z":
             return Color.FromRgb(0x00, 0x80, 0x00);
         default:
             throw new InvalidOperationException($"Unknown tetra stick tag, \"{tetraStick.Tag}\".");
     }
 }