Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello everyone,
I am supposed to code a crossword puzzle in c++ in I don't know where to begin.
please help-
Posted
Comments
ZurdoDev 12-Mar-13 7:17am    
What will the UI be like? What classes do you have so far? What have you done?

Where to start? Of course everyone committed to doing a serious job will start by gathering the requirements for the software one intends to write.
You said nothing about the layout, so I'd start by defining how words will be laid out in the grid. Start by thinking about this:

Does a word have a start block in front of it?
Are blocked out matrix elements allowed, or does the whole grid be filled with characters, apart from the starting blocks when they are needed?
Should the word start blocks also be filled with a character of do they only contain the number for the hint and the direction in which the word is to be written?
Should it be possible to write words backwards and how will this be indicated in the grid?

Some other questions of interest:

Dictionaries of words in the language of your preference searchable by word length would come in dandy when trying to construct the grid?
Of what kind are the hints for the player to find the correct words?

First think about what exactly you want/need to do, then think about how this can be solved.
For instance if your grid will remain constrained to 9x9 there will be no need to have words longer than 9 at most in your dictionary.

Regards,

— Manfred
 
Share this answer
 
v2
Comments
Leo Chapiro 12-Mar-13 8:19am    
Very good, +5 !
Manfred Rudolf Bihy 12-Mar-13 8:33am    
Thanks Dude! Have "White Russian" on me ;)
First you have to know some C++ and there are plenty of sites for that. Then consider your program in 3 ways.
What data do you need?
What should the program look like to the user?
What steps does your program need to go through in order to work?

Some things to consider

Clearly you need a 9 * 9 grid with the potential to contain characters. Do you just need one grid or do you need the partially filled in grid and perhaps an answer grid with the correct data in to compare it to?
Do you just need letters or extra data to indicate, black square, white square, square selected by user?

Will the crossword be presented graphically?
Will the clues be presented one at a time or all at once?
Will you let the user interact directly with the grid and fill in individual characters or will they type answers to the clues and then have the answer appear in the grid, if it's right? if it fits? What if it doesn't fit, will you let them know an answer is wrong immediately or at the end?

How will you know when the end of the game has been reached? Will you allow the user to give up? Will you give them a points score for how many they got right or just a tick only if they get them all right?
Will this be a play once game or will you want a 'database' of question sets and grids to keep your users interested.
How will the user choose which question to answer, answer the question, see the result of their answer, find out if they were right or wrong.

By the time you have answers to all these questions you'll have a detailed specification and a very clear idea of what you want to achieve. Then you can break the problem into small pieces and solve one at a time.
Create an outline empty application of the type you need Console, Win32, WinForms, WPF or whatever and make sure it builds and runs with empty or blank output.
Add definitions for the basic data structures, arrays, structs and classes you'll need to store your game data and possibly code to load and save that data if it's not going to be hard coded into the program.
Now you can work on rendering your game board, question wizard or whatever form of UI you choose. Always remember you're drawing the current state of your data, like a single frame of an animation.
Once you can visualise a basic data set you can work on the user interaction, getting answers from the user and changing your data based on what they type, click or select. That's the outline process,
present state of the game data
get input from the user
modify the state of the game data
repeat until your end condition is met.

Good luck and happy programming.
 
Share this answer
 
Comments
Leo Chapiro 12-Mar-13 8:17am    
The words of truth, +5 ! ;)
Manfred Rudolf Bihy 12-Mar-13 8:34am    
You tell'em! 5+

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