• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need Help for word game

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Regards,
Rohan
 
Rohan Kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
Rohan
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rohan,
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])
wchf++;

if(wchf==4)
{
for(int l=0;l<4;l++)
{
ch_arr[j+l][k+l]=str[i].charAt(l);
ch_val[j+l][k+l]=1;
}
break;
}
wchf=0;

This is the part of code which i used in my application
Rishi}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic