This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problem checking condition in a loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem checking condition in a loop" Watch "Problem checking condition in a loop" New topic
Author

Problem checking condition in a loop

Darrell Morello
Ranch Hand

Joined: Apr 28, 2005
Posts: 38
Hi all.
I am trying to create a Wordsearch game and having problems in placing words in the grid. Its a 15x15 grid and the problem is trying avoid words overlapping each other and if they do, they share the same character at
the point where they overlap.
They code seems to work sometimes but other times some words are showing up incomplete and it would really help if anyone can show me a better and simpler way to do this. Here is my code.
The words are taken from a class which stores the word as a string, an array of letters and also stores the start and end locations of the word on the grid.

Thanks



[ May 21, 2005: Message edited by: Darrell Morello ]

[ May 21, 2005: Message edited by: Darrell Morello ]
[ May 21, 2005: Message edited by: Darrell Morello ]
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
I can't even read this -- it's far too wide for my monitor. Perhaps you could edit your post to remove the tabs and insert spaces instead? That would make reading it much easier for all of us.

Thanks!


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Darrell Morello
Ranch Hand

Joined: Apr 28, 2005
Posts: 38
I'm sorry but I cant seem to fix it. Maybe the code is too big. Anyway, I've got it now. Changing the while(wordlength>=1).... loop to a do{...}while(wordlength>=1 && checkFit) seems to have fixed it.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem checking condition in a loop
 
Similar Threads
Converting a two dimensional int array into a byte array
Array Testing Output Confusion
Finding the color of a pixel
Structured binary to ascii