What day is it (on Flooptonia)?

34

5

You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help you understand the Flooptonian calendar.

Here is the 208-day long Flooptonian calendar:

Month       Days    Input Range
Qupu        22      [0-22)
Blinkorp    17      [22-39)
Paas        24      [39-63)
Karpasus    17      [63-80)
Floopdoor   1       [80]
Dumaflop    28      [81-109)
Lindilo     32      [109-141)
Fwup        67      [141-208)

Challenge

Your program, given an integer day in the year (range [0-208)) is to output the corresponding day of the month and name of the month (e.g. 13 Dumaflop).

There is an exception, however: Floopdoor a special time for Flooptonians that apparently deserves its own calendar page. For that reason, Floopdoor isn't written with a day (i.e. the output is Floopdoor, not 1 Floopdoor).

Test Cases

0   => 1 Qupu
32  => 11 Blinkorp
62  => 24 Paas
77  => 15 Karpasus
80  => Floopdoor
99  => 19 Dumaflop
128 => 20 Lindilo
207 => 67 Fwup

Rules

  • You must write a complete program.
  • You can assume that the input is always valid.
  • Your output may have a trailing newline but must otherwise be free of any extra characters. The case should also match the provided examples.
  • You may use date/time functions.
  • Code length is to be measured in bytes.

Sean Latham

Posted 2015-07-24T14:27:32.970

Reputation: 1 423

Does the output's case matter? – Downgoat – 2015-07-24T16:40:02.493

Yes it does, I'll clarify in the post. – Sean Latham – 2015-07-24T16:42:11.003

2Is it "Floopdoor" or "Floopdor"? The first chart has the extra o, but the other instances of the name don't. – jwodder – 2015-07-24T17:11:16.143

Ah, forgive my typo! :) I've changed it to "Floopdoor" as the majority of the current answers use that already. – Sean Latham – 2015-07-24T17:20:55.253

4So... in 47k years, nothing will change? – Not that Charles – 2015-07-24T19:43:51.363

2@NotthatCharles furthermore, if the planet's that far away, won't it be outdated by the time you get it in the first place? – SuperJedi224 – 2015-07-25T00:56:11.263

3As if the Gregorian calendar wasn't bad enough. – Arturo Torres Sánchez – 2015-07-25T03:11:44.573

3@ArturoTorresSánchez Well at least there is no leap year. But are there any other stories about Flooptonia, or was the entire setting created solely for this specific puzzle? Is Fwup their word for winter? Or should I just get my tail back to Worldbuilding? – Damian Yerrick – 2015-07-26T02:31:30.140

Answers

14

Pyth - 105 103 90 88 bytes

Uses base conversion. Two simple lookup tables, with one for the names and one for start dates, and a ternary at the end for Floopdoor.

KhfgQhTC,aCM"mQP?'"Zcs@LGjC"îºBüÏl}W\"p%åtml-¢pTÇÉ(°±`"23\c+?nQ80+-hQhKdkreK3

Compresses the string not as base 128, but as base 23. First, it translates it to indices of the alphabet. This required the separator to be c which doesn't appear in any of the month names. Then it encodes that to base ten from a base 23 number (the highest value that appeared was w), then converts to base 256.

The start dates are their unicode codepoints, no base conversion.

