• 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Need Help for word game  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am a student and learning j2me right now, I am working on a simple application wordgame in j2me but have some problem while filling up the matrix in starting.
Description of the program :
Program screen will have a 5*5 matrix devided into rows and columns. so it will contain 5 rows and 5 columns in each row at the screen and in this way we can show 25 characters in the cells on the screen.
Now i have words in an array, some words are of 5 characters and other have characters less then 5.
Now problem is how to fill this matrices with the words given in the array dynamically. Means i want everytime whenever the program will be run matrices will be filled by the characters (one character in each cell) and some words of the array will be hidden into this matrices.
User will have to search that words inside this matrices.
Now words may be filled
Horizontly, vertically, or diagonally.
Being a beginner i am not a good programmer and not able to make a perfact logic for the same.
I have created a logic but the code for that goes for around 150 lines and which creates the problem while running the whole application on real phone as for the further processing i also have to right a lot of code.
Is there anybody who can help me to do it by some simple logic.
Waiting for the reply
Rohan Kumar
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surprised !!
What happened no java guru is ready to help. I thought that somebody will be there in this forum who can help a beginner too.
Waiting for the reply....
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although you should have been raised the same question in bigginers section there you can get the right answer, But for now you can make a simple search on the word wordgame or crossword and you will get a lot of links where you can even find the whole source code for the same application but for the applets not for j2me and then porting it to j2me will not be a big matter for you.
For help i am giving a little code for writing a 4 char word into the matrix in a 5*5 matrix
int wchf=0;
int m=1,n=1;
for(int j=0;j<=m;j++)
{for(int k=0;k<=n;k++)
{for(int l=0;l<4;l++)
if(ch_val[j+l][k+l]==0 || str[i].charAt(l)==ch_arr[j+l][k+l])

for(int l=0;l<4;l++)

This is the part of code which i used in my application
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!