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

  • SEARCH
  • Home
  • 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 8555745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:11:40+00:00 2026-06-11T15:11:40+00:00

I need someone’s help to get me through this. I am working on a

  • 0

I need someone’s help to get me through this.

I am working on a project which evaluates a baseball pitch. In the program there is a grid represented by numbers 1 – 25 indicating the areas of a strike zone. as follows:

/*------------------------*
 |  1 |  2 |  3 |  4 |  5 |
 |  6 | *7 | *8 | *9 | 10 |
 | 11 |*12 |*13 |*14 | 15 |
 | 16 |*17 |*18 |*19 | 20 |
 | 21 | 22 | 23 | 24 | 25 |
 *------------------------*/

As I have it 7,8,9,12,13,14,17,18,18 are strikes and 1,2,3,4,5,6,10,11,15,16,20,21,22,23,24,25 are balls. etc.

I need to evaluate two numbers, the intended cell and the actual cell and return the number of cells apart the intention was from the execution.

IE: pitch intended for cell 12 actually floats into cell 15 would return a 3 because on the grid 15 is 3 cells away from 12. Further examples, 7 intended and 6 actual would return 1 as 6 is only 1 cell from 7. 1 intended and 25 actual would return 4 as it is 4 cells away etc.

I am doing this as a self exercise to expand my java knowledge and I just can’t manage it on my own. I need a method that evaluates the two parameters cellIntended and cellActual, consults this matrix and returns the number of cells apart.

I’m sorry if this is the wrong location to ask etc but I figured I’d throw it out there. Many thanks to any who attempt or consult on a solution. You guys are all awesome for just reading this far. Thank you.

  • 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-11T15:11:42+00:00Added an answer on June 11, 2026 at 3:11 pm

    Try something like this:

    int rowAim = (cellAim-1) / 5;
    int colAim = (cellAim-1) % 5;
    int rowHit = (cellHit-1) / 5;
    int colHit = (cellHit-1) % 5;
    float distance = Math.sqrt((rowAim - rowHit) * (rowAim - rowHit) + (colAim - colHit) * (colAim - colHit));
    

    That’s the Euclidean distance there, you could use something else (like Manhattan distance).

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

Sidebar

Related Questions

Please i need someone to help convert this query entity(c#) form. select * from
i need someone help with this little code snippet; why is the output: b
I've already got a bit of working code but I need someone to help
I need help with this problem. I need someone to explain to me why
OK, i need someone to explain to me where to start on this project.
I need someone help. When I open https://developers.facebook.com/docs/reference/api/ and clicked https://graph.facebook.com/me/likes?access_token=blablabla , I got
i m new to solr so i really need someone to help me understand
Need someone to help me to crack the following. On my local machine, i'm
I always get confused between the static and dynamic scoping and hence need someone
I'm retrieving image from DB using Stream. Need someone to help me to convert

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.