K                       K =
 hf                     First that matches the filter
  gQ                    >= Q
   hT                   First element of filter var
  C,                    Zip two sequences
   a       Z            Append 0 (I could save a byte here but don't want to mess with null bytes)
    CM"..."             Map the string to its codepoints
   c          \c        Split by "c"
    s                   Sum by string concatenation
     @LG                Map to location in alphabet
      j     23          Base 10 -> Base 23
      C"..."            Base 256 -> Base 10
+                       String concatenation
 ?nQ80                  Ternary if input != 80
  +-hQhK                Input - start date + 1
  k                     Else empty string
 r  3                   Capitalize first letter
  eK                    Of month name

Try it online here.

Test Suite.

Maltysen

Posted 2015-07-24T14:27:32.970

Reputation: 25 023

I'm very new to Pyth, could you break it down? I'd be very grateful. – Winny – 2015-07-24T18:34:17.513

1@Winny I will, just wanted to finish the obvious golfs first. All the weird symbols are because I compressed the base 26 symbols (the alphabet) into base 256 to save space. – Maltysen – 2015-07-24T18:37:06.110

1

@Winny is that enough? Feel free to ping me here/in chat if you have any questions.

– Maltysen – 2015-07-24T19:01:53.727

19

Python 3, 159 156 152 151 150 148 bytes

n=int(input())+1
for c,x in zip(b" C","Qupu Blinkorp Paas Karpasus Floopdoor Dumaflop Lindilo Fwup".split()):c>=n>0and print(*[n,x][-c:]);n-=c

The bytes object in the zip contains unprintable characters:

for c,x in zip(b"\x16\x11\x18\x11\x01\x1c C", ...): ...

(Thanks to @xnor for suggesting a for/zip loop for -3 bytes)

Sp3000

Posted 2015-07-24T14:27:32.970

Reputation: 58 729

11That moment when a Python answer is ---<s>going neck to neck to</s>--- beating a Pyth answer – Optimizer – 2015-07-24T17:31:43.313

1The use of a bytestring is ingenious! – Winny – 2015-07-24T17:32:31.537

I feel like it should be possible to iterate over b directly with for instead of while, with something like for c in b"...":i+=n>0;n-=c. – xnor – 2015-07-24T17:39:23.510

1Oh, wait, you need the right value of n to stop going down too. Still should be possible with something like x=n>c;n-=c*x;i+=x but don't know if it's worth it. – xnor – 2015-07-24T17:46:19.290

13

Piet 2125 bytes

It's by no means the shortest, but it's pretty and colorful...

Each pixel is placed by myself by hand. To run it go here in FireFox (Chrome won't work) and load it with a codel width of 1 (it'll appear black, don't worry), enter the number and hit the run button!

Small Program: Small Version


Enlarged (Codel width of 10): enter image description here

DeadChex

Posted 2015-07-24T14:27:32.970

Reputation: 508

Doesn't dead chex add to the byte count? – Beta Decay – 2015-07-30T08:45:49.040

1@Beta To be fair the bye count is actually the size of the smaller image on disk, so regardless the byte count is fixed – DeadChex – 2015-07-30T11:42:17.213

12

Pyth 178 156 153 147 bytes

J?<Q22,_1"Qupu"?<Q39,21"Blinkorp"?<Q63,38"Paas"?<Q80,62"Karpasus"?<Q81,k"Floopdoor"?<Q109,80"Dumaflop"?<Q141,108"Lindilo",140"Fwup"?nhJkjd,-QhJeJeJ

Permalink

Second golf ever, any Pyth feedback will be very helpful.

Explanation

J                       (Auto)Assign J a tuple of the first day & month name
 ?<Q22,_1"Qupu"         Recall that Q auto-initialized to raw_input()
 ?<Q39,21"Blinkorp"     ? is ternary
 ?<Q63,38"Paas"         , is a two-pair tuple
 ?<Q80,62"Karpasus"
 ?<Q81,k"Floopdoor"     Special case handled by empty string as first day
 ?<Q109,80"Dumaflop"
 ?<Q141,108"Lindilo"
 ,140"Fwup"             Since input assumed valid, no need to test for Fwup
?nhJk                   Is day not an empty string?
jd,                     join on space
   -QhJ                 Q-(first day or -1 on first month) + 1
   eJ                   The month itself
eJ                      Else print only the month name on Floopdoor

Winny

Posted 2015-07-24T14:27:32.970

Reputation: 1 120

You should be able to use inline assignment to put the entire J=... into the ternary condition. – Maltysen – 2015-07-24T19:05:39.367

7

CJam, 98 96 93 bytes

0000000: 72 69 63 22 00 16 27 3f 50 51 6d 8d d0 22 66 2d  ric"..'?PQm.."f-
0000010: 5f 7b 30 3c 7d 23 28 5f 40 3d 29 53 40 22 06 32  _{0<}#(_@=)S@".2
0000020: 88 b2 ce d2 87 2f 1e 79 62 1b 7a 11 53 a6 cc 02  ...../.yb.z.S...
0000030: 40 c5 c6 82 d0 dd b7 4b ed ee 1c dc 4f f5 ec 67  @......K....O..g
0000040: 22 32 35 35 62 32 33 62 27 61 66 2b 27 63 2f 3d  "255b23b'af+'c/=
0000050: 5f 2c 39 3d 7b 5c 3f 7d 26 28 65 75 5c           _,9={\?}&(eu\

The above is a reversible hexdump, since the source code contains unprintable characters.

Most unprintable characters are no problem for the online interpreter, but the null byte in the first string is a deal breaker.

At the cost of one byte, we can fix this by adding 1 to the input and 1 to each code point of the first string. You can try this version in the CJam interpreter.

If the permalink doesn't work in your browser, you can copy the code from this paste.

Test cases

$ LANG=en_US
$ xxd -ps -r > flooptonia.cjam <<< 726963220016273f50516d8dd022662d5f7b303c7d23285f403d29534022063288b2ced2872f1e79621b7a1153a6cc0240c5c682d0ddb74bedee1cdc4ff5ec6722323535623233622761662b27632f3d5f2c393d7b5c3f7d262865755c
$ wc -c flooptonia.cjam 
96 flooptonia.cjam
$ for d in 0 32 62 77 80 99 128 207; do cjam flooptonia.cjam <<< $d; echo; done
1 Qupu
11 Blinkorp
24 Paas
15 Karpasus
Floopdoor
19 Dumaflop
20 Lindilo
67 Fwup

How it works

ric     e# Read a Long from STDIN and cast to Character.
"…"     e# Push the string that corresponds to [0 22 39 63 80 81 109 141 208].
f-      e# Subtract each character from the input char.
        e# Character Character - -> Long
_{0<}#  e# Find the index of the first negative integer.
(_      e# Subtract 1 from the index and push a copy.
@=)     e# Select the last non-negative integer from the array and add 1.
S@      e# Push a space and rotate the decremented index on top of it.
"…"     e# Push a string that encodes the months' names.
255b23b e# Convert from base 255 to 23.
'af+    e# Add the resulting digits to the character 'a'.
'c/     e# Split at occurrences of 'c' (used as separator).
=       e# Select the chunk that corresponds to the index.
_,9=    e# Check if its length is 9 (Floopdoor).
{\?}&   e# If so, swap and execute ternary if.
        e# Since the string " " is truthy, S Month Day ? -> Month.
(eu\    e# Shift out the first char, convert it to uppercase and swap.

Dennis

Posted 2015-07-24T14:27:32.970

Reputation: 196 637

5

SWI-Prolog, 237 232 213 bytes

a(X):-L=[22:"Qupu",39:"Blinkorp",63:"Paas",80:"Karpasus",81:"Floopdoor",109:"Dumaflop",141:"Lindilo",208:"Fwup"],nth1(I,L,A:B),X<A,J is I-1,(nth1(J,L,Z:_),Y=X-Z;Y=X),R is Y+1,(X=80,write(B);writef("%w %w",[R,B])).

Here we use Prolog's backtracking mechanism to repeatedly apply nth1/3 to the list L, to get the first element LastDay+1:MonthName of L for which X < LastDay+1 holds. We then look for the month immediately before this one in the list to evaluate the day of the month.

Fatalize

Posted 2015-07-24T14:27:32.970

Reputation: 32 976

5

Q, 134 146 Bytes

second cut -- program (146 bytes)

v:bin[l:0 22 39 63 80 81 109 141 208;x:(*)"I"$.z.x];1(,/)($)$[v=4;`;(1+x-l v)," "],`Qupu`Blinkorp`Paas`Karpasus`Floopdoor`Dumaflop`Lindilo`Fwup v;

first cut -- function (134 bytes)

{v:bin[l:0 22 39 63 80 81 109 141 208;x];(,/)($)$[v=4;`;(1+x-l v)," "],`Qupu`Blinkorp`Paas`Karpasus`Floopdoor`Dumaflop`Lindilo`Fwup v}

testing

q){v:bin[l:0 22 39 63 80 81 109 141 208;x];(,/)($)$[v=4;`;(1+x-l v)," "],`Qupu`Blinkorp`Paas`Karpasus`Floopdoor`Dumaflop`Lindilo`Fwup v} each 0 32 62 77 80 99 128 207
"1 Qupu"
"11 Blinkorp"
"24 Paas"
"15 Karpasus"
"Floopdoor"
"19 Dumaflop"
"20 Lindilo"
"67 Fwup"

scottstein37

Posted 2015-07-24T14:27:32.970

Reputation: 181

you're correct -- i edited the answer to make it a full program rather than a function and so that it prints to stdout w/o the quotation marks as per the question rules – scottstein37 – 2015-07-24T18:43:09.370

4

Julia, 231 216 184 175 bytes

r=readline()|>int
l=[141,109,81,80,63,39,22,0]
m=split("Qupu Blinkorp Paas Karpasus Floopdoor Dumaflop Lindilo Fwup")
i=findfirst(j->r>=j,l)
print(i==4?"":r-l[i]+1," ",m[9-i])

This reads a line from STDIN and converts it to an integer, finds the first element of a reversed list of month start days where the input is greater than or equal to the start, then prints accordingly.

Alex A.

Posted 2015-07-24T14:27:32.970

Reputation: 23 761

3

Swift 1.2, 256 bytes

var d=Process.arguments[1].toInt()!,f="Floopdoor",n=[("Qupu",22),("Blinkorp",17),("Paas",24),("Karpasus",17),(f,1),("Dumaflop",28),("Lindilo",32),("Fwup",67)]
for i in 0..<n.count{let m=n[i]
if d>=m.1{d-=m.1}else{println((m.0==f ?"":"\(d+1) ")+m.0)
break}}

To run put the code alone in a .swift file and run it using swift <filename> <inputNumber>

David Skrundz

Posted 2015-07-24T14:27:32.970

Reputation: 466

3

Java, 357 339 bytes

It's not the most efficient, but I do like how it works. It creates the entire Flooptonia calendar and then looks up what date the number is.

class X{public static void main(String[]q){String n[]={"Qupu","Blinkorp","Paas","Karpasus","Floopdoor","Dumaflop","Lindilo","Fwup"},l[]=new String[209];int m=0,d=0,i,b[]={0,22,39,63,80,81,109,141,208};for(i=0;i++<208;d++){l[i]=(m==4?"":d+" ")+n[m];if(i>b[m+1]){m++;d=0;}}System.out.print(l[new java.util.Scanner(System.in).nextInt()+2]);}}

Input/Output:

77 --> 15 Karpasus 80 --> Floopdoor

Spaced and tabbed out:

class X {
    public static void main(String[] q) {
        String n[] = { "Qupu", "Blinkorp", "Paas", "Karpasus", "Floopdoor", "Dumaflop", "Lindilo", "Fwup" },
          l[]=new String[209];
        int m = 0,
          d = 0,
          i,
          b[] = { 0, 22, 39, 63, 80, 81, 109, 141, 208 };
        for(i = 0; i++ < 208; d++) {
            l[i]=(m == 4 ? "" : d + " ") + n[m];
            if(i > b[m+1]){
                m++;
                d = 0;
            }
        }
        System.out.print(l[ new java.util.Scanner(System.in).nextInt() + 2 ]);
    }
}

DeadChex

Posted 2015-07-24T14:27:32.970

Reputation: 508

1I challenge you! View my answer! =) – Luigi Cortese – 2015-07-25T13:49:00.663

3

JavaScript using ES6 171 164 163 bytes

I'm not the best JavaScript programmer but I tried my best and ended up with the following code

f=(n)=>[0,22,39,63,80,81,109,141,208].some((e,j,a)=>n<a[j+1]&&(r=(j-4?n-e+1+' ':'')+"Qupu0Blinkorp0Paas0Karpasus0Floopdoor0Dumaflop0Lindilo0Fwup".split(0)[j]))&&r;

To see the result you need to refer above code in a html file and use similar to the code below

<html><body><p id="o"></p><script src="Fp.js"></script><script>t=[0,32,62,77,80,99,128,207];for(i=0;i<t.length;i++)document.getElementById('o').innerHTML+=f(t[i])+'<br/>';</script></body></html>

In the above code fp.js is the file that contains the javascript code.

Combined HTML and JavaScript code with indent is

        f=(n)=>[0,22,39,63,80,81,109,141,208].some(
          (e,j,a)=>n<a[j+1]&&(r=(j-4?n-e+1+' ':'')+"Qupu0Blinkorp0Paas0Karpasus0Floopdoor0Dumaflop0Lindilo0Fwup".split(0)[j]))
        &&r;
        
        
        t = [0, 32, 62, 77, 80, 99, 128, 207];
        for (i = 0; i < t.length; i++) 
            document.getElementById('o').innerHTML += f(t[i]) + '<br/>';

    
<html>
<body>
    <p id="o"></p>    
</body>
</html>

Edit:

I'd like to thank Vihan for helping me remove the return statement and reduce my code by 17bytes

@ipi, thanks for helping me save 7 bytes

Note: You can see the result only in browsers Firefox version 22+ and Google Chrome 45+ because of using ES6 arrow functions

Anandaraj

Posted 2015-07-24T14:27:32.970

Reputation: 51

@vihan1086, Thanks for your suggestion – Anandaraj – 2015-07-26T10:41:50.353

I don't have access to a browser with arrow notation support right now (so I haven't tested this) but you should be able to replace your month array with "Qupu0Blinkorp0Paas0Karpasus0Floopdoor0Dumaflop0Lindilo0Fwup".split(0) and save 7 bytes. – Sean Latham – 2015-07-29T10:17:04.713

Thanks ipi, i was splitting by a space, but the zero saved me two bytes! You must write a complete program I think this has to run alone, you might have to use something like prompt(). – Vartan – 2015-07-30T20:31:53.667

@ipi, Thanks for your comment – Anandaraj – 2015-07-31T16:08:36.980

@Vartan, Thanks to your answer, I saved 1 byte – Anandaraj – 2015-07-31T16:10:49.753

glad it helped. I still think you need to add something like ;alert(f(prompt())) to meet the complete program requirement – Vartan – 2015-07-31T21:03:47.600

@Vartan, JavaScript is never complete without HTML except in few cases like node.js. Both of our codes will not work without HTML. I thought about using it as an expression but for some reason I ended up using a function I don't know why. – Anandaraj – 2015-08-01T07:06:59.980

3

Java, 275 269 266 257 256 252 246 244 243 bytes

class X{public static void main(String[]w){int x=new Short(w[0]),i=1,a[]={-1,21,38,62,79,80,108,140,207};w="Qupu,Blinkorp,Paas,Karpasus,Floopdoor,Dumaflop,Lindilo,Fwup".split(",");while(x>a[i++]);System.out.print((i==6?"":x-a[i-=2]+" ")+w[i]);}}

Formatted:

class X {
    public static void main(String[] w) {
        int x = new Short(w[0]), 
            i = 1, 
            a[] = { -1, 21, 38, 62, 79, 80, 108, 140, 207 };
            w = "Qupu,Blinkorp,Paas,Karpasus,,Dumaflop,Lindilo,Fwup".split(",");
        while (x > a[i++]);
        System.out.print(i == 6 ? "Floopdoor" : x - a[i-=2] + " " + w[i]);
    }
}

Interestingly, it's a few bytes shorter than this

class X {
    public static void main(String[] w) {
        int x = new Short(w[0]);
        System.out.print(x < 22 ? x + 1 + " Qupu" : x < 39 ? x - 21
                + " Blinkorp" : x < 63 ? x - 38 + " Paas" : x < 80 ? x - 62
                + " Karpasus" : x < 81 ? "Floopdoor" : x < 109 ? x - 80
                + " Dumaflop" : x < 141 ? x - 108 + " Lindilo" : x < 208 ? x
                - 140 + " Fwup" : "");
    }
}

Luigi Cortese

Posted 2015-07-24T14:27:32.970

Reputation: 131

Well played Luigi! – DeadChex – 2015-07-25T15:50:52.840

1Save 6 bytes with "new Short(w[0])" instead of "Integer.valueOf(w[0])". – Olivia Trewin – 2015-07-25T20:30:46.930

@AndrewTrewin great tip, thank you! – Luigi Cortese – 2015-07-25T20:41:36.453

2

Python 2, 168 bytes

n=input();e=[-1,21,38,62,80,108,140,207];m=1
while n>e[m]:m+=1
print[`n-e[m-1]`+' '+'Qupu Blinkorp Paas Karpasus Dumaflop Lindilo Fwup'.split()[m-1],'Floopdoor'][n==80]

This treats day 80 internally as 18 Karpasus, but then ignores it when called to print. Also, Python 2's input() function (as opposed to raw_input()) was convenient here.

mathmandan

Posted 2015-07-24T14:27:32.970

Reputation: 943

2

Perl 5, 140

Requires running via perl -E:

$i=<>+1;$i-=$b=(22,17,24,17,1,28,32,67)[$c++]while$i>0;say$b>1&&$i+$b.$",(x,Qupu,Blinkorp,Paas,Karpasus,Floopdoor,Dumaflop,Lindilo,Fwup)[$c]

Test output (stolen test code from @Dennis):

$for d in 0 32 62 77 80 99 128 207; do perl -E '$i=<>+1;$i-=$b=(22,17,24,17,1,28,32,67)[$c++]while$i>0;say$b>1&&$i+$b.$",(x,Qupu,Blinkorp,Paas,Karpasus,Floopdoor,Dumaflop,Lindilo,Fwup)[$c]' <<< $d; echo; done
1 Qupu

11 Blinkorp

24 Paas

15 Karpasus

Floopdoor

19 Dumaflop

20 Lindilo

67 Fwup

Dom Hastings

Posted 2015-07-24T14:27:32.970

Reputation: 16 415

2

Haskell, 171 167 bytes

main=interact$f.read
f 80="Floopdoor"
f n=(g=<<zip[22,17,24,18,28,32,67](words"Qupu Blinkorp Paas Karpasus Dumaflop Lindilo Fwup"))!!n
g(n,s)=map((++' ':s).show)[1..n]

The program reads it's input from stdin which must not end in NL. Terminate input with EOF/^D or use something like echo -n 80 | ./what-day-is-it. (Some echos don't understand the -n switch and omit the NL by default).

How it works: The main function reads the input, converts it to an Integer and calls f which returns a literal Floopdoor in case of an input of 80 or builds up a list of all possible dates, i.e. ["1 Qupu", "2 Qupu", ... "1 Blinkorp", ... "67 Fwup"] from which it picks the nth element. I make Karpasus is one day longer. 18 Karpasus is at position 80 and fixes the missing Floopdoor in the list.

Edit: @MtnViewMark had the idea of the 18 Karpasus trick and saved 4 bytes.

nimi

Posted 2015-07-24T14:27:32.970

Reputation: 34 639

I think you can save 4 bytes by pretending Karpasus is 18 days long, removing ,1 and x - since 80 will be caught by the pattern match for it. – MtnViewMark – 2015-07-25T15:51:04.390

@MtnViewMark: very clever. Thanks a lot. – nimi – 2015-07-26T08:56:33.427

1

Swift 2.0, 220 bytes

Nothing clever, just filters from a collection of tuples...

func d(n:Int)->String{return n==80 ?"Floopdoor":[("Qupu",21,0),("Blinkorp",38,22),("Paas",62,39),("Karpasus",79,63),("Dumaflop",108,81),("Lindilo",140,109),("Fwup",208,141)].filter{$0.1>=n}.map{"\($0.0) \(n-$0.2+1)"}[0]}

Edited to correct bug, removed a space

GoatInTheMachine

Posted 2015-07-24T14:27:32.970

Reputation: 463

5"You must write a complete program." So it can't be a function. – Alex A. – 2015-07-24T15:54:38.040

1

JavaScript (ES6 on Node.js), 196 bytes

Takes one command line argument:

a=+process.argv[2];for(d of['22Qupu','17Blinkorp','24Paas','17Karpasus','01Floopdoor','28Dumaflop','32Lindilo','67Fwup']){if(a<(z=parseInt(d)))return console.log((z>1?a+1+' ':'')+d.slice(2));a-=z}

Demo

As there is no command-line argument (process.argv) in the browser, the code in the snippet has been placed in a function that accepts an argument:

// Snippet stuff
console.log = function(x){O.innerHTML += x + '\n'};

// Flooptonia function
function flooptonia(a) {
  a = +a;
  for (d in y=['22Qupu', '17Blinkorp', '24Paas', '17Karpasus', '01Floopdoor', '28Dumaflop', '32Lindilo', '67Fwup']) {
    if (a < (z = parseInt(y[d]))) return console.log((z > 1 ? a + 1 + ' ' : '') + y[d].slice(2));
    a -= z
  }
}

// Test
['0', '32', '62', '77', '80', '99', '128', '207'].map(flooptonia);
Test values: [0, 32, 62, 77, 80, 99, 128, 207]

<pre id=O></pre>

rink.attendant.6

Posted 2015-07-24T14:27:32.970

Reputation: 2 776

1

Swift 2.0, 215 204

let(n,t)=(Int(readLine()!)!,[(141,"Fwup"),(109,"Lindilo"),(81,"Dumaflop"),(63,"Karpasus"),(39,"Paas"),(22,"Blinkorp"),(0,"Qupu")])
print({(n==80 ?"Floopdoor":"\(n-$0.0+1) "+$0.1)}(t[t.indexOf{$0.0<=n}!]))

This is a full program which asks the user to input the number in STDIN.

Kametrixom

Posted 2015-07-24T14:27:32.970

Reputation: 426

1

Matlab, 187 bytes

d=input('');l=[141 109 81 80 63 39 22 0];t=find(d>=l,1);m=strsplit('Fwup Lindilo Dumaflop Floopdoor Karpasus Paas Blinkorp Qupu');f='%d %s';if t==4;f='%d\b%s';end;fprintf(f,d-l(t)+1,m{t})

Expanded version:

d=input('');
l=[141 109 81 80 63 39 22 0];
t=find(d>=l,1);
m=strsplit('Fwup Lindilo Dumaflop Floopdoor Karpasus Paas Blinkorp Qupu');
f='%d %s';
if t==4;
    f='%d\b%s';
end
fprintf(f,d-l(t)+1,m{t})

Reads a line from the console (stdin), finds the first element of a reversed list of month start days where the input is greater than or equal to the array element, then prints accordingly.

This is almost identical to the Julia answer, except for the display stage. (We can't beat their ternary operator, unavailable in Matlab). To make up having to explicit a full if statement, we use a little trick (a Backspace character in the print format) to "erase" the number 1 for the special day/month Floopdoor


In collaboration with the Matlab and Octave chat participants.

Hoki

Posted 2015-07-24T14:27:32.970

Reputation: 271

1

Javascript ES5 using 168 bytes

m=[-1,21,38,62,79,80,108,140];for(n=prompt(i=0);n>m[i+1]&&i++<8;);alert((i-4?n-m[i]+" ":"")+"Qupu0Blinkorp0Paas0Karpasus0Floopdoor0Dumaflop0Lindilo0Fwup".split(0)[i])

Ungolfed:

m=[-1,21,38,62,79,80,108,140];   // create range of starting indexes - 1

for(                             // begin for loop
  n=prompt(i=0);                 // initialize i to zero and prompt user
  n>m[i+1] && i++ < 8;           // exit if n>0; increment i; exit if i was < 8
  );                             // end for loop

alert(
  (i-4 ? n-m[i]+" ":"") + // special floopdoor case
  "Qupu0Blinkorp0Paas0Karpasus0Floopdoor0Dumaflop0Lindilo0Fwup".split(0)[i]);

  //^  create an array of strings by splitting at zero. Then, select element i

Vartan

Posted 2015-07-24T14:27:32.970

Reputation: 231

0

C, 241 bytes

Nothing too exciting. Could have shaved 27 bytes had it require to be a complete program.

main(c,s)char**s;{c=atoi(s[1]);c-80?printf("%d ",c<22?c+1:c<39?c-21:c<63?c-38:c<80?c-62:c<109?c-80:c<141?c-108:c-140):0;puts(c<22?"Qupu":c<39?"Blinkorp":c<63?"Paas":c<80?"Karpasus":c<81?"Floopdoor":c<109?"Dumaflop":c<141?"Lindilo":"Fwup");}

some user

Posted 2015-07-24T14:27:32.970

Reputation: 635