Don&#x27;t go for a FSM.<p>GKRuleSystem[0] to the rescue!<p>Or any other Fuzzy Logic(?) framework.<p>Or maybe a behaviour tree, which is how I would have (tried) to design it with.<p>I hope I get something like this on an interview, instead of &quot;reverse binary tree&quot; like questions. This actually seems like a fun problem to solve. Knowing my defect brain, it would put a lot of effort into this because it&#x27;s kinda fun. 
Also because I already have a ton of ideas on how to implement this - not that I already have.<p>Just off the top of my head.
A BT that tracks current floor, direction, some predicates for inputs e.g ignore input 2 if direction is up and current floor is 3.<p>That would satisfy the current test conditions. HOWEVER.. a better style would be to keep that in queue with an indicator (UI) that it&#x27;s on the queue after current direction has hit its highest floor.
Could add another predicate that the elevator won&#x27;t stop for &#x27;caller&#x27; on third floor if it&#x27;s filled (maxWeightReached) and everyone are going to bottom floor.<p>Eventually you could maximise the amount of people it moves based on space available and how many have called the elevator using their condo NFC tags.<p>Seriously, this what dev interviews <i>should</i> look like.<p>0: <a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;ios&#x2F;documentation&#x2F;GameplayKit&#x2F;Reference&#x2F;GKRuleSystem_Class&#x2F;index.html#&#x2F;&#x2F;apple_ref&#x2F;occ&#x2F;instp&#x2F;GKRuleSystem&#x2F;facts" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;ios&#x2F;documentation&#x2F;Gamepl...</a>