static void Main(string[] args) { try { Log("Client started " + args[0]); var punterName = args[0]; var server = args.Length > 1 ? args[1] : "localhost"; var port = args.Length > 2 ? args[2] : "7777"; var isKonturRu = args.Length > 3; if (isKonturRu) { var interaction = new OnlineInteraction(int.Parse(port)); interaction.Start(); interaction.RunGame((IAi)UberfullessnessAi.All.FirstOrDefault( x => x.Name == "FutureIsNowSetupStrategyoptions-FutureIsNowStrategyoptions-ExtendComponentStrategyoptions-SumGreedyStrategyUberAi") ?? new ConnectClosestMinesAi()); return; } var punter = PunterFactory.Create(punterName); var client = new OnlineClient(punter); client.Start(server, port); Console.ReadLine(); } catch (Exception e) { Log("Error:" + e); throw; } }
public void TestPunterCreation() { //testing the Factory not creating the instances that are not defined //if you don't give proper name based on the defined classes, no instance will be created RunGame.PunterAbstract result = PunterFactory.CreatePunter("John"); Assert.AreEqual(null, result); }
private void AssignRandomBetsToAi(Punter[] punters) { var factory = new PunterFactory(); factory.SetRandomBetAmount(punters); factory.SetRandomBetOnTurtles(punters); }
private void PopulatePunters(Punter[] punters) { var factory = new PunterFactory(); for (int i = 0; i < punters.Length; i++) { punters[i] = factory.GetNewAiPunter(i); } }
public void TestFactoryCreation() { //testing if Factory class is creating proper instances PunterAbstract punter1 = PunterFactory.CreatePunter("test1"); PunterAbstract punter2 = PunterFactory.CreatePunter("test2"); //testing the number of created instances int result = PunterFactory.ReturnCount(); Assert.AreEqual(2, result); }
static void Main(string[] args) { var punterName = args[0]; var punter = PunterFactory.Create(punterName); var log = new ConsoleLog(); var client = new OnlineClient(punter, log); client.Start(); Console.ReadLine(); }
public void AiPunterPopulateTest() { Punter[] punters = new Punter[3]; var factory = new PunterFactory(); for (int i = 0; i < punters.Length; i++) { punters[i] = factory.GetNewAiPunter(i); } Assert.IsNotNull(punters[1].Money); }
public void AiPunterRandomBets() { Punter[] punters1 = new Punter[3]; Punter[] punters2 = new Punter[3]; var factory = new PunterFactory(); for (int i = 0; i < punters1.Length; i++) { punters1[i] = factory.GetNewAiPunter(i); punters2[i] = factory.GetNewAiPunter(i); } factory.SetRandomBetAmount(punters1); factory.SetRandomBetAmount(punters2); // possible equal values due to random number range being not that big Assert.AreNotEqual(punters1[0], punters2[0]); }
static void Main(string[] args) { try { Log("Client started " + args[0]); var punterName = args[0]; var server = args.Length > 1 ? args[1] : "localhost"; var port = args.Length > 2 ? args[2] : "7777"; var punter = PunterFactory.Create(punterName); var client = new OnlineClient(punter); client.Start(server, port); Console.ReadLine(); } catch (Exception e) { Log("Error:" + e); throw; } }