different for loops java
Posted
by Ayrton
on Stack Overflow
See other posts from Stack Overflow
or by Ayrton
Published on 2010-03-15T22:04:47Z
Indexed on
2010/03/15
22:39 UTC
Read the original article
Hit count: 165
java
|game-development
I'm having some difficulties with the following problem:
I'm making a little game where you're at a specific spot and each spot has each some possible directions.
The available directions are N(ord),E(ast),S,W . I use the function getPosDirections
to get the possible directions of that spot. The function returns the directions into an ArrayList<String>
e.g. for spot J3: [E,W]
Now the game goes like this: 2 dice will be rolled so you get a number between 2 and 12, this number represents the number of steps you can make.
What I want is an ArrayList
of all the possible routes
e.g.: I throw 3 and I'm currently at spot J3:
[[E,N,E],[E,N,S],[E,S,E],[E,S,S],[W,N,E],[W,N,S],[W,S,E],[W,S,S]]
How would obtain the last mentioned Array(list)?
© Stack Overflow or respective owner