Jump to content

Array help


EchoFool

Recommended Posts

Im really stuck here.

 

I have an array that stores a number of seats from 1 to 8 that are currently booked at a table that is circular.

 

So im trying to make a function to return the next "taken" seat at this round table to the "left" of where your sitting. How ever the problem i face is

when you reach checking seat 8 you need to go to seat 1 as that would be "left" of seat 8.

 

From the array below if i was sat at seat 7 i would need it to then check 8 and then back to one as this would technically be "left" of seat 8 at a round table.

 

Here is an array example of seats that are already taken:

  [0] = 2
  [1] = 3
  [2] = 5
  [3] = 7

 

How on earth do i do it - i can't even think of the logic on this one :S

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.