Пример #1
0
        public void Update(int iteration, World world, Bumpership bumpership)
        {
            Vector accelerate = new Vector((float)random.NextDouble() * 6 - 3, (float)random.NextDouble() * 6 - 3);

            accelerate.Normalize();
            if (random.Next(0, 12) > 1)
            {
                accelerate = bumpership.Velocity;
            }
            bumpership.Move(accelerate);
        }
Пример #2
0
        private void ParseMessage(string messageReceived, Bumpership player)
        {
            string[] message = messageReceived.Split(separators, StringSplitOptions.RemoveEmptyEntries);

            foreach (KeyValuePair <string, string> line in GetLines(message))
            {
                if (state == null)
                {
                    continue;
                }

                if (line.Key.Equals("ACCELERATION"))
                {
                    player.Move(ParseVector(line.Value));
                    SendMessage("OK\n");
                }

                if (line.Key.Equals("GET_STATE"))
                {
                    SendMessage(StateProtocol.Create(state.player, state.world, state.iteration));
                }
            }
        }
Пример #3
0
        private void ParseMessage(string messageReceived, Bumpership player)
        {
            string[] message = messageReceived.Split(separators, StringSplitOptions.RemoveEmptyEntries);

            foreach (KeyValuePair<string, string> line in GetLines(message))
            {
                if (state == null)
                    continue;

                if (line.Key.Equals("ACCELERATION"))
                {
                    player.Move(ParseVector(line.Value));
                    SendMessage("OK\n");
                }

                if (line.Key.Equals("GET_STATE"))
                    SendMessage(StateProtocol.Create(state.player, state.world, state.iteration));
            }
        }