private void PopulateFinishBoard(BoardDebug aBoard) { if (aBoard.IsCamelReachEnd || aBoard.IsAllCamelRolled) { m_FinishBoard.Add(aBoard); } if (aBoard.m_SubBoard.Count == 0 && aBoard.DicesHistories[0].Length < m_DiceHistoryLenght) { aBoard.PopulateSubBoard(); } foreach (BoardDebug board in aBoard.m_SubBoard) { PopulateFinishBoard(board); } }
private void PopulateBoardByDiceOrder(BoardDebug aBoard) { if (aBoard.GetUnrolledCamelByRank().Length == 0) { string histWihtoutDice = new string(aBoard.DicesHistory.Where(c => !char.IsDigit(c)).ToArray()); if (!m_BoardsByDiceOrder.ContainsKey(histWihtoutDice)) { m_BoardsByDiceOrder.Add(histWihtoutDice, new List <BoardDebug>()); } m_BoardsByDiceOrder[histWihtoutDice].Add(aBoard); } foreach (BoardDebug sub in aBoard.m_SubBoard) { PopulateBoardByDiceOrder(sub); } }
private void CustomTest(string aBoard, string aFileName) { m_BoardsByDiceOrder.Clear(); BoardDebug board = new BoardDebug(aBoard); PopulateFinishBoard(board); PopulateBoardByDiceOrder(board); List <string> list = m_BoardsByDiceOrder.Keys.ToList(); list.Sort(); int diceNumberCount = m_BoardsByDiceOrder[list[0]].Count; List <string> logs = new List <string>(); //i = dice number 1-1-1-1-1 //j = dice order W-O-B-Y-G for (int i = 0; i < diceNumberCount; i++) { string newLog = string.Empty; foreach (string b in list) { if (m_BoardsByDiceOrder[b].Count <= i) { continue; } newLog += m_BoardsByDiceOrder[b][i].ToStringOldCamelUpFormat(); } logs.Add(newLog); } TextWriter tw = new StreamWriter(Directory.GetCurrentDirectory() + aFileName, true); foreach (string log in logs) { tw.WriteLine(log.Remove(log.Length - 2)); } tw.Close(); }
public void CreateBoardDebug(string aBoard) { var t = new BoardDebug(aBoard); CreateBoards(new BoardDebug(aBoard)); }
protected override void CreateSubboard(string aResult, char aUnrollCamel, int aDiceNb) { BoardDebug subBoard = new BoardDebug(this, aResult, aUnrollCamel, GetDiceHistoryUpdated(aUnrollCamel, aDiceNb)); m_SubBoard.Add(subBoard); }
public BoardDebug(Board aInitialBoard, string aPattern, char aRolledCamel, List <string> aDicesHistories) : base(aInitialBoard, aPattern, aRolledCamel, aDicesHistories) { m_ParentBoard = (BoardDebug)aInitialBoard; }