static void Main(string[] args) { // var path = (@"C:\Users\ferit.ozcan\Desktop\wordbender\PuzzleGenerator\PuzzleGenerator\PuzzleGenerator\allwords.txt"); var path = (@"/Users/feritozcan/Desktop/wordbender/PuzzleGeneratorC#/PuzzleGenerator/PuzzleGenerator/allwords.txt"); //var path = (@"C:\Users\beytullah\Desktop\WordBender\PuzzleGenerator\PuzzleGenerator\PuzzleGenerator\allwords.txt"); try { var options = new PuzzleOptions { Rows = 4, Columns = 4, MaxCharLength = 12, MinimumWordCount = 150, MinCharLength = 3, WordFilePath = path }; PuzzleCreator puzzleCreator = new PuzzleCreator(options); var actions = new List <Action>(); var listt = new List <int>(); for (int a = 0; a < 10000; a++) { var puzzle = puzzleCreator.CreatePuzzle(options); puzzle.PrintPuzzle(); Console.ReadLine(); } } catch (Exception e) { Console.WriteLine("Ex: " + e.ToString()); } }
static void Create(PuzzleCreator puzzleCreator, int index, PuzzleOptions options) { int a = index; var puzzle = puzzleCreator.CreatePuzzle(options); string jsonString = "someString"; try { var json = puzzle.ToString(); var tmpObj = JsonValue.Parse(json); StreamWriter sw = new StreamWriter(@"/Users/feritozcan/Desktop/wordbender/PuzzleGeneratorC#/PuzzleGenerator/PuzzleGenerator/puzzles/puzzle_" + a + ".txt"); sw.WriteLine(json); sw.Close(); } catch (FormatException fex) { //Invalid json format Console.WriteLine(fex); } catch (Exception ex) //some other exception { Console.WriteLine(ex.ToString()); } }
//@Deprecated private void puzzleInit() { PuzzleCreator[] puzzles = new PuzzleCreator[10]; int[][] puzzle1 = new int[][] { new int[] { 1, 15, 3, 0 }, new int[] { 3, 15, 3, 0 }, new int[] { 6, 1, 0, 1 }, new int[] { 8, 1, 0, 1 }, new int[] { 22, 1, 0, -1 } }; int[][] puzzle2 = new int[][] { new int[] { 1, 15, 3, 0 }, new int[] { 3, 15, 3, 0 }, new int[] { 6, 1, 0, 1 }, new int[] { 8, 1, 0, 1 }, new int[] { 22, 1, 0, -1 } }; int[][] puzzle3 = new int[][] { new int[] { 1, 15, 3, 0 }, new int[] { 3, 15, 3, 0 }, new int[] { 6, 1, 0, 1 }, new int[] { 8, 1, 0, 1 }, new int[] { 27, 1, 0, -1 } }; //name, id, length, heigth, lockedtiles(tileNr, tileID, dir, input/output), winCondition(tileNr) puzzles[0] = new PuzzleCreator("TUTORIAL", 1, 5, 5, puzzle1, PuzzleController.logic.OR, "Tutorial."); puzzles[0] = new PuzzleCreator("Puzzle 1: OR", 1, 5, 5, puzzle1, PuzzleController.logic.OR, "Create a logic gate " + "that lets either or both inputs power the output."); puzzles[1] = new PuzzleCreator("Puzzle 2: NOR", 2, 5, 5, puzzle2, PuzzleController.logic.NOR, "Create a logic gate " + "so that the output is on whenever no inputs are on."); puzzles[2] = new PuzzleCreator("Puzzle 3: AND", 3, 5, 6, puzzle3, PuzzleController.logic.AND, "Create a logic gate " + "so that the output is on only when both inputs are on."); }
//@DEPRECATED public void setupPuzzle(PuzzleCreator puzzle) { print(classTag + "Setting up puzzle!"); for (int i = 0; i < puzzle.getLockedTiles().Length; i++)//For each unit in length { GameObject prefab = GC.spawnSingle(puzzle.getLockedTiles()[i][1], puzzle.getLockedTiles()[i][0], puzzle.getLockedTiles()[i][2]); prefab.GetComponent <TileController>().locked = true; print("spawning i: " + i + "/" + prefab.name); switch (puzzle.getLockedTiles()[i][3]) { case -1: prefab.GetComponent <TileController>().myLabel = TileController.label.OUT; break; case 0: prefab.GetComponent <TileController>().myLabel = TileController.label.NULL; break; case 1: prefab.GetComponent <TileController>().myLabel = TileController.label.IN; break; default: prefab.GetComponent <TileController>().myLabel = TileController.label.NULL; print("something went wrong"); break; } GameObject lockP = Instantiate(lockPrefab, prefab.transform); lockP.transform.position += new Vector3(-0.35f, 0.35f, 0); } //setup input/output myPuzzle = puzzle; PO.setup(puzzle); }
private void OnEnable() { creator = new PuzzleCreator(); parent = GameObject.Find("Puzzle Creator Parent").transform; }
public void setup(PuzzleCreator puzzle) { header.text = puzzle.getName(); desc.text = puzzle.getDesc(); }