0

the title is a little non-descriptive so i'll give background here.

I am making a snakes and ladders game, and the players location is stored in a variable, playerLocation.

I have an array of spots i would like to check, known as "spotLocations".

I check if the players location is in the spot using

if (Arrays.asList(spotLocations).contains(playerLocation))

Once this is done, i would like to check which slot in the array that value is found. Code is written in java using eclipse.

1 Answers1

0
int pos = Arrays.asList(spotLocations).indexOf(playerLocation)
Draken
  • 3,134
  • 13
  • 34
  • 54