private void UpdateTiles(Boards boards) { for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { if (boards.lastmove == i) boardRects[i][j].Fill = new SolidColorBrush(Colors.Yellow); else boardRects[i][j].Fill = new SolidColorBrush( i % 2 == 0 ? filled : Colors.White); boardImages[i][j].Opacity = 1; boardImages[i][j].Source = TryFindResource (boards.GetTile_String(new Move(i, j))) as BitmapImage; } string result = boards.GetWinner_String(i); if(result == "X" || result == "O") { for (int j = 0; j < 9; ++j) boardImages[i][j].Opacity = .33; boardImages[9][i].Source = TryFindResource(result) as BitmapImage; } else { boardImages[9][i].Source = null; } } string winner = boards.GetWinner_String(9); if (winner == " ") { InfoGridUpdate(boards.turn); } else { for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { boardRects[i][j].Fill = new SolidColorBrush(i % 2 == 0 ? filled : Colors.White); } } if (winner == "D") { InfoImage.Source = null; InfoBox.Text = "Game Over: It's a Draw"; } else { InfoImage.Source = TryFindResource(winner) as BitmapImage; InfoBox.Text = "Game Over: " + winner + " Wins"; } } if(lastMove != null && turnToDisplay == game.currentTurn) { boardRects[lastMove.board][lastMove.tile].Fill = new SolidColorBrush(filledOrange); } }