Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22501
| Date | 2013-02-25 11:10 +0000 |
|---|---|
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
| Organization | Trollbusters 3 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: BlueJ don't know what i did wrong |
| References | (3 earlier) <1wtai7dd80h80$.6rbtwoyou3gh.dlg@40tude.net> <5q6dnc3pF_HJzLfMnZ2dnUVZ7s-dnZ2d@bt.com> <ynnhshspu6ns$.1nz7cu3a7fgph$.dlg@40tude.net> <aKWdnTYUgZl19bfMnZ2dnUVZ8k-dnZ2d@bt.com> <77afaabf-ec0f-46d6-b3ea-d8f186dbf7e4@googlegroups.com> |
| Message-ID | <veSdnb08Iq8m27bMnZ2dnUVZ8g2dnZ2d@bt.com> (permalink) |
On 25/02/13 09:52, marvin.radke@htp-tel.de wrote:
> sorry for the late answer :/
>
> well.. the game is like said a tabletop game with many units which are grouped on cards. And this cards i want to give to the players, 3 cards are 2 times available thats why i did it like this....
>
> I have done the same with the programm "turbo pascal" and there its working (just some changes), but wanted to write it so that it works with BlueJ.
BlueJ is an IDE, it's not a problem with BlueJ it's a problem with your
Java code, the problem might occcur regardless of IDE, it occurs when I
run the code in Eclipse, another Java IDE, it would also randomly occur
if you run your code from a terminal prompt.
> The way i wanted it to work is that it choose randomly a card,
Do you know what a stack is ?
A stack is a simple LIFO (Last In First Out) data structure, in fact
it's much like a deck of cards. If you push all your cards onto a stack
in a random order then you can simply pop them off when you need them.
When the deck (stack) is empty all the cards are dealt out and
(presumably) your game can commence.
Java has a built in Stack data structure, you can find out about it here
http://docs.oracle.com/javase/6/docs/api/java/util/Stack.html
<pseudo-code>
Stack s = new Stack()
//populate the stack
for(...){
stack.push(someObject)
}
... get a 'card'
SomeObject = stack.pop();
</pseudo-code>
This would avoid using the result of getting a value from the array as a
test for your if/for/while conditionals
It might be worth a try
lipska
--
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
BlueJ don't know what i did wrong BlueJguywithoutskill <marvin.radke@htp-tel.de> - 2013-02-22 06:03 -0800
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-22 15:55 +0100
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-22 07:13 -0800
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-22 16:24 +0100
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-22 07:31 -0800
Re: BlueJ don't know what i did wrong Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-22 10:50 -0500
Re: BlueJ don't know what i did wrong markspace <markspace@nospam.nospam> - 2013-02-22 10:43 -0800
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-24 02:27 -0800
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-24 14:54 +0100
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-24 06:15 -0800
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-24 15:04 +0000
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-24 16:29 +0000
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-24 18:21 +0100
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-24 17:43 +0000
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-24 20:04 +0100
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-24 19:24 +0000
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-25 01:52 -0800
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-25 11:10 +0000
Re: BlueJ don't know what i did wrong "John B. Matthews" <nospam@nospam.invalid> - 2013-02-25 07:50 -0500
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-25 13:35 +0000
Re: BlueJ don't know what i did wrong "John B. Matthews" <nospam@nospam.invalid> - 2013-02-25 13:52 -0500
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-25 19:54 +0000
Re: BlueJ don't know what i did wrong Lew <lewbloch@gmail.com> - 2013-02-25 14:26 -0800
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-26 09:08 +0000
Re: BlueJ don't know what i did wrong Arne Vajhøj <arne@vajhoej.dk> - 2013-02-25 22:05 -0500
Re: BlueJ don't know what i did wrong Arne Vajhøj <arne@vajhoej.dk> - 2013-02-25 22:08 -0500
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-26 09:23 +0000
Re: BlueJ don't know what i did wrong Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-26 05:59 -0400
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-26 11:30 +0000
Re: BlueJ don't know what i did wrong Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-27 06:45 -0400
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-27 11:58 +0000
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-27 12:24 +0000
Re: BlueJ don't know what i did wrong Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-27 22:40 -0400
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-28 08:53 +0000
Re: BlueJ don't know what i did wrong Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-28 17:14 -0400
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-01 08:45 +0000
Re: BlueJ don't know what i did wrong markspace <markspace@nospam.nospam> - 2013-02-26 08:33 -0800
Re: BlueJ don't know what i did wrong Arne Vajhøj <arne@vajhoej.dk> - 2013-02-25 22:19 -0500
Re: BlueJ don't know what i did wrong Arne Vajhøj <arne@vajhoej.dk> - 2013-02-25 22:02 -0500
Re: BlueJ don't know what i did wrong marvin.radke@htp-tel.de - 2013-02-25 09:54 -0800
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-25 18:25 +0000
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-26 16:13 +0100
Re: BlueJ don't know what i did wrong lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-26 16:40 +0000
Re: BlueJ don't know what i did wrong Joerg Meier <joergmmeier@arcor.de> - 2013-02-26 18:19 +0100
Re: BlueJ don't know what i did wrong markspace <markspace@nospam.nospam> - 2013-02-25 08:34 -0800
Re: BlueJ don't know what i did wrong Lew <lewbloch@gmail.com> - 2013-02-24 12:38 -0800
csiph-web