Skip to main content
added 8 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17

Wolfram Language (Mathematica), 212 170 166 164 159 157 155155 153 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5|6,{(#2#2A-5)A5A,b},7,Echo@b;#,8,#-Min[b,A-a]z,_,{a,(#2#2B-9)B9B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!Try it online!

Wolfram Language (Mathematica), 212 170 166 164 159 157 155 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5|6,{(#2-5)A,b},7,Echo@b;#,8,#-Min[b,A-a]z,_,{a,(#2-9)B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!

Wolfram Language (Mathematica), 212 170 166 164 159 157 155 153 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5|6,{#2A-5A,b},7,Echo@b;#,8,#-Min[b,A-a]z,_,{a,#2B-9B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!

added 18 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17

Wolfram Language (Mathematica), 212 170 166 164 159 157157 155 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5,{0,b},65|6,{(#2-5)A,b},7,Echo@b;#,8,#-Min[b,A-a]z,9,{a,0},_,{a,(#2-9)B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!Try it online!

The program is a big Switch statement folded over the character codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to "F"E|F (9|10), as the spec says that there are no characters to be expected other than "fFeEpPoO".

Wolfram Language (Mathematica), 212 170 166 164 159 157 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5,{0,b},6,{A,b},7,Echo@b;#,8,#-Min[b,A-a]z,9,{a,0},_,{a,B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!

The program is a big Switch statement folded over the character codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to "F", as the spec says that there are no characters to be expected other than "fFeEpPoO".

Wolfram Language (Mathematica), 212 170 166 164 159 157 155 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5|6,{(#2-5)A,b},7,Echo@b;#,8,#-Min[b,A-a]z,_,{a,(#2-9)B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!

The program is a big Switch statement folded over the character codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to E|F (9|10), as the spec says that there are no characters to be expected other than "fFeEpPoO".

added 40 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17

Wolfram Language (Mathematica), 212 170 166 164 159159 157 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,"f",{A3,b}Echo@a;#,"F"4,{a#+Min[a,B}-b]z,"e"5,{0,b},"E"6,{aA,0b},"p",#+Min[a7,B-b]zEcho@b;#,"P"8,#-Min[b,A-a]z,"o"9,Echo@a;#{a,0},_,Echo@b;#]&{a,B}]&,z={-1,1};0z,Characters@#]&ToCharacterCode@#~Mod~12]&

Try it online!Try it online!

The program is a big Switch statement folded over the characterscharacter codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to "O""F", as the spec says that there are no characters to be expected other than "fFeEpPoO".

Wolfram Language (Mathematica), 212 170 166 164 159 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,"f",{A,b},"F",{a,B},"e",{0,b},"E",{a,0},"p",#+Min[a,B-b]z,"P",#-Min[b,A-a]z,"o",Echo@a;#,_,Echo@b;#]&,z={-1,1};0z,Characters@#]&

Try it online!

The program is a big Switch statement folded over the characters of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to "O", as the spec says that there are no characters to be expected other than "fFeEpPoO".

Wolfram Language (Mathematica), 212 170 166 164 159 157 bytes

A_~J~B_=Fold[Switch[{a,b}=#;#2,3,Echo@a;#,4,#+Min[a,B-b]z,5,{0,b},6,{A,b},7,Echo@b;#,8,#-Min[b,A-a]z,9,{a,0},_,{a,B}]&,z={-1,1};0z,ToCharacterCode@#~Mod~12]&

Try it online!

The program is a big Switch statement folded over the character codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch takes a shortcut by defaulting to "F", as the spec says that there are no characters to be expected other than "fFeEpPoO".

added un-golfed version
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
added 6 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
added 291 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
added 9 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
added 292 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
deleted 42 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
deleted 247 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
deleted 247 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
added 16 characters in body
Source Link
Roman
  • 2k
  • 8
  • 17
Loading
Source Link
Roman
  • 2k
  • 8
  • 17
Loading