Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 16th, 2007, 9:39 PM   #1
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 417
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Question Generating a crossword puzzle

I am working on a crossword puzzle game. I have to read in a file with the clues, the answers and the direction (horizontal | vertical). I have no problem doing that.. What I am having a hard time with is generating the actuall crossword diagram. What would be the best way to generate the crossword board?

So far I am able to create the row columns for the user to select which word they are trying to solve

    1 2 3 4 5
    _ _ _ _ _
A |
B |
C |
D |
E | _ _ _ _ _
What I need to do is have the words displayed as:

     1 2 3 4 5
     _ _ _ _ _
A | t r u e 
B | o   
C | r   
D |
     _ _ _ _ _
Now I am stuck on aligning the words within the "Board". What would be the best way to figure out and keep track of how the words interesct and where they should be displayed.

I know that first I have to find the longest words horizontally and vertically and that is how I can figure out the width and height of the board.

Im looking forward to any ideas you guys have, oh and I am not allowed to use arrays...
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Sep 16th, 2007, 10:01 PM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
This might be a little help to you. Java has System.out.printf() method. It works the same way as C and C++'s printf() function. You could align the chars perfectly with the 'Board'. I don't know the exact way to do it but I've done it before when I made a checkout program in C. I can not find the source code where I've done it so I can't really help you there.

BTW, What the hell is up with your teacher and arrays? Does he/she really hate them that much?
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Sep 16th, 2007, 10:15 PM   #3
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 417
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Aligning the characters isn't the problem.... I have a list of words which some should go horizontally and some should go vertically. I am not sure about how to figure out where the words cross each other and what their positions should be.

LOL, We haven't covered arrays in class yet.. thats why.
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Sep 17th, 2007, 1:53 AM   #4
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,031
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by Wizard1988
LOL, We haven't covered arrays in class yet.. thats why.
Your teacher sounds like an idiot. Not only does he forbid you from getting ahead of what he's covered, but he expects you to do something without the proper tools.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
generating character sequence Gumby Java 12 Jun 14th, 2006 7:46 AM
Making a crossword construction program using Turbo Pascal RedMuse Other Programming Languages 1 Feb 25th, 2006 8:53 AM
it's so easy it's hard puzzle nnxion Coder's Corner Lounge 6 Dec 20th, 2005 1:10 PM
Confused about a random # generating tutorial. linuxpimp20 C 3 Dec 1st, 2005 12:12 PM
problems with generating a random letter conbrio C 26 Jun 28th, 2005 11:09 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC