Beispiel #1
0
        private void OnBoardClick(object sender, BoardCellClickEventArgs e)
        {
            if (PastShots.ContainsKey(new Point(e.X, e.Y)))
            {
                return;
            }

            ShotTargetChosen(e.X, e.Y);
        }
Beispiel #2
0
        private void ShootRandom()
        {
            int x;
            int y;

            do
            {
                x = _rnd.Next(0, 10);
                y = _rnd.Next(0, 10);
            } while (PastShots.ContainsKey(new Point(x, y)));

            ShotTargetChosen(x, y);
        }
Beispiel #3
0
 private bool IsValidShot(Point p)
 {
     return(!PastShots.ContainsKey(p) && new Rect(0, 0, 10, 10).Contains(p));
 }