8
1
In the original Shantae game, there are transformation dances that you have to input in time using the D-Pad, A, and B. If you complete a predefined sequence while dancing, you will transform into the corresponding form (or teleport or heal). Your task is to output the corresponding effect when given an input. The catch is that you may get extraneous dance moves in the input, both before and after, and there may not even be a dance in the input.
The Dances
Using UDLRAB
for dance moves:
- Monkey:
DR
- Elephant:
DL
- Spider:
DA
- Harpy:
DB
- Tinkerbat:
DUU
- Heal:
DUA
- Scuttle Town:
DULR
- Water Town:
DURLAB
- Oasis Town:
DURRBA
- Zombie Caravan:
DULLBA
- Bandit Town:
DUBLBR
Coding
Input: a sequence of dance moves. This can contain Up, Down, Left, Right, B, A, and Wait values. Use any convenient encoding.
Output: a value corresponding to the first matching dance in the sequence or a distinct value if there is no match. You can encode this in any convenient way.
Examples
Using .
for waiting:
DR
→ MonkeyUUU.DLUAB
→ ElephantL.DDBALL
→ HarpyLRLRDURURLAB
→ No matchDUBLBR
→ Bandit TownDURLBA
→ No matchDDUDR
→ MonkeyRLAB
→ No match.DUUBBB
→ TinkerbatDADRDL
→ Spider.DURRBADR
→ Oasis TownDURR.BA
→ No match
Other Rules/Notes
- Standard rules on loopholes and IO methods apply
- Describe your encoding for dance moves and matching dances.
- There may be more than one dance in the input. If that is the case, match only the first one that appears in the input.
- Waiting interrupts dances.
1Related – Beefster – 2019-05-01T17:45:17.533
Now testcase 4 ends in
DURLAB
, which is Water Town – Skidsdev – 2019-05-01T18:11:04.643@Skidsdev. Good catch. I meant to make that a no match test case there. – Beefster – 2019-05-01T18:11:31.970
1You can encode this in any convenient way: may we return the matching sequence, e.g. "DURRBA" for Oasis Town? – Arnauld – 2019-05-01T18:39:52.867
@Arnauld I guess that works. – Beefster – 2019-05-01T18:46:56.543
1Random: Longish ago, using only 'input' and 'wait' (ie timed coin entries) the casinos (in a country that I won't mention and which you are unlikely to guess and which isn't my country)(connected to me only by "internet") had their slot machine software hacked at source such that a player could multiply their input pot by a largish number. They then played, won or lost and cashed out with far more than they had input. It was in due course discovered and fixed. I identified the method based on a general description of what was happening overall - supplied by a puzzled security investigator. – Russell McMahon – 2019-05-01T20:22:42.503