Jump to content

Hoppable Worlds Array


Swizzbeat

Recommended Posts

 

Sorry but this is not right:

random(WORLDS.length() - 1)

An example:

 

random(28);

This can gives you the number 0 or the number 27 and all numbers beetween this two numbers. But not the number 28.

 

This is right:

random(WORLDS.length())

Nevermind you're right this API is freaken horrible.

Edited by Swizzbeat
Link to comment
Share on other sites

  • 4 months later...

Sorry to gravedig but this is the right thread to ask this. How would I change it so that I have an initial array WORLDS and when I hop to a certain world, it would be withdrawn from the initial array and put into a second one, lets say WORLDSHOPPED. Then I would hop again, but it would pick a random world from the remaining worlds in WORLDS array. That would go on and on and at the end if there would be no worlds left in WORLDS and they were all in WORLDSHOPPED, all the values would go back into the WORLDS array.

 

So I would hop all the worlds - NOT HOPPING TO PREVIOUS ONES - and after I have hopped all the worlds, "the counter" would reset.

 

How would code for something like that look like?

Link to comment
Share on other sites

Sorry to gravedig but this is the right thread to ask this. How would I change it so that I have an initial array WORLDS and when I hop to a certain world, it would be withdrawn from the initial array and put into a second one, lets say WORLDSHOPPED. Then I would hop again, but it would pick a random world from the remaining worlds in WORLDS array. That would go on and on and at the end if there would be no worlds left in WORLDS and they were all in WORLDSHOPPED, all the values would go back into the WORLDS array.

So I would hop all the worlds - NOT HOPPING TO PREVIOUS ONES - and after I have hopped all the worlds, "the counter" would reset.

How would code for something like that look like?

Learn Java.
Link to comment
Share on other sites

Sorry to gravedig but this is the right thread to ask this. How would I change it so that I have an initial array WORLDS and when I hop to a certain world, it would be withdrawn from the initial array and put into a second one, lets say WORLDSHOPPED. Then I would hop again, but it would pick a random world from the remaining worlds in WORLDS array. That would go on and on and at the end if there would be no worlds left in WORLDS and they were all in WORLDSHOPPED, all the values would go back into the WORLDS array.

 

So I would hop all the worlds - NOT HOPPING TO PREVIOUS ONES - and after I have hopped all the worlds, "the counter" would reset.

 

How would code for something like that look like?

 

http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...