コード例 #1
0
ファイル: ChessForm.cs プロジェクト: hcesar/Chess
        public TestContainer StartTest(Participant participant)
        {
            this.currentParticipant = participant;
            var mouseSensor = new Sensors.MouseSensor(this.boardControl);
            var eyeTrackerSensor = new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.boardControl);
            var sensorContainer = new Sensors.SensorContainer(mouseSensor, eyeTrackerSensor);

            var test = this.tests[0];
            var orchestrator = test.GetOrchestrator(this.sidePlayer, this.boardControl, this.currentParticipant.Id, sensorContainer);
            orchestrator.Finished += (sender, result) => { currentParticipant.Tests.Add(result); this.ShowTest(int.MaxValue); };
            orchestrator.Start();

            return new TestContainer(orchestrator, sensorContainer);
        }
コード例 #2
0
ファイル: AdHocOrchestrator.cs プロジェクト: hcesar/Chess
        public void StartInternal()
        {
            int moves = test.PlayerMoves;
            if (moves == 0)
                moves = int.MaxValue;

            var board = this.BoardControl.StartNew(test.GetPlayer(PlayerColor.White), test.GetPlayer(PlayerColor.Black), test.FEN);

            var mouseSensor = new Sensors.MouseSensor(this.BoardControl);
            this.sensorContainer = new Sensors.SensorContainer(mouseSensor, new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.BoardControl));
            this.fileName = "recorded-files\\" + Guid.NewGuid() + ".chess";
            this.writer = new IO.ChessStreamWriter(board, sensorContainer, fileName);

            board.PieceMoved += move => { if (board.CurrentPlayer.PlayerColor == PlayerColor.White) return; moves--; if (moves == 0) this.Finish(board); };
            board.Start();
            this.stopWatch = System.Diagnostics.Stopwatch.StartNew();
        }
コード例 #3
0
ファイル: ChessForm.cs プロジェクト: hcesar/Chess
        private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var config = NewGameForm.Show(this);
            if (config == null)
                return;

            if (spectatorServer != null)
                ((IDisposable)spectatorServer).Dispose();

            var board = this.boardControl.StartNew(config.White, config.Black);

            var mouseSensor = new Sensors.MouseSensor(this.boardControl);
            var eyeTrackerSensor = new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.boardControl);
            var sensorContainer = new Sensors.SensorContainer(mouseSensor, eyeTrackerSensor);

            var output = new ProxiedMemoryStream(File.Create(DateTime.Now.ToString("yyyMMddmmss") + ".chess"));
            spectatorServer = new SpectatorServer(board, sensorContainer);
            var writer = new IO.ChessStreamWriter(board, sensorContainer, output);

            if (config.White.IsReady && config.Black.IsReady)
                board.Start();
            else
                this.boardControl.ShowMessage("Waiting for remote player", board.Start, () => config.White.IsReady && config.Black.IsReady);
        }