Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function checkPuzzle():void
- {
- var countTrue:int = 0;
- var totalCount:int = 0;
- //Get the total number of non blank spot in puzzle
- for(var y:int=0;y<10;y++)
- {
- for(var x:int=0;x<10;x++)
- {
- if(Registry.puzzleSolutions[x+puzzleSolutionIndex][y+puzzleSolutionIndex] == 1)
- {
- totalCount++;
- }
- }
- }
- //Check to see if the player has recreated the picture correctly
- for(var j:int=0;j<10;j++)
- {
- for(var i:int=0;i<10;i++)
- {
- if(grid[i][j] == 1 && Registry.puzzleSolutions[i+puzzleSolutionIndex][j+puzzleSolutionIndex] == 1)
- {
- countTrue++;
- }
- }
- }
- trace("Total Count True = "+countTrue+" Total Count = "+totalCount);
- if(countTrue == totalCount)
- {
- puzzleComplete = true;
- trace("Puzzle Complete!!");
- }
- }
- *notes - puzzleSolutionIndex is 0.
- Inside the Registry.as I have
- puzzleSolutions = [[0,0,0,0,0,0,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,1,1,1,1,1,0,0],
- [0,1,1,0,1,1,0,1,1,0],
- [0,1,1,0,1,1,0,1,1,0],
- [0,1,1,1,1,1,1,1,1,0],
- [0,1,0,1,1,1,1,0,1,0],
- [0,0,1,0,0,0,0,1,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,0,0,0,0,0,0,0,0],
- [0,0,0,0,0,1,1,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,0,0,0,1,1,0,0,1],
- [0,0,1,1,1,0,1,1,1,0],
- [0,1,1,0,1,1,1,0,0,0],
- [0,1,1,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,0,0,0,0],
- [0,0,1,1,0,1,1,0,0,0],
- [0,0,1,0,0,0,1,1,1,0],
- [0,1,1,0,0,0,0,0,1,0],
- [0,0,0,1,0,0,0,0,0,0],
- [0,1,1,1,0,0,0,0,1,1],
- [0,1,0,1,0,0,0,0,1,0],
- [1,1,1,1,1,1,1,1,1,0],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,1,1,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,1,1,1,1,1,0,0],
- [0,1,1,1,1,1,1,1,1,0],
- [1,1,1,1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1,1,1,1],
- [0,1,1,1,1,1,1,1,1,0],
- [0,0,1,1,1,1,1,1,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,1,1,1,1,1,0,0],
- [0,1,1,1,1,1,1,1,1,0],
- [1,1,1,1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1,1,1,1],
- [1,1,0,0,1,1,0,0,1,1],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,1,1,0,1,1,0,1,1,0],
- [1,1,1,1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1,1,1,1],
- [0,1,1,0,1,1,0,1,1,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0]];
Advertisement
Add Comment
Please, Sign In to add comment