Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9188297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:58:21+00:00 2026-06-17T19:58:21+00:00

i made this boggle-type game, and so far it works very well. This method

  • 0

i made this boggle-type game, and so far it works very well. This method here is for searching the 10×10 grid to see if the word the user entered is correct. The problem i have is that this code only works for words that appear left to right, and top to bottom. Now i don’t expect to do diagonal, but i would like to make it to where the words that appear in reverse order are also accepted by the system. I’ve been told that the word that you enter would have to be flipped (reversed) in order to see if it matches properly (which makes sense. After all, you’re looking for a word that is backwords). So exactly how would i achieve this? Now, i’m not very good with coding, so please, if you have time then write down what code i would have to use. Thank you.

public static boolean wordSearch (char[][] table, String search)
       {
           int  ctr = search.length();
           String temp = ""; 

           // LEFT TO RIGHT / X-AXIS
           for (int row = 0; row < 10; row++) //Checks each row (x) one by one
           {
                   for (int a = 0; a <= (10 - ctr); a++)
                   {
                    StringBuilder s = new StringBuilder(10-ctr);//Does... something
                        for (int x = a; x <= (a+ctr-1); x++) //Checks every possibility in the row
                         {
                            s.append(table[row][x]);
                            temp = s.toString();
                            if (temp.equals(search))
                            {
                                return true;
                            }
                         }
                   }
           }
           // TOP TO BOTTOM / Y-AXIS
           for (int column = 0; column < 10; column++)
           {
                   for (int b = 0; b <= (10 - ctr); b++)
                   {
                    StringBuilder v = new StringBuilder(10-ctr);
                        for (int y = b; y <= (b+ctr-1); y++)//checks every possibility in grid
                         {
                            v.append(table[y][column]);
                            temp = v.toString();
                            if (temp.equals(search))
                            {
                                return true;
                            }
                         }
                   }
           }
            return false;//if word isn't in grid it returns as false, which then displays an error message
      }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:58:22+00:00Added an answer on June 17, 2026 at 7:58 pm

    EDIT … the Java version!!! (I have no Java compiler handy right now but I think this is right…)

    At the second line of your code, we compute the reverse string;
    there are thousands of ways to do this, but this one is pretty self-explanatory (I am assuming there is no white space in your string…):

    int ls = search.length();  // length of initial string
    StringBuilder sb = new StringBuilder(); // temporary place to store growing string
    for(int ii=ls-1;ii>=0; ii--) {
            sb.append(search.charAt(ii)); // build the string one character at a time
        }
    hcraes = sb.toString(); // convert to "regular" string
    

    Now, at every point where you have the line

    if (temp.equals(search))
    

    change that line to

    if (temp.equals(search) || temp.equals(hcraes))
    

    that should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made this loader which actually works pretty well. I now want to make
Made this nice little loop for hiding and showing div's, works as a charm
I made this method + (CGFloat) round: (CGFloat)f { int a = f; CGFloat
Made this custom alert box: <script type="text/javascript"> $(function () { var $alert = $('#alert');
I made this code to resize images with two factors. It works, but the
I made this app that works fine, but when i leave the app and
I made this fiddle http://jsfiddle.net/nAb6N/10/ As you can see I have 2 animators ,
I made this javascript method that I altered from an existing script that I
I made this very simple solitaire in C++. The deck is random shuffled, I
I made this ccTouchBegin method : - (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.