Ejemplo n.º 1
0
        private void LayMinesOnTheBoard(IMineLayingStrategy strategy = null)
        {
            if (strategy == null)
            {
                strategy = new LayRandomMines();
            }

            strategy.Lay(this);
        }
Ejemplo n.º 2
0
        public Board(IMineLayingStrategy strategy = null)
        {
            ColumnNames = "A,B,C,D,E,F,G,H"
                          .Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries)
                          .ToList();

            var lst = new List <Position> ();

            ColumnNames
            .ForEach(x => {
                for (var i = 1; i <= ColumnNames.Count; i++)
                {
                    lst.Add(new Position()
                    {
                        Column = x.ToUpper(), Row = i
                    });
                }
            });

            Squares = lst.ToArray();

            LayMinesOnTheBoard(strategy);
        }