• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem checking condition in a loop

 
Darrell Morello
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Darrell Morello
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic