Author Topic: [ENDED] Code Golf Contest #4  (Read 22314 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Code Golf Contest #4
« Reply #15 on: August 07, 2014, 05:14:39 pm »
Wow, I didn't know there were people here doing SysRPL O.O.

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: Code Golf Contest #4
« Reply #16 on: August 07, 2014, 06:20:55 pm »
71 bytes of Haskell. :D
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline 3298

  • LV2 Member (Next: 40)
  • **
  • Posts: 26
  • Rating: +1/-0
    • View Profile
Re: Code Golf Contest #4
« Reply #17 on: August 08, 2014, 04:48:39 am »
Quote from: JWinslow23
Actually, there are 2-byte tokens in TI-BASIC, and lots of them. That is part of the reason why we don't like lowercase letters. :P
Yes, of course, there's more than 256 commands, so 2-byte tokens are necessary. Casio does the same, by the way, On my old calculators there were 2 categories of 2-byte tokens (each beginning with its own prefix byte), later calculators, such as the 9860 series, expanded that. The 9860 series somewhen (I think it was also with OS 2.00) also introduced lowercase letters, and guess what? they use 2-byte tokens, >:( I noticed that when I got a program including these sent to my 9750 from a 9860. All lowercase letters were converted to sequences of two tokens each because they used a prefix which wasn't present in the old calcs.
 The funniest thing is: At least on the old calculators there actually were 1-byte lowercase letters in the usual ASCII range, it was just impossible to type them. But once you got them through a cable or through one of the 9x50 series' at least 3 different bugs allowing you to edit memory directly, you could copy them anywhere you want through a rudimentary 6-slot clipboard called function memory.
There were other instances of such Casio silliness: in addition to the lowercase letters, some special characters were impossible to type, but they could be displayed. This includes the => token on the AFX series, which behaves like a shorter If. Other calculators can type them (including the 9860 series released after the AFX), and they work fine on the AFX, but they are not in the menus. A trick to get it is to send it from a 9x50 series calc through the undocumented and hidden compatibility receive mode (the AFX normally uses a slightly different protocol at slightly higher speed).
More silliness: Casio introduced a second program type for base-n (n=2, 8, 10 or 16) calculations. These use a tiny special command set, disallow use of most normal commands, and round numbers to integers automatically. Though with the same tricks you can get these commands into normal programs, and they seem to behave normally, excluding auto-rounding. (The function memory is disabled in base-n programs, so copying them directly is impossible.)

In the end, I mostly went away from those stupid Casio calcs. HP calcs, especially the 48/49/50 series, are much more capable. The Prime looks nice too (fast programs, color screen), but it apparently has lots of bugs, no RPN programmability, a way too small keyboard (no digit input in alpha mode, one less shift key), Casio-style icon menus and more. I'm staying with the 50G, the Prime isn't worth the money.
Quote from: JWinslow23
Looks like things are getting pretty heated in the Haskell category! 3298 and bb010g are slashing bytes like crazy! Only thing to wonder now is, when will they stop? (And will it be before the competition's over?)
This could be the end, considering that we have the same score now. Maybe we hit the global optimum. ;)

Edit: Just because I can, I made an x86 ASM version. I didn't expect it to become small, and it's much bigger than anything mentioned here. :/ Oh well, it's not a suitable language for Code Golf. I'm not submitting it, so if you want to see the source, ask me.
 I use just the Unix sys_write and sys_exit calls, no trickery with the C standard library. It compiles to 838 bytes, and after treating it with strip, it's at 444. The source is 516 bytes long, but I could get rid of some formatting to get that down to 465, maybe even further.
 
« Last Edit: August 08, 2014, 07:07:19 am by 3298 »

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Code Golf Contest #4
« Reply #18 on: August 08, 2014, 11:24:57 am »
3 days left! Anyone wanna take a stab at the first ever Axe entry?
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: Code Golf Contest #4
« Reply #19 on: August 08, 2014, 01:33:50 pm »
Quote from: JWinslow23
Looks like things are getting pretty heated in the Haskell category! 3298 and bb010g are slashing bytes like crazy! Only thing to wonder now is, when will they stop? (And will it be before the competition's over?)
This could be the end, considering that we have the same score now. Maybe we hit the global optimum. ;)
70 bytes. ;D
Edit: Just because I can, I made an x86 ASM version. I didn't expect it to become small, and it's much bigger than anything mentioned here. :/ Oh well, it's not a suitable language for Code Golf. I'm not submitting it, so if you want to see the source, ask me.
 I use just the Unix sys_write and sys_exit calls, no trickery with the C standard library. It compiles to 838 bytes, and after treating it with strip, it's at 444. The source is 516 bytes long, but I could get rid of some formatting to get that down to 465, maybe even further.
