Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to make a wordsearch game on visual studio with C#. The game must contain a feature that you can save the game till where you are. Then when you open the program again you need to have the option to make a new game or keep going with an existing one so you choose the one you saved and keep going. I have no clue on how to do that

What I have tried:

nothing that i have searched for can help me.
Posted
Updated 16-Apr-20 10:57am

1 solution

We can't tell you "do this" and that'll fix it - we have no idea what you need to save, or how you store it at the moment so we just can't be that specific. But basically what you need to do is write all the information about the current game and the user position in it to a file of some form, and read it back when you restart the application.

There are a huge number of different ways to do this form a basic text file, through XML and JSON, right up to a server based database system, with a huge range of possibilities in between - and which one is "best" depends on a huge range of factors, none of which we have any idea about!

Start by thinking about your game and what information you need to save in order to reload it later - that will probably be the letters on your board plus the words the user is to find, together with a list of words he has found so far and where they are on the board but it's you game, not mine so I have no idea how you are storing this in your app and there may well be more information you need that I'm not aware of.
When you've worked out what you need to store, start thinking about how to store it: start with the simplest method - a text file holding strings you can parse to convert to numbers when you need to - and see if you can fit it into that.
Maybe what you need it so store the board with a line saying how wide and tall it is, then a line for each row:
4,3
HIDE
TADZ
BXTL
Follow that with your words list - again a count of how many first, then a line for each:
3
HIDE
HAT
IT
And so on.

That's not necessarily what you must do, but it's a starter for you to think about. Remember to think about what you will need i order to read it out (hence my adding counts before the data lines so you know how many read back before you start reading them)

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900