Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Javascript Help me Please!

Name: Berek 2010-07-01 7:48

How do I make this work in java?


Die1 = Random number 1-6
Die2 = Random number 1-6
Die3 = Random number 1-4

If Die1 = 6 AND Die2 = 6
then subtract (Die3 + 6) from 20 then send to field "x"

if Die1 = 1 AND Die2 = 1
then send 18 to field "x"

if Die1 > Die2
then subtract Die1 from 20 then send to field "x"

if Die1 < Die2
then subtract Die2 from 20 then send to field "x"

Name: Berek 2010-07-01 7:51

I've been trying to figure this out all night and I'm hopelessly lost.....

Name: Anonymous 2010-07-01 7:53

Read SICP

Name: Berek 2010-07-01 7:57

That looked even more confusing.....

Name: Anonymous 2010-07-01 8:03

Javascript Help me Please!
How do I make this work in java?

Name: Berek 2010-07-01 8:04

...lol

Name: Anonymous 2010-07-01 8:09

So which is it?  The title mentions one language while the body of the post mentions a completely different language.  I'm afraid I can't help you.

Name: Berek 2010-07-01 8:12

The body was describing what I want to do in Java

Name: Berek 2010-07-01 8:20

I know this is possible... I just don't know how to do it.

Name: Anonymous 2010-07-01 8:44

That's not java.

Name: Anonymous 2010-07-01 9:07

import java.util.Random

public static void main(String[] args) {
    int x;
    Random r = new Random();
    int d1 = r.nextInt(1,6), d2 = r.nextInt(1,6), d3 = r.nextInt(1,4);
    if(d1 == 6 && d2 == 6) x = 14 - d3;
    else if(d1 == 1 && d2 == 1) x = 18;
    else if(d1 > d2) x = 20 - d1;
    else if(d1 < d2) x = 20 - d2;
}

Name: Anonymous 2010-07-01 10:52

>>10
i'm pretty sure it's a space station

Name: Anonymous 2010-07-01 11:38

>>1
What about D1 = D2 = N, where 1 < N < 6?

Name: Anonymous 2010-07-01 11:52

What the hell will happen when D1==D2?

Name: Anonymous 2010-07-01 12:28

>>13
>>14
Evidently nothing.

Name: Anonymous 2010-07-01 13:14

>>13,14
Undefined behaviour.

Name: Anonymous 2010-07-01 15:37

>>11
Something in that script isn't working.

Don't change these.
Name: Email:
Entire Thread Thread List