Taxi, 730 706 bytes
-24 bytes by eliminating linebreaks.
Clever answer in a verbose language? Check and check.
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.Pickup a passenger going to Cyclone.[B]Switch to plan D if no one is waiting.Pickup a passenger going to Crime Lab.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Crime Lab.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 2 r 2 r.Switch to plan C if no one is waiting.Pickup a passenger going to Cyclone.Go to Fueler Up:n.Go to Chop Suey:n 3 r 1 l.Switch to plan B.[C]0 is waiting at Writer's Depot.Go to Writer's Depot:n 4 l 2 l.Pickup a passenger going to Cyclone.Go to Chop Suey:n 3 r 3 r.[D]Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Post Office.Go to Post Office:s 1 l 2 r 1 l.
Try it online!
Try it online with linebreaks!
Doesn't return to the Taxi Garage after the program ends, so the boss fires me, and it exits with an error.
What this program actually does is checks whether or not the input consists of any repeating character, and outputs that character if it does, or 0
if it doesn't.
Alternative solution, 602 582 541 445 bytes
-20 bytes by eliminating linebreaks.
-41 bytes by having the program error out upon a false result.
-96 bytes by having the program output via error message.
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.Pickup a passenger going to Cyclone.[B]Switch to plan C if no one is waiting.Pickup a passenger going to Crime Lab.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Crime Lab.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 2 r 2 r.Pickup a passenger going to Cyclone.Go to Fueler Up:n.Go to Chop Suey:n 3 r 1 l.Switch to plan B.[C]
Try it online!
Try it online with linebreaks!
This alternative solution errors out with The boss couldn't find your taxi in the garage. You're fired!
if the input is a repdigit, and no outgoing passengers found
if the input is not a repdigit (meaning this also works with 0
...or 00
, or 000
...).
2Related. – Leaky Nun – 2017-06-08T03:02:10.307
@AidanF.Pierce What's the biggest number the input will be? – stevefestl – 2017-06-14T09:00:13.820