• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Problem checking condition in a loop

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic