-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
72 lines (64 loc) · 2.55 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Linq;
namespace Ball_sorting_puzzle
{
class Program
{
static void Main(string[] args)
{
/*var repeatNeeded=0;
var additionalEmptyTube=0;
for(var i=1;i<=10;i++)
{
// Init.
int cupSize = 4;
int cupCount = i+1+additionalEmptyTube;
int colorCount = i;
var riddleCreator = new RiddleCreator(cupSize, cupCount, colorCount);
var riddleSolver = new RiddleSolver(cupSize, cupCount, colorCount);
var fileWriter = new FileWriter(@"C:\Ball_sorting_puzzle_creator\Ball-sorting-puzzle\generated\");
// Workflow steps.
var randomRiddle = riddleCreator.Create();
ConsolePrinter.Print(randomRiddle);
var gameTree = riddleSolver.Solve(randomRiddle);
if(gameTree.Solutions.Any())
{
//ConsolePrinter.Print(gameTree);
fileWriter.WriteToJson(i, gameTree);
repeatNeeded=0;
}
else
{
i--;
repeatNeeded++;
if(repeatNeeded>10)
{
repeatNeeded = 0;
additionalEmptyTube++;
}
}
Console.WriteLine(i);
}*/
for(var i=1;i<=100;i++)
{
int cupSize = 4;
int cupCount = 10;
int colorCount = 9;
var riddleCreator = new RiddleCreator(cupSize, cupCount, colorCount);
var riddleSolver = new RiddleSolver(cupSize, cupCount, colorCount);
var fileWriter = new FileWriter(@"C:\Ball_sorting_puzzle_creator\Ball-sorting-puzzle\generated\");
// Workflow steps.
var randomRiddle = riddleCreator.Create();
ConsolePrinter.Print(randomRiddle);
var gameTree = riddleSolver.Solve(randomRiddle, false);
if(gameTree.Solutions.Any())
{
//ConsolePrinter.Print(gameTree);
var deadendRatio = (double)(gameTree.DeadendNodeCount) / (double)(gameTree.NodeCount);
fileWriter.WriteToJson($"{deadendRatio*100}", gameTree);
//fileWriter.WriteToJson($"{gameTree.ThreeStarLimit}", gameTree);
}
}
}
}
}