Example #1
0
        public static List <PositionCommand> Execute(Guid turnamentId)
        {
            var positionCommands = new List <PositionCommand>();

            var positions = DbHelper.GetPositionCommand(turnamentId);

            positions.Sort((a, b) => a.place <= b.place ? -1 : 1);

            if (positions.Any())
            {
                foreach (var element in positions)
                {
                    var position = new PositionCommand
                    {
                        Id          = element.id_position_command_for_turnament.ToString(),
                        CommandName = element.command_name,
                        Position    = element.position,
                        CommandId   = element.id_account.ToString(),
                        Place       = element.place,
                        Points      = element.points,
                        FakeCode    = element.fake_code
                    };

                    positionCommands.Add(position);
                }
                ;
            }
            ;

            return(positionCommands);
        }
        public void ShouldMoveToInitialPosition()
        {
            var robot   = new Robot(new Office(), null, null);
            var command = new PositionCommand("1 1");

            command.Execute(robot);

            Assert.That(robot.Position.X, Is.EqualTo(1));
            Assert.That(robot.Position.Y, Is.EqualTo(1));
        }
    public void UndoCommand(BaseCommand command)
    {
        switch (command.TargetId)
        {
        case 0:
            MoveCommand move = (MoveCommand)command;
            //transform.position += (transform.forward * move.MoveY + transform.right * move.MoveX) / 60f;
            _velocity -= (Vector3.forward * move.MoveY + Vector3.right * move.MoveX) / 30f;
            LookAtTarget();
            break;

        case 1:
            PositionCommand pos = (PositionCommand)command;
            SetTarget(pos.Position);
            LookAtTarget();
            break;
        }
    }
Example #4
0
        public UciClient(InteractiveConsole interactiveConsole)
        {
            BoardState = new BoardState();
            BoardState.SetDefaultState();

            _interactiveConsole = interactiveConsole;

#if UCI_DEBUG_OUTPUT
            _debugMode = true;
#endif

            _commands               = new Dictionary <string, IUciCommand>();
            _commands["quit"]       = new QuitCommand(this);
            _commands["setoption"]  = new SetOptionCommand(this);
            _commands["isready"]    = new IsReadyCommand(this);
            _commands["ucinewgame"] = new UciNewGameCommand(this);
            _commands["position"]   = new PositionCommand(this);
            _commands["debug"]      = new DebugCommand(this);
            _commands["go"]         = new GoCommand(this);
            _commands["stop"]       = new StopCommand(this);

            IterativeDeepening.OnSearchUpdate += OnSearchUpdate;
        }