A friendly place for programming greenhorns!
Need Help for word game
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.
Regards,
Rohan
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.
Rohan
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}

This thread has been viewed 1050 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 23, 2018 17:28:36.