public void BoardColumnTest2() { Dictionary <string, int> letters = new Dictionary <string, int>() { { "a", 1 }, { "b", 4 }, { "c", 4 }, { "d", 2 }, { "e", 1 }, { "f", 4 }, { "g", 3 }, { "h", 3 }, { "i", 1 }, { "j", 10 }, { "k", 5 }, { "l", 2 }, { "m", 4 }, { "n", 2 }, { "o", 1 }, { "p", 4 }, { "q", 10 }, { "r", 1 }, { "s", 1 }, { "t", 1 }, { "u", 2 }, { "v", 5 }, { "w", 4 }, { "x", 8 }, { "y", 3 }, { "z", 10 }, }; string[,] baseBoard = new string[15, 15]; string[] lines = System.IO.File.ReadAllLines("WWFDictionary.txt"); List <string> dictionary = new List <string>(); foreach (string s in lines) { dictionary.Add(s); } ScrabbleBoard board = new ScrabbleBoard(baseBoard, dictionary, letters); board.PlaceLetter("w", 2, 5); board.PlaceLetter("o", 3, 5); board.PlaceLetter("r", 4, 5); board.PlaceLetter("d", 5, 5); board.PlaceLetter("f", 7, 5); board.PlaceLetter("u", 8, 5); board.PlaceLetter("n", 9, 5); Assert.IsTrue(board.CheckRowOrCol(5, false, board)); }
private String GetImageName() { for (int rowIndex = 0; rowIndex < ScrabbleBoard.RowDefinitions.Count; rowIndex++) { for (int columnIndex = 0; columnIndex < ScrabbleBoard.ColumnDefinitions.Count; columnIndex++) { CheckBox chkbx = (CheckBox)ScrabbleBoard.FindName("checkBox" + rowIndex.ToString() + columnIndex.ToString()); if (chkbx.IsChecked.Value) { string suffix; if (rowIndex < 1) { suffix = columnIndex.ToString(); } else { suffix = rowIndex.ToString() + columnIndex.ToString(); } string imgName = "Photo" + suffix + ".png"; Txt_Blk.Text = imgName; return(imgName); } } } return("Image.jpg"); }
public void GetBestPlayTest1() { Dictionary <string, int> letters = new Dictionary <string, int>() { { "a", 1 }, { "b", 4 }, { "c", 4 }, { "d", 2 }, { "e", 1 }, { "f", 4 }, { "g", 3 }, { "h", 3 }, { "i", 1 }, { "j", 10 }, { "k", 5 }, { "l", 2 }, { "m", 4 }, { "n", 2 }, { "o", 1 }, { "p", 4 }, { "q", 10 }, { "r", 1 }, { "s", 1 }, { "t", 1 }, { "u", 2 }, { "v", 5 }, { "w", 4 }, { "x", 8 }, { "y", 3 }, { "z", 10 }, }; string[,] baseBoard = new string[15, 15]; string[] lines = System.IO.File.ReadAllLines("WWFDictionary.txt"); List <string> dictionary = new List <string>(); foreach (string s in lines) { dictionary.Add(s); } ScrabbleBoard board = new ScrabbleBoard(baseBoard, dictionary, letters); ScrabbleCheater.Solver solve = new Solver(board); board.PlaceLetter("a", 1, 11); board.PlaceLetter("a", 1, 10); List <string> hand = new List <string>() { "a", "a", "m", "n", "n", "y" }; int[] pos = new int[2]; pos[0] = 0; pos[1] = 5; List <Move> moves = solve.GetMovesInArray(board, hand, board.GetCol(0), true, 0); Move best = solve.GetBestPlay(board, hand); Assert.IsTrue(best.GetWord().Equals("mayan")); }
public void CheckIfValidMoveTest4() { Dictionary <string, int> letters = new Dictionary <string, int>() { { "a", 1 }, { "b", 4 }, { "c", 4 }, { "d", 2 }, { "e", 1 }, { "f", 4 }, { "g", 3 }, { "h", 3 }, { "i", 1 }, { "j", 10 }, { "k", 5 }, { "l", 2 }, { "m", 4 }, { "n", 2 }, { "o", 1 }, { "p", 4 }, { "q", 10 }, { "r", 1 }, { "s", 1 }, { "t", 1 }, { "u", 2 }, { "v", 5 }, { "w", 4 }, { "x", 8 }, { "y", 3 }, { "z", 10 }, }; string[,] baseBoard = new string[15, 15]; string[] lines = System.IO.File.ReadAllLines("WWFDictionary.txt"); List <string> dictionary = new List <string>(); foreach (string s in lines) { dictionary.Add(s); } ScrabbleBoard board = new ScrabbleBoard(baseBoard, dictionary, letters); board.PlaceLetter("f", 7, 5); board.PlaceLetter("u", 8, 5); board.PlaceLetter("n", 9, 5); List <string> hand = new List <string>() { "f", "u", "m", "n", "n", "y" }; int[] pos = new int[2]; pos[0] = 7; pos[1] = 6; Assert.IsFalse(board.CheckIfValidMove("fund", pos, true, hand)); }
public RegexEngine(ScrabbleBoard Board) { if (Board == null) { return; } var bot = Config.GetBot(Board.Bot); // var board = Config.GetBoard(Board.Name); if (board == null) { return; } // CharSet = Config.GetCharSet(board.Language); var voc = (bot == null) ? CharSet.Dictionary : bot.Dictionary; file = ServerUtil.Path("bots\\" + voc); id = bot.Id + Board.Id; // size = board.Size; weights = board.Weights; tileWeights = GetTileWeights(board.Trays, CharSet); star = board.Star; // cells = Board.Cells; vowels = Board.Vowels; conso = Board.Conso; special = Board.Special; }
public void FindMovesInArrayTest1() { Dictionary <string, int> letters = new Dictionary <string, int>() { { "a", 1 }, { "b", 4 }, { "c", 4 }, { "d", 2 }, { "e", 1 }, { "f", 4 }, { "g", 3 }, { "h", 3 }, { "i", 1 }, { "j", 10 }, { "k", 5 }, { "l", 2 }, { "m", 4 }, { "n", 2 }, { "o", 1 }, { "p", 4 }, { "q", 10 }, { "r", 1 }, { "s", 1 }, { "t", 1 }, { "u", 2 }, { "v", 5 }, { "w", 4 }, { "x", 8 }, { "y", 3 }, { "z", 10 }, }; string[,] baseBoard = new string[15, 15]; string[] lines = System.IO.File.ReadAllLines("WWFDictionary.txt"); List <string> dictionary = new List <string>(); foreach (string s in lines) { dictionary.Add(s); } ScrabbleBoard board = new ScrabbleBoard(baseBoard, dictionary, letters); ScrabbleCheater.Solver solve = new Solver(board); board.PlaceLetter("a", 1, 11); board.PlaceLetter("a", 1, 10); List <string> hand = new List <string>() { "a", "a", "m", "n", "n", "y" }; int[] pos = new int[2]; pos[0] = 0; pos[1] = 5; List <Move> moves = solve.GetMovesInArray(board, hand, board.GetCol(0), true, 0); bool passed = false; foreach (Move move in moves) { if (move.GetWord().Equals("aa") && move.GetPosition()[0] == 0 && move.GetPosition()[1] == 10) { passed = true; } } Assert.IsTrue(passed); passed = false; moves = solve.GetMovesInArray(board, hand, board.GetRow(10), false, 11); foreach (Move move in moves) { if (move.GetWord().Equals("nay") && move.GetPosition()[0] == 0 && move.GetPosition()[1] == 11) { passed = true; } System.Diagnostics.Debug.WriteLine(move.ToString()); } Assert.IsTrue(passed); }
internal ScrabbleBoard Clone() { ScrabbleBoard S = new ScrabbleBoard(); S.Name = this.Name; S.Reference = this.Reference; S.Bot = this.Bot; S.Cells = (string[])this.Cells.Clone(); S.Vowels = this.Vowels; S.Conso = this.Conso; S.Special = this.Special; return(S); }
public static void Run() { ScrabbleBoard Board = new ScrabbleBoard { Reference = "123", Name = "te.11x11", Bot = "bbc.te", Cells = new string[] { "వ", "స,ఈ", "", "", "", "", "", "", "", "", "", "", "జ,ఏ", "", "", "", "", "", "", "", "", "", "", "క,ఉ", "ల,ఆ", "ల,ఉ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }, //Vowels = "అ ఆ ఈ ఉ ఉ ఎ ఏ ఓ", //Conso = "క ఙ చ జ ప ల స వ", //Vowels = "అ ఆ ఉ ఎ ఓ", //Conso = "ఙ చ ప ల స వ", Vowels = "అ ఉ ఎ ఓ", Conso = "ఙ చ ప స వ", Special = "(క,ష)" //Special = "(ల,ఉ) (క,ష)" }; Scores Scores = new Scores { MyScore = 12, OppScore = 7 }; Game game = new Game { Board = Board, Scores = Scores }; new ABP().Run(game); }
internal static void Go(params string[] args) { for (int i = 0; i < 1; i++) { var Board = new ScrabbleBoard { Reference = "281", Name = "11x11", Bot = "eenadu", Cells = new string[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "క,ష", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }, Vowels = "ఒ ఒ ౠ ౠ ఔ అ ః ఎ ఆ ం ఆ", Conso = "భ డ ష ఱ థ ష హ ర", Special = "(ల,ఉ) (క,ష) " }; using (new Watcher("Iteration#" + (i + 1))) { var R = new RegexEngine(Board); var List = R.Probables(); } //using (new Watcher("Original: Iteration#" + (i + 1))) //{ // var R = new Runner(Board); // var List = R.Probables(); //} } }
public void GetBestPlayTest2() { Dictionary <string, int> letters = new Dictionary <string, int>() { { "a", 1 }, { "b", 4 }, { "c", 4 }, { "d", 2 }, { "e", 1 }, { "f", 4 }, { "g", 3 }, { "h", 3 }, { "i", 1 }, { "j", 10 }, { "k", 5 }, { "l", 2 }, { "m", 4 }, { "n", 2 }, { "o", 1 }, { "p", 4 }, { "q", 10 }, { "r", 1 }, { "s", 1 }, { "t", 1 }, { "u", 2 }, { "v", 5 }, { "w", 4 }, { "x", 8 }, { "y", 3 }, { "z", 10 }, }; string[,] baseBoard = new string[15, 15]; string[] lines = System.IO.File.ReadAllLines("WWFDictionary.txt"); List <string> dictionary = new List <string>(); foreach (string s in lines) { dictionary.Add(s); } ScrabbleBoard board = new ScrabbleBoard(baseBoard, dictionary, letters); ScrabbleCheater.Solver solve = new Solver(board); board.PlaceLetter("d", 4, 14); board.PlaceLetter("o", 5, 14); board.PlaceLetter("n", 6, 14); board.PlaceLetter("n", 7, 14); board.PlaceLetter("a", 8, 14); board.PlaceLetter("s", 9, 14); board.PlaceLetter("r", 5, 13); board.PlaceLetter("u", 9, 13); board.PlaceLetter("g", 5, 12); board.PlaceLetter("l", 9, 12); board.PlaceLetter("d", 0, 11); board.PlaceLetter("r", 1, 11); board.PlaceLetter("e", 2, 11); board.PlaceLetter("a", 3, 11); board.PlaceLetter("m", 4, 11); board.PlaceLetter("y", 5, 11); board.PlaceLetter("f", 9, 11); board.PlaceLetter("l", 8, 10); board.PlaceLetter("a", 9, 10); board.PlaceLetter("s", 10, 10); board.PlaceLetter("t", 11, 10); board.PlaceLetter("i", 11, 9); board.PlaceLetter("h", 11, 8); board.PlaceLetter("e", 11, 8); board.PlaceLetter("v", 1, 7); board.PlaceLetter("a", 2, 7); board.PlaceLetter("g", 3, 7); board.PlaceLetter("i", 4, 7); board.PlaceLetter("v", 7, 7); board.PlaceLetter("i", 8, 7); board.PlaceLetter("s", 9, 7); board.PlaceLetter("a", 10, 7); board.PlaceLetter("s", 11, 7); board.PlaceLetter("l", 4, 6); board.PlaceLetter("i", 7, 6); board.PlaceLetter("h", 9, 6); board.PlaceLetter("t", 4, 5); board.PlaceLetter("h", 5, 5); board.PlaceLetter("u", 6, 5); board.PlaceLetter("d", 7, 5); board.PlaceLetter("i", 9, 5); board.PlaceLetter("r", 12, 5); board.PlaceLetter("e", 7, 4); board.PlaceLetter("p", 9, 4); board.PlaceLetter("i", 10, 4); board.PlaceLetter("t", 11, 4); board.PlaceLetter("a", 12, 4); board.PlaceLetter("b", 6, 3); board.PlaceLetter("o", 7, 3); board.PlaceLetter("x", 8, 3); board.PlaceLetter("r", 12, 3); board.PlaceLetter("i", 6, 2); board.PlaceLetter("e", 12, 2); board.PlaceLetter("o", 5, 1); board.PlaceLetter("d", 6, 1); board.PlaceLetter("e", 7, 1); board.PlaceLetter("k", 1, 0); board.PlaceLetter("a", 2, 0); board.PlaceLetter("u", 3, 0); board.PlaceLetter("r", 4, 0); board.PlaceLetter("i", 5, 0); List <string> hand = new List <string>() { "z", "o", "n", "y", "n", "f", "e" }; int[] pos = new int[2]; pos[0] = 0; pos[1] = 5; List <Move> moves = solve.GetMovesInArray(board, hand, board.GetCol(0), true, 0); Move best = solve.GetBestPlay(board, hand); System.Diagnostics.Debug.WriteLine(best.ToString()); Assert.IsTrue(best.GetWord().Equals("fozy")); }
static int WS = 2; //Skip Memorizing Words with Syllables Length upto. public RegexV2Engine(ScrabbleBoard Board) : base(Board) { }