Any Java Experts? More Help! - Fantasy Baseball Cafe 2015 Fantasy Baseball Cafe
100% Deposit Bonus for Cafe Members!

Return to General Talk

Any Java Experts? More Help!

Moderator: Baseball Moderators

Re: Any Java Experts?

Postby The Artful Dodger » Thu Nov 05, 2009 7:36 pm

I know Java, but I'll admit to being rusty, having not programmed in it for a while. :-B

I don't reckon to be much help with the math bit, but start out with the variables. You know that you have placeholders such as the current hole #, total strokes, score, et. al. Each time there's an event, you can update the placeholder by the current value(s) within the second while loop.

Each time the user hits the ball, I'm presuming that you figure out the metrics (strength, angle) by a formula or two (I'm assuming something Pythagorean theorem based), with some help from the geometry AWT package Once that's figured out, you're calling the AWT/Swing methods to draw the path of the ball. If ballInHole is true, then you're scoring the hole into the # holes played, total number of strokes, handicap and emptying out # strokes, as well assuming that for the next hole someone hits a hole in one (in other words, you have a negative number starting from the hole, such that for each additional stroke, you're incrementing up). Assuming there's an array of holes which tell you the par and the number of feet away from tee shot, then it should be straightforward to keep score. If false, well, then you carry on. You're adding one more stroke to the stroke count for the hole and taking into account the number of feet away from the cup.

Not sure if I've got the whole picture here, but basically that would be one way to approach the problem. Good luck. ;-D
Image

It's kinda like the Old Cafe - http://fbc2.freeforums.net
The Artful Dodger
Chief Wikitect
Chief Wikitect

User avatar
CafeholicResponse TeamFantasy ExpertCafe WriterCafe RankerMock(ing) DrafterEagle EyePick 3 Weekly WinnerMatchup Meltdown SurvivorLucky Ladders Weekly Winner
Posts: 21947
(Past Year: 670)
Joined: 3 Feb 2006
Home Cafe: Baseball
Location: Downloading rice

Re: Any Java Experts?

Postby Neato Torpedo » Fri Nov 06, 2009 1:37 am

Dude, just copy the code from Wii Sports, you'll be fine
Image

Rocinante2: you know
Rocinante2: its easy to dismiss the orioles as a bad team
ofanrex: go on
Rocinante2: i'm done
Rocinante2: lmao

Play Brushback Baseball! (we need more people)
Neato Torpedo
Hall of Fame Hero
Hall of Fame Hero

User avatar
EditorCafeholicFantasy ExpertCafe WriterCafe RankerWeb Supporter
Posts: 8618
Joined: 4 Mar 2007
Home Cafe: Baseball
Location: we don't burn gasoline, we burn our dreams

Re: Any Java Experts?

Postby Tavish » Tue Nov 17, 2009 1:35 pm

Assigning the variable to 0 after all the hole accounting is done isn't working? Or even better, put the assignment in the beginning of the loop that is cycling through 18 holes, so it is reset to 0 at the start of each hole instead of at the end.
Image

Bury me a Royal.
Tavish
Mod in Retirement
Mod in Retirement

User avatar
CafeholicFantasy ExpertCafe WriterCafe RankerMock(ing) DrafterEagle EyeCafe SpotterWeb Supporter
Posts: 11071
(Past Year: 23)
Joined: 3 May 2004
Home Cafe: Baseball

Re: Any Java Experts?

Postby Tavish » Tue Nov 17, 2009 2:15 pm

Write your question to the user;
String answer = input.nextLine();
Compare answer and either continue or quit.
Image

Bury me a Royal.
Tavish
Mod in Retirement
Mod in Retirement

User avatar
CafeholicFantasy ExpertCafe WriterCafe RankerMock(ing) DrafterEagle EyeCafe SpotterWeb Supporter
Posts: 11071
(Past Year: 23)
Joined: 3 May 2004
Home Cafe: Baseball

Re: Any Java Experts?

Postby Art Vandelay » Tue Nov 17, 2009 2:41 pm

I saw the thread title and got all excited thinking I'd finally be able to put my degree in South Pacific Studies to use, but alas, you're talking about the computer program. I don't know anything about computers, but if anyone has any questions about the most heavily populated island in the world, let me know.
Image
Art Vandelay
Hall of Fame Hero
Hall of Fame Hero

CafeholicFantasy ExpertPick 3 Weekly WinnerLucky Ladders Weekly Winner
Posts: 5265
Joined: 12 Mar 2005
Home Cafe: Baseball

Re: Any Java Experts?

Postby JTWood » Tue Nov 17, 2009 7:59 pm

Art Vandelay wrote:I saw the thread title and got all excited thinking I'd finally be able to put my degree in South Pacific Studies to use, but alas, you're talking about the computer program. I don't know anything about computers, but if anyone has any questions about the most heavily populated island in the world, let me know.

Question: Is that why you're such a grumpy person?
Image
JTWood
Hall of Fame Hero
Hall of Fame Hero

User avatar
CafeholicCafe WriterEagle EyeWeb Supporter
Posts: 11508
Joined: 22 Jun 2004
Home Cafe: Baseball
Location: Unincorporated Heaven

Re: Any Java Experts?

Postby Art Vandelay » Tue Nov 17, 2009 9:18 pm

Is what why?

Also, I'm not grumpy at all.
Image
Art Vandelay
Hall of Fame Hero
Hall of Fame Hero

CafeholicFantasy ExpertPick 3 Weekly WinnerLucky Ladders Weekly Winner
Posts: 5265
Joined: 12 Mar 2005
Home Cafe: Baseball

Next

Return to General Talk

Who is online

Users browsing this forum: Lenajes and 4 guests

cron
Forums Articles & Tips Sleepers Rankings Leagues


Get Ready...
The 2015 MLB season starts in 20:50 hours
(and 92 days)

  • Fantasy Baseball
  • Article Submissions
  • Privacy Statement
  • Site Survey 
  • Contact