Yupp , I ' m actually waiting for the audit . <| sep |> JavaHere ' s a objectoriented approach . It ' s a bit messy since I threw all the relevant classes into one file . I made my own diagram before looking at yours . Here it is if you are interested as pdf , as vsdx for Visio 2016 package com . github . randers 00 . dailyprogrammer import java . util . public class C 293 public static void mainString args Turn stdin into list of wires Scanner in new ScannerSystem . in QueueWire wires new LinkedList while in . hasNextLine String line in . nextLine Wire currentWire Wire . valueOfline . toUpperCase wires . addcurrentWire Start off with State 0 State currentDefusalState new State 0 do try Wire toBeCut wires . remove currentDefusalState currentDefusalState . cutWiretoBeCut Wire successfully cut . Will continue with the next state if bomb is not defused . catch NoSuchElementException IllegalWireException e Defusal failed . Incorrect wire or end of wire list . System . out . printlnBooom return while ! currentDefusalState . isBombDefused Bomb defused . System . out . printlndefused private enum Wire WHITE , BLACK , RED , ORANGE , GREEN private static class IllegalWireException extends Exception private interface State Processes what happens when a specific wire color is cut in the current state of the bomb defusal . param wire The wire color to cut . return The new state that the bomb will be in after cutting the specified wire . throws IllegalWireException When a wire is cut which has not been specified by the rules . State cutWireWire wire throws IllegalWireException return Whether the bomb is in a state in which it has been defused . boolean isBombDefused private abstract static class UndefusedState implements State Override public boolean isBombDefused return false private static class State 0 extends UndefusedState Override public State cutWireWire wire throws IllegalWireException switch wire case RED return new State 2 case WHITE return new State 1 default throw new IllegalWireException private static class State 1 extends UndefusedState Override public State cutWireWire wire throws IllegalWireException switch wire case WHITE return new State 2 case ORANGE return new State 3 default throw new IllegalWireException private static class State 2 extends UndefusedState Override public State cutWireWire wire throws IllegalWireException switch wire case RED return new State 0 case BLACK return new State 3 default throw new IllegalWireException private static class State 3 extends UndefusedState Override public State cutWireWire wire throws IllegalWireException switch wire case BLACK return this This will throw a UnallowedWireException if the cable is not green or orange default return new OppositeFollowerStatewire private static class OppositeFollowerState extends UndefusedState private final Wire toBeCut public OppositeFollowerStateWire previouslyCut throws IllegalWireException if previouslyCut Wire . GREEN toBeCut Wire . ORANGE else if previouslyCut Wire . ORANGE toBeCut Wire . GREEN else throw new IllegalWireException Override public State cutWireWire wire throws IllegalWireException if wire toBeCut return new DefusedState throw new IllegalWireException private static class DefusedState implements State Override public State cutWireWire wire throws IllegalWireException throw new IllegalStateExceptionThe bomb has already been defused , no more wires can be cut ! Override public boolean isBombDefused return true