public override ActionType GetBestAction(Game game) { ActionType a1 = primary.GetBestAction(game); ActionType a2 = secondary.GetBestAction(game); if (a1 != a2 && !IsDiff) { List <ActionEv> l1 = primary.GetActions(game); List <ActionEv> l2 = secondary.GetActions(game); int m = 0; if (l1 != null) { m = l1.Count; } if (l2 != null && l2.Count > m) { m = l2.Count; } Console.WriteLine("STRATEGY MISMATCH"); Console.WriteLine(); Console.WriteLine(game.ToString()); Console.WriteLine(string.Format("{0,-25} {1,-25}", primary.GetType(), secondary.GetType())); Console.WriteLine(); Console.WriteLine(string.Format("{0,-25} {1,-25}", a1, a2)); Console.WriteLine(); for (int i = 0; i < m; i++) { ActionEv e1 = new ActionEv(), e2 = new ActionEv(); if (l1 != null && i < l1.Count) { e1 = l1[i]; } if (l2 != null && i < l2.Count) { e2 = l2[i]; } Console.WriteLine(string.Format("{0,-25} {1,-25}", e1, e2)); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); } return(a1); }
public override ActionType GetBestAction(Game game) { ActionType a1 = primary.GetBestAction(game); ActionType a2 = secondary.GetBestAction(game); if (a1 != a2 && !IsDiff) { List<ActionEv> l1 = primary.GetActions(game); List<ActionEv> l2 = secondary.GetActions(game); int m = 0; if (l1 != null) m = l1.Count; if (l2 != null && l2.Count > m) m = l2.Count; Console.WriteLine("STRATEGY MISMATCH"); Console.WriteLine(); Console.WriteLine(game.ToString()); Console.WriteLine(string.Format("{0,-25} {1,-25}", primary.GetType(), secondary.GetType())); Console.WriteLine(); Console.WriteLine(string.Format("{0,-25} {1,-25}", a1, a2)); Console.WriteLine(); for (int i = 0; i < m; i++) { ActionEv e1 = new ActionEv(), e2 = new ActionEv(); if (l1 != null && i < l1.Count) e1 = l1[i]; if (l2 != null && i < l2.Count) e2 = l2[i]; Console.WriteLine(string.Format("{0,-25} {1,-25}", e1, e2)); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); } return a1; }
private ActionEv Ev(string action) { ActionEv action_ev = new ActionEv(); shell.StandardInput.WriteLine(action); string line = shell.StandardOutput.ReadLine(); string[] param = line.Split(new char[] { ' ' }); action_ev.Ev = double.Parse(param[1]); if (param[0] == "Surrender") { action_ev.Action = ActionType.Surrender; } else if (param[0] == "Hit") { action_ev.Action = ActionType.Hit; } else if (param[0] == "Stand") { action_ev.Action = ActionType.Stand; } else if (param[0] == "Double") { action_ev.Action = ActionType.Double; } else if (param[0] == "Split") { action_ev.Action = ActionType.Split; } else { Console.WriteLine("OU OU"); } return(action_ev); }
private List<ActionEv> Evaluate(Card upcard, Hand hand) { shell.StandardInput.WriteLine(upcard.PointValue); shell.StandardInput.WriteLine(hand.Count); foreach (Card card in hand) shell.StandardInput.WriteLine(card.PointValue); string line = ""; List<ActionEv> actions = new List<ActionEv>(); while (true) { line = shell.StandardOutput.ReadLine(); if (line.StartsWith("done")) break; ActionEv action_ev = new ActionEv(); string[] param = line.Split(new char[] { ' ' }); action_ev.Ev = double.Parse(param[1]); if (param[0] == "Surrender") action_ev.Action = ActionType.Surrender; else if (param[0] == "Hit") action_ev.Action = ActionType.Hit; else if (param[0] == "Stand") action_ev.Action = ActionType.Stand; else if (param[0] == "Double") action_ev.Action = ActionType.Double; else if (param[0] == "Split") action_ev.Action = ActionType.Split; else Console.WriteLine("BIG F*****G UPS!!!!!"); actions.Add(action_ev); } actions.Sort(delegate(ActionEv ae1, ActionEv ae2) { return ae2.Ev.CompareTo(ae1.Ev); }); /*Console.WriteLine("Upcard: " + upcard + " Hand: " + hand); foreach (ActionEv ae in actions) Console.WriteLine(ae.Action + " " + ae.Ev); Console.ReadKey();*/ return actions; }
private List <ActionEv> Evaluate(Card upcard, Hand hand) { shell.StandardInput.WriteLine(upcard.PointValue); shell.StandardInput.WriteLine(hand.Count); foreach (Card card in hand) { shell.StandardInput.WriteLine(card.PointValue); } string line = ""; List <ActionEv> actions = new List <ActionEv>(); while (true) { line = shell.StandardOutput.ReadLine(); if (line.StartsWith("done")) { break; } ActionEv action_ev = new ActionEv(); string[] param = line.Split(new char[] { ' ' }); action_ev.Ev = double.Parse(param[1]); if (param[0] == "Surrender") { action_ev.Action = ActionType.Surrender; } else if (param[0] == "Hit") { action_ev.Action = ActionType.Hit; } else if (param[0] == "Stand") { action_ev.Action = ActionType.Stand; } else if (param[0] == "Double") { action_ev.Action = ActionType.Double; } else if (param[0] == "Split") { action_ev.Action = ActionType.Split; } else { Console.WriteLine("BIG F*****G UPS!!!!!"); } actions.Add(action_ev); } actions.Sort(delegate(ActionEv ae1, ActionEv ae2) { return(ae2.Ev.CompareTo(ae1.Ev)); }); /*Console.WriteLine("Upcard: " + upcard + " Hand: " + hand); * foreach (ActionEv ae in actions) * Console.WriteLine(ae.Action + " " + ae.Ev); * Console.ReadKey();*/ return(actions); }
private ActionEv Ev(string action) { ActionEv action_ev = new ActionEv(); shell.StandardInput.WriteLine(action); string line = shell.StandardOutput.ReadLine(); string[] param = line.Split(new char[] { ' ' }); action_ev.Ev = double.Parse(param[1]); if (param[0] == "Surrender") action_ev.Action = ActionType.Surrender; else if (param[0] == "Hit") action_ev.Action = ActionType.Hit; else if (param[0] == "Stand") action_ev.Action = ActionType.Stand; else if (param[0] == "Double") action_ev.Action = ActionType.Double; else if (param[0] == "Split") action_ev.Action = ActionType.Split; else Console.WriteLine("OU OU"); return action_ev; }