private static Boolean BotIsVisible(Bot bot, BotProperties botProperties)
        {
            var result = false;

            switch (botProperties.Orientation)
            {
            case PossibleOrientations.North:
                result = bot.Y < botProperties.Y;
                break;

            case PossibleOrientations.East:
                result = bot.X > botProperties.X;
                break;

            case PossibleOrientations.South:
                result = bot.Y > botProperties.Y;
                break;

            case PossibleOrientations.West:
                result = bot.X < botProperties.X;
                break;
            }

            return(result);
        }
Example #2
0
        public static Vision Build(BotProperties botProperties)
        {
            var vision = new Vision();

            foreach (var bot in botProperties.Bots)
            {
                if (bot.Id != botProperties.BotId && BotIsVisible(bot, botProperties))
                {
                    vision.Bots.Add(bot);
                    if (bot.PlayerName == botProperties.PlayerName)
                    {
                        vision.FriendlyBots.Add(bot);
                    }
                    else
                    {
                        vision.EnemyBots.Add(bot);
                    }
                }
            }

            return(vision);
        }