コード例 #1
0
ファイル: Player.cs プロジェクト: partytitan/Zeeslag
        private Coordinates SearchingShot()
        {
            Random rand         = new Random(Guid.NewGuid().GetHashCode());
            var    hitNeighbors = ShotBoard.GetShotNeighbors();
            var    neighborID   = rand.Next(hitNeighbors.Count);

            return(hitNeighbors[neighborID]);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: partytitan/Zeeslag
        public Coordinates FireShot()
        {
            var ShotNeigbors = ShotBoard.GetShotNeighbors();

            Coordinates coordinates;

            if (ShotNeigbors.Any())
            {
                coordinates = SearchingShot();
            }
            else
            {
                coordinates = RandomShot();
            }
            return(coordinates);
        }