Beispiel #1
0
 public CalculatorApplicationNode(ITestObject parent, AppModelBase applicationModel) : base(parent, applicationModel)
 {
     Zero  = new ZeroNode(this, applicationModel);
     Plus  = new PlusNode(this, applicationModel);
     Seven = new SevenNode(this, applicationModel);
     MobileObjectUiObject = new MobileObjectUiObjectNode(this, applicationModel);
     DisplayName          = @"Calculator";
 }
Beispiel #2
0
        private void SetupGameMap()
        {
            Dictionary <int, List <int> > xyCords = new Dictionary <int, List <int> >();

            for (int i = 0; i < _bombs; i++)
            {
                AddCord(xyCords);
            }

            for (int i = 0; i < xDimension; i++)
            {
                for (int j = 0; j < yDimension; j++)
                {
                    if (gameMap[i, j] == null)
                    {
                        gameMap[i, j] = new ZeroNode(i, j);
                    }
                }
            }

            void AddCord(Dictionary <int, List <int> > xyCord)
            {
                int x = rand.Next(0, xDimension);
                int y = rand.Next(0, yDimension);

                if (xyCord.ContainsKey(x))
                {
                    if (xyCord[x].Contains(y))
                    {
                        AddCord(xyCord);
                    }
                    else
                    {
                        xyCord[x].Add(y);
                        gameMap[x, y] = new BombNode(x, y);
                    }
                }
                else
                {
                    xyCord.Add(x, new List <int>()
                    {
                        y
                    });
                    gameMap[x, y] = new BombNode(x, y);
                }
            }
        }