|
using System.Collections.Generic;
using Microsoft.SolverFoundation.Services;
namespace Sudoku
{
public static class DecisionFactory
{
private static readonly List<Decision> Decisions = new List<Decision>(9);
private static Domain domain = Domain.IntegerRange(1, 9);
static DecisionFactory()
{
Initialize();
}
private static void Initialize()
{
if (Decisions.Count == 0)
{
for (int i = 0; i < 81; i++)
{
Decisions.Add(new Decision(domain, Constants.StringAffix + i));
}
}
}
public static List<Decision> BuildDecisions(List<int> squares)
{
if (squares == null || squares.Count == 0)
{
return new List<Decision>();
}
Decisions.Clear();
foreach (int i in squares)
{
Decisions.Add(new Decision(domain, Constants.StringAffix + i));
}
return Decisions;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.