Time for action – putting it all together
Follow the given steps:
- Create a Windows application. Call it
TilO
. - Add nine button controls. Also add one
label
control and onepictureBox
control, as shown in the following screenshot. Add large borders to buttons ("10"), make them flat, and name them as follows: - Add the following variables in the
Form1.cs
:bool mute = false; int totalMoves = 0; List<Tuple<int, int, int>> board = new List<Tuple<int, int, int>>(); Dictionary<int, Button> buttons = new Dictionary<int, Button>();
- Add the following methods to draw the
board
properly. You can customize the colors:private void DrawBoard() { int emptyIsAt = board.First(t ...
Get .NET 4.0 Generics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.