luness
Npuzzle
Hi! im pretty new to programming so im wondering if someone could help me out! I got this comment from my teacher regarding my code " The StartGame() method in Board is buggy. I suggest to replace it with a constructor for the class Board which takes the parameter Size as input. The in the Main function you can just create an instance of a given size without asking to the player.", ive tried to fix it by creating the construction and changing the program.cs file however the program seems not to work as it should everytime.
3 replies
❔ The method startgame() is buggy, replace it with a constructor that takes size as parameter
Hi, i got this message from my teacher: "The StartGame() method in Board is buggy. I suggest to replace it with a constructor for the class Board which takes the parameter Size as input. The in the Main function you can just create an instance of a given size without asking to the player."
However I dont know what he means by that, down below i've listed my two classes that he wants me to make the changes in. And i have also made some changes and marked it with //changed...
I appreciate any help!
https://pastebin.com/spGSB32Z - My board class
https://pastebin.com/xBZARHM9 - my main class
19 replies
❔ Getting multiple output of my count in this code:https://pastebin.com/c7RsL47e
When i try to solve my puzzle with size 2 and i manage to solve it in 3 steps it prints out like this in console : "It took 3 steps to solve the puzzle
It took 0 steps to solve the puzzle
It took 0 steps to solve the puzzle"
why?
7 replies
❔ N puzzle giving color to each number
Hi, I have coded this this n puzzle game and I want to give the numbers different colors. How can I do that?
This is my code: https://pastebin.com/dNU55Psb
3 replies
❔ System.IndexOutOfRangeException has been thrown"Index was outside the bounds of the array."
Hi I get this message at the line " Tile temp = Tiles[x, y]; " in my SwapTiles method when im trying to move around the tiles.
Here's my code: https://pastebin.com/BbVvEC3V
I appreciate any help
7 replies
❔ Error message when trying to move direction for my tiles in a N-puzzle
Hi! I get this error message when trying to move around my tiles in my N puzzle "System.IndexOutOfRangeException has been thrown "Index was outside the bounds of the array." The error occurs in this line of code "Tile temp = Tiles[x, y];" in swaptiles method. Heres is my code: https://hatebin.com/
44 replies