private void Setup(string aOriginBoard, string aCards, bool aIsCalculatingRollDice) { m_OriginBoard = aOriginBoard; m_CamelRankManager = new CamelRankManager(m_Boards); m_CasesLandedOn = new int[GameRules.CASE_NUMBER]; SetCamelCard(aCards); CalculateWeightAndCasesLandedOn(); GenerateEvs(aIsCalculatingRollDice); }
private void AddCamelRankManager(List <IBoard> aBoards) { CamelRankManager newManager = new CamelRankManager(aBoards); var t = GetWeight(aBoards); m_CamelRankInfos.Add( new CamelRankInfo { m_CamelRankManager = newManager, m_Proportion = GetProportion(aBoards) }); }
public void TestLongTermBoardAnalyzerRank() { string testBoard = ";;;;;;;;;;;;;;O;B;WY;;G;"; var ltbm = new LongTermBoardAnalyser(new Board(testBoard), null); var actual = ltbm.GetAverageCamelRankInfo(); var bmm = new BoardManager(10); bmm.CreateBoard(testBoard); var rankCamels = new CamelRankManager(bmm.GetAllBoards()).GetCamelRanks; var expected = new Dictionary <char, double[]>(); foreach (var rankCamel in rankCamels) { var rank = new double[5]; for (int i = 0; i < 5; i++) { rank[i] = (double)rankCamel.TimeFinish(i) / rankCamel.m_TotalFinish; } expected.Add(rankCamel.CamelName, rank); } for (int i = 0; i < 5; i++) { var total = 0.0; foreach (var exp in expected) { total += exp.Value[i]; } Assert.IsTrue(Math.Abs(1 - total) < 0.01, i.ToString()); } foreach (var exp in expected) { for (int i = 0; i < exp.Value.Length; i++) { Assert.IsTrue(Math.Abs(exp.Value[i] - actual[exp.Key][i]) < 0.001, String.Format("Camel {0}, position {1}. Exp: {2} Act:{3}", exp.Key, i, exp.Value[i], actual[exp.Key][i])); } } }
private void ClearDictionaries() { m_CamelRankManager = null; m_CamelCards.Clear(); m_Boards.Clear(); }