//generates stone colors at the beginning of the game public void GenerateColors() { Random rnd = new Random(); for (int i = 0; i < Triangle.GetLength(0); i++) { for (int j = 0; j < Triangle[i].GetLength(0); j++) { int rand = rnd.Next(StoneColors.Count); Triangle[i][j].Fill = StoneColors[rand].ColorToBrush(); Triangle[i][j].Visibility = System.Windows.Visibility.Visible; StoneColors.RemoveAt(rand); } } }
public Board() { for (int i = 0; i < _stones.Length; i++) { int x = (i % 4) * 2 + ((i / 4) % 2); int y = i / 4; StoneColors color = StoneColors.White; if (i >= 12) { y += 2; color = StoneColors.Black; } _stones[i] = new Stone(x, y, color); } }
public Board() { for (int i = 0; i < 24; i++) { int x = (i % 4) * 2 + ((i / 4) % 2); int y = i / 4; StoneColors color = StoneColors.White; if (i >= 12) { y += 2; color = StoneColors.Black; } _stones.Add(new Stone(x, y, color)); } _stones.SetInitializationFinished(); }
public Stone(int x, int y, StoneColors color) { this.X = x; this.Y = y; this.Color = color; }