Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
905 B
0
Indexable
Never
using Piskvorky_JanNeuC3a;
using System;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;

namespace Piskvorky_JanNeuC3a
{
    class HumanPlayer : Player
    {

        private CancellationTokenSource _cts;


        protected override Task MakeTurnAsync()
        {
            _cts = new CancellationTokenSource();

            var token = _cts.Token;

            var task = Task.Factory.StartNew(
                () =>
                {
                    while (true)
                    {
                        if (token.IsCancellationRequested)
                        {
                            break;
                        }
                    }
                }
            );

            return task;
        }


        public override void OnPlayerMoved()
        {
            _cts?.Cancel();
        }
    }
}