Why not submit it? It's an entry, even if the language is verbose.

EDIT: BOO YAH! 68 bytes, same as Perl. :w00t:
« Last Edit: August 08, 2014, 01:55:14 pm by bb010g »
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Code Golf Contest #4
« Reply #20 on: August 08, 2014, 02:13:38 pm »
Oh dang. XD

3298, care to rebut?
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline pimathbrainiac

  • Occasionally I make projects
  • Project Author
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Code Golf Contest #4
« Reply #21 on: August 08, 2014, 02:19:26 pm »
285 bytes of C
Wait that doesn't work...

I'm going to work on a smaller Java solution, though :P
« Last Edit: August 08, 2014, 02:27:43 pm by pimathbrainiac »
I am Bach.

Offline 3298

  • LV2 Member (Next: 40)
  • **
  • Posts: 26
  • Rating: +1/-0
    • View Profile
Re: Code Golf Contest #4
« Reply #22 on: August 09, 2014, 06:14:29 am »
Well, I could remove the _ in mapM_ if some garbage looking like [(),(),(),()] below the output is okay. But other than that, I ran out of ideas.
In other news, I reduced my Java program size by 4 bytes, so I claim the first place in that category again. :P The XTend entry is also reduced by 7 bytes. And finally there is a new C entry with 154 bytes.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Code Golf Contest #4
« Reply #23 on: August 09, 2014, 02:10:32 pm »
IOCCC, anyone? :P
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Code Golf Contest #4
« Reply #24 on: August 09, 2014, 02:21:56 pm »
Is it okay if the output starts with a newline?

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Code Golf Contest #4
« Reply #25 on: August 09, 2014, 03:15:21 pm »
IOCCC, anyone? :P
Well yes.

Also my output is surroundered by double quotes and JWin don't seem to care.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Code Golf Contest #4
« Reply #26 on: August 09, 2014, 03:22:33 pm »
IOCCC, anyone? :P
Well yes.

Also my output is surroundered by double quotes and JWin don't seem to care.
Well, it shouldn't matter as long as it is a correct output.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: Code Golf Contest #4
« Reply #27 on: August 09, 2014, 05:54:15 pm »
Well, I could remove the _ in mapM_ if some garbage looking like [(),(),(),()] below the output is okay. But other than that, I ran out of ideas.
In other news, I reduced my Java program size by 4 bytes, so I claim the first place in that category again. :P The XTend entry is also reduced by 7 bytes. And finally there is a new C entry with 154 bytes.
That should be fine; I did so. That last byte is a killer, though.

* bb010g pokes JWinlow23 to remove the underscore from 3298's answer
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Code Golf Contest #4
« Reply #28 on: August 09, 2014, 05:58:43 pm »
Well, I could remove the _ in mapM_ if some garbage looking like [(),(),(),()] below the output is okay. But other than that, I ran out of ideas.
In other news, I reduced my Java program size by 4 bytes, so I claim the first place in that category again. :P The XTend entry is also reduced by 7 bytes. And finally there is a new C entry with 154 bytes.
That should be fine; I did so. That last byte is a killer, though.

* bb010g pokes JWinlow23 to remove the underscore from 3298's answer
I did. Did you see the size change? :P
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: Code Golf Contest #4
« Reply #29 on: August 09, 2014, 06:00:03 pm »
Well, I could remove the _ in mapM_ if some garbage looking like [(),(),(),()] below the output is okay. But other than that, I ran out of ideas.
In other news, I reduced my Java program size by 4 bytes, so I claim the first place in that category again. :P The XTend entry is also reduced by 7 bytes. And finally there is a new C entry with 154 bytes.
That should be fine; I did so. That last byte is a killer, though.

* bb010g pokes JWinlow23 to remove the underscore from 3298's answer
I did. Did you see the size change? :P
* bb010g derps
Thought he was at 70 instead of 71 before. :(
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE