Ejemplo n.º 1
0
 private void LoadGame(LoadLocation load)
 {
     game[load.Location.Xpos, load.Location.Ypos] = new CellContent(load.Rank);
 }
Ejemplo n.º 2
0
        public void LoadDemo()
        {
            ClearAll();
            game.ClearSodoku();
            // TODO this will have to be loaded via the Game Logic

            List <LoadLocation> loadSet = new List <LoadLocation>();

            LoadLocation load = new LoadLocation {
                Rank = 5, Location = new GridLocation {
                    Xpos = 1, Ypos = 0
                }
            };

            loadSet.Add(load);
            LoadGame(load);

            // row 0
            load = new LoadLocation {
                Rank = 2, Location = new GridLocation {
                    Xpos = 2, Ypos = 0
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 7, Location = new GridLocation {
                    Xpos = 4, Ypos = 0
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 1
            load = new LoadLocation {
                Rank = 4, Location = new GridLocation {
                    Xpos = 0, Ypos = 1
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 1, Location = new GridLocation {
                    Xpos = 8, Ypos = 1
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 2
            load = new LoadLocation {
                Rank = 1, Location = new GridLocation {
                    Xpos = 0, Ypos = 2
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 2, Location = new GridLocation {
                    Xpos = 3, Ypos = 2
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 7, Location = new GridLocation {
                    Xpos = 6, Ypos = 2
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 9, Location = new GridLocation {
                    Xpos = 7, Ypos = 2
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 5, Location = new GridLocation {
                    Xpos = 8, Ypos = 2
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 3
            load = new LoadLocation {
                Rank = 1, Location = new GridLocation {
                    Xpos = 1, Ypos = 3
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 3, Location = new GridLocation {
                    Xpos = 5, Ypos = 3
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 4
            load = new LoadLocation {
                Rank = 6, Location = new GridLocation {
                    Xpos = 0, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 4, Location = new GridLocation {
                    Xpos = 2, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 5, Location = new GridLocation {
                    Xpos = 3, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 9, Location = new GridLocation {
                    Xpos = 5, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 1, Location = new GridLocation {
                    Xpos = 6, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 7, Location = new GridLocation {
                    Xpos = 8, Ypos = 4
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 5
            load = new LoadLocation {
                Rank = 6, Location = new GridLocation {
                    Xpos = 3, Ypos = 5
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 5, Location = new GridLocation {
                    Xpos = 7, Ypos = 5
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 6
            load = new LoadLocation {
                Rank = 5, Location = new GridLocation {
                    Xpos = 0, Ypos = 6
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 8, Location = new GridLocation {
                    Xpos = 1, Ypos = 6
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 9, Location = new GridLocation {
                    Xpos = 2, Ypos = 6
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 7, Location = new GridLocation {
                    Xpos = 5, Ypos = 6
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 4, Location = new GridLocation {
                    Xpos = 8, Ypos = 6
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 7
            load = new LoadLocation {
                Rank = 2, Location = new GridLocation {
                    Xpos = 0, Ypos = 7
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 3, Location = new GridLocation {
                    Xpos = 8, Ypos = 7
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            // row 8
            load = new LoadLocation {
                Rank = 2, Location = new GridLocation {
                    Xpos = 4, Ypos = 8
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 9, Location = new GridLocation {
                    Xpos = 6, Ypos = 8
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            load = new LoadLocation {
                Rank = 8, Location = new GridLocation {
                    Xpos = 7, Ypos = 8
                }
            };
            loadSet.Add(load);
            LoadGame(load);

            SodokuBoard.LoadGrid(loadSet);
            LoadAvailableMoves();
        }