コード例 #1
0
        static void Main(string[] args)
        {
            Program p = new Program();

            p.Run((client) =>
            {
                MockSolverBase solver = new MockSolverBase(client);
                solver.Setup();
                return(solver);
            });
        }
コード例 #2
0
 void ProcessSolver(MockSolverBase solver, int id)
 {
     client.SetConnection(id);
     solver.NewTurn();
     client.Wait();
     if (client.TurnsLeft() == 0)
     {
         client.Wait();
         solver = new MockSolverBase(client);
         solver.Setup();
     }
 }
コード例 #3
0
        public void Run(Func <IServer, MockSolverBase> newSolver)
        {
            this.newSolver = newSolver;

            client.SetConnection(0);
            MockSolverBase solver = this.newSolver(client);

            System.Threading.Thread.Sleep(1000); // so SOLVER random is different

            client.SetConnection(1);
            MockSolverBase solver2 = this.newSolver(client);

            while (true)
            {
                client.WhatsUp();

                ProcessSolver(solver, 0);
                ProcessSolver(solver2, 1);

                client.ProcessTurn();
                System.Threading.Thread.Sleep(800);
            }
        }