|
Post by Majin_Blues on Nov 26, 2001 6:54:20 GMT -5
does this mean we must return the value inputted from the keyboard once we call the input method? yep... how else would the other class know what value to use? (i don't mean to sound mean... just trying to prove a point)
|
|
DK
Junior Member
Posts: 23
|
Post by DK on Nov 26, 2001 13:52:13 GMT -5
well, of course we must return a value but what I wondering about was shouldn't we just do something like public int Input()throws IOExeption{ ... } instead of what gundam did? all i did was (part of my code) this is a method not main public void Input() throws IOException { ... } and it works fine
|
|
|
Post by gundamf91 on Nov 26, 2001 15:33:17 GMT -5
well even when i changed it to
public int Input() throws IOException and at the end... return rowguess + columnguess;
it works fine for me i dont' know about u man
gundamf91
|
|
|
Post by Majin_Blues on Nov 26, 2001 16:32:02 GMT -5
return rowguess + columnguess; it works fine for me i dont' know about u man that worked? shouldn't that have been added together or something? they're 2 int values...
|
|
|
Post by gundamf91 on Nov 26, 2001 16:35:04 GMT -5
ok that was wrong but i just added the throws IOException with no errors
how can i return two things in just one line???
gundamf91
|
|
|
Post by Majin_Blues on Nov 26, 2001 17:10:00 GMT -5
hmm... dunno bout that... why not just call 2 different methods in the same class?
(it's cheap and longer, but it works... ;D)
or without learning new stuff, you could convert it to text, return it as text, and re-convert to string... (but that would just be insane)
|
|
|
Post by gundamf91 on Nov 26, 2001 17:25:27 GMT -5
quoted from pervious "When you want to read something from the keyboard, you will have to call a method in the input/output class which reads from the keyboard and returns the information to the calling method as a return value."
i thought that has to be in the same method so....what's the point of having my Input method int when i'm not even gonna return the values using that method? i'm just gonna stick to my old one which is
public int getRowGuess() { return rowguess; }
and public int getColumnGuess() { return columnguess; }
is that right???
|
|
|
Post by Majin_Blues on Nov 26, 2001 18:14:51 GMT -5
that's what i meant by long way... if it's not the shortest way...
btw, does your program work for a 4x4 size grid?
|
|
|
Post by gundamf91 on Nov 26, 2001 18:39:59 GMT -5
its not even done yet but yeah i tried changing back to 4 as the gridsize and it works but not so randomish tho it different once in a while (i'm only talking about 4 bones, if it was 2 bones or 3 bones it is pretty random)
bah the handout is really unclear...tho i know i'm not the first person to say this but ya....UNCLEAR
gundamf91
|
|
|
Post by Brutal_Chicken on Nov 26, 2001 18:55:38 GMT -5
Hmm... well how did you guys create the user's grid? You can't make them equal each other since they'd be referrenced to the same address. The way I did it was create an int variable for the sole purpose of the creation of the two grids. Of course, that'd imply a square grid... Mine still works for any sized grid, as long as you can fit in the bones that is and that the whole grid doesn't show up due to the thing scrollin' down.
I managed to make only one method with a void return and one of my helper classes as a parameter. Works fine as is.
The only remaining problem I have is that I still can't get all the bones to show up sometimes.
|
|
|
Post by gundamf91 on Nov 26, 2001 18:59:05 GMT -5
patient my son u will solve this, i've solved alot of stupid bugs just today and i have to thank all of you who posted here and my thread. me proud of meself gundamf91
|
|
|
Post by bladehunter on Nov 26, 2001 19:03:20 GMT -5
Brutal, what do u mean by "all bones not showing up"?
|
|
|
Post by SquirrelHunterPro on Nov 26, 2001 19:47:27 GMT -5
The stupid inputoutput turd is really screwing me over... stupid buffered reader and Throwexception... ARGH! and how did you guys do the display of the grids? I used System.out.println("........") but that doesnt work too well... is there something that works like printspace instead of line... that way is concats onto the same line instead of starting a new one?
"That just makes me so angry. I think I'm goin to explode! ERGHHHHHHHHH!!!!" - Milhouse in the Simpsons episode where the lemon tree gets stolen.
|
|
|
Post by gundamf91 on Nov 26, 2001 19:51:06 GMT -5
use for loops to display the grids by calling out each array[][] after 5 dots are printed (use print without the ln at the end), go to next line using println for 5 times just draw them out and think about it for example a 5x5 ..... ..... ..... ..... ..... how would u do it??
|
|
|
Post by SquirrelHunterPro on Nov 26, 2001 20:09:19 GMT -5
Thanks Gundam ;D ;D ;D I guessss I just didnt know where to put that throw exception. And with a little inspiration from Hans Zimmer's gladiator theme song I think I have this baby all wrapped up... just need to figure out how to output the grid with variable sizes onto the screen....
|
|