Author Topic: Code Golf: The Reboot #4  (Read 12135 times)

0 Members and 1 Guest are viewing this topic.

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
Code Golf: The Reboot #4
« on: June 22, 2015, 12:00:01 am »
Welcome to this week's Code Golf: The Reboot, the fourth incarnation of the challenge hosted by myself, Juju. Not @pimathbrainiac, @c4ooo nor @JWinslow23, the one and only @Juju. I have a situation for you tonight. Let's say you have a car. Unfortunately, you left your set of keys on the seat, and the car is locked. "Oh no, I locked my keith inside", you say, with a strong lisp. However, your car came with a numerical lock, five (5) keys numbered from 1 to 5 that can replace your keys if needed, no need to call the AAA, OnStar or whatever it's called in your country. The car is rather new and you didn't had time to check the manual for the default code and how to set it, but you know the code is four (4) numbers long and the lock checks after every keypress, as in, if you enter successively 1-2-3-4-5-1, it checks against the codes 1234, 2345 and 3451. You don't really have the time to try every combination one after the other, but you know of a sequence that will check against every code successively in a minimal number of keypresses, the de Bruijn sequence, as it's called. You have your calc/smartphone/laptop on you, as you've been taught to carry no less than 5 computers on you at all times, like a sensible person, so you write a little program to compute such a sequence and try it out.

Here's a sample output:
Code: [Select]
11112111311141115112211231124112511321133113411351142114311441145115211531154115
51212131214121512221223122412251232123312341235124212431244124512521253125412551
31314131513221323132413251332133313341335134213431344134513521353135413551414151
42214231424142514321433143414351442144314441445145214531454145515152215231524152
51532153315341535154215431544154515521553155415552222322242225223322342235224322
44224522532254225523232423252333233423352343234423452353235423552424252433243424
35244324442445245324542455252533253425352543254425452553255425553333433353344334
53354335534343534443445345434553535443545355435554444544554545555

The cyclic sequence (as in, it wraps around so at the end it's really ...4555511112...) should contain every 4-number sub-sequence as described above exactly once per cycle. Your output don't have to be exactly this, as in there's many, many sequences with the above properties, but it should have the same length. Also, no newlines other than where it should wrap around on the screen (I've put some here because it would mess up this post, don't do that at home). Your challenge is, of course, write the smallest program that generates such sequence. If the sequence don't fit it all on the screen, like on calcs, you can implement a pager (like less on UNIX systems) or output a string that can be scrolled, or anything that could work, be sure to ask me if you're not sure and tell instructions if it's not immediately obvious or requires user action.

All the usual rules applies, like no loopholes. All non-calc languages will be scored with this counter I wrote for your convenience. Assembly and compiled Axe programs will be scored on binary size (minus the header), and TI-BASIC will be scored on on-calc source size (again, minus the header). PM me with your submission on Omnimaga and/or CodeWalrus, on every private messaging system you know you can reach me or if you know where I live or know me IRL, bring me a 3.5" floppy disk with the source enclosed. (Seriously, that would be epic and would definitely allow you a bonus.) I'll also count out the number of keypresses it took you to get to a particular code I won't disclose until the end, but it's just for fun :P And if you wanna get involved, I suggest you to check this thread.

Good luck and have fun! You have until next Sunday, 11:59:59 PM EDT.

Next week with @JWinslow23, you found your keys, but you can't figure out which one it is...

Scores
 
Language Ranking
RankLangUserSizeDateCode
1Ruby@Juju1632015/06/22 15:29:00
Spoiler For Spoiler:
Code: [Select]
[/spoiler]



Ruby
RankUserSizeDate
1Juju1632015/06/22 15:29:00

Unfortunately, no one submitted any entry, no one got the key... And I win by default, apparently. I'll post my code soon, and you still can submit an entry at a later date.
« Last Edit: June 29, 2015, 12:18:43 am by Juju »

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 Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: Code Golf: The Reboot #4
« Reply #1 on: June 22, 2015, 08:52:07 pm »
I might not be able to submit an entry because I have no idea how to generate de Bruijn sequences XD

I'll still make an attempt, though

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

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: The Reboot #4
« Reply #2 on: June 22, 2015, 11:46:57 pm »
I might not be able to submit an entry because I have no idea how to generate de Bruijn sequences XD

I'll still make an attempt, though
There's a lot of code and algorithms over the internet that generates de Bruijn sequences, I know it's kinda hard to come up with an algorithm yourself, so check one that already exists, study it and make your own golfed implementation. That's kind of the point. The Wikipedia page for the sequence describes a Python implementation, I think it's a good starting point.

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 Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Code Golf: The Reboot #4
« Reply #3 on: June 23, 2015, 11:23:30 am »
For those who want to test their solutions, you can feed your result to this program. It will output each sequence that shows up more than once or not at all with a list of the indices at which it shows up. Note that the program may take a few seconds to complete; when it's done, the "Run" button will be re-enabled.

For example, here's the output I get by deleting a random character from the example output in the first post:
Code: [Select]
1441 [58 271]
1442 ""
2144 ""
4144 [273 281]
4214 ""
4414 [272 280]
4421 ""

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: The Reboot #4
« Reply #4 on: June 25, 2015, 11:08:50 pm »
Reminder that I only recieved one entry. And it's mine. ._.

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: The Reboot #4
« Reply #5 on: June 26, 2015, 08:02:24 am »
Reminder that I only recieved one entry. And it's mine. ._.
I dunno about this for a challenge, really. Not many people understand how to make that kind of stuff :P

...I'll do SOMETHING in GS or CJam. it hasn't been a few minutes and I barely understand the algs out there, and I don't wanna steal already-golfed answers from StackExchange
« Last Edit: June 26, 2015, 08:17:47 am by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline c4ooo

  • Project Author
  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 252
  • Rating: +10/-1
  • The impossible chemical compound.
    • View Profile
Re: Code Golf: The Reboot #4
« Reply #6 on: June 27, 2015, 12:38:25 pm »
There seems to not be much activity :(
On a side note, i dove by "keith road" today, ile see if i can get a pic of it on the way back XD
-German Kuznetsov
The impossible chemical compound.

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: The Reboot #4
« Reply #7 on: June 27, 2015, 01:24:28 pm »
Well, no matter the activity on this one, this is only a minor hiccup. It's just a note to future challenge makers on what to try and avoid in their challenges: stuff people don't know about and is hard to do even if you do know about.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

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: The Reboot #4
« Reply #8 on: June 28, 2015, 03:33:58 am »
Well, I did it myself and had no idea how to do it before, and thought the algorithm isn't that hard and easy to golf, figured you guys could do it... Oh well.

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 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: The Reboot #4
« Reply #9 on: June 29, 2015, 12:19:47 am »
Well, no one entred, that's a bummer. Thought you guys would do it anyway... Oh well. Stay tuned for the next code golf hosted by @JWinslow23 !

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 TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Code Golf: The Reboot #4
« Reply #10 on: June 29, 2015, 02:10:11 am »
I *think* I got the idea, but I've been really sick this week. Didn't have a chance to attempt anything.

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: The Reboot #4
« Reply #11 on: June 29, 2015, 04:15:37 pm »
Challenge has been posted and crossposted!
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?