public void Test_ToStrategicString() { ChanceTreeNode d0 = new ChanceTreeNode { Position = 0, Card = 1 }; ChanceTreeNode d1 = new ChanceTreeNode { Position = 1, Card = 22 }; ActionTreeNode p0 = new ActionTreeNode { Position = 0, Amount = 5.3 }; ActionTreeNode p1 = new ActionTreeNode { Position = 1, Amount = 3.2 }; IStrategicAction [] actions = new IStrategicAction [] { d0, d1, p0, p1 }; string s = StrategicString.ToStrategicString(actions, null); Assert.AreEqual("0d1 1d22 0p5.3 1p3.2", s); }
/// <summary> /// Update by a strategic action. /// </summary> public StrategicState GetNextState(IStrategicAction action) { StrategicState next = CreateNextState(); IPlayerAction pa = action as IPlayerAction; if (pa != null) { UpdateAmount(next, pa.Position, pa.Amount); IActionTreeNode an = pa as IActionTreeNode; if (an != null) { next.ActivePlayers = an.ActivePlayers; } } else { IDealerAction da = action as IDealerAction; UpdateHand(next, da.Position, da.Card); } return(next); }