Author Topic: [ENDED] Code Golf Contest #7  (Read 25791 times)

0 Members and 1 Guest are viewing this topic.

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
Re: Code Golf Contest #7
« Reply #30 on: August 30, 2014, 09:35:50 pm »
Even if a command already existed to do this, you can't even write "code" in three characters.



Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Code Golf Contest #7
« Reply #31 on: August 30, 2014, 10:41:58 pm »
Well, if you had a language that had sub-byte commands, like SysRPL, you could implement something that would, at the very least, loop a bit.

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 #7
« Reply #32 on: August 30, 2014, 11:44:05 pm »
Okay, I think I know how. Here's my guess.

Your file consists of "a();" and you compile it with gcc cheat.c -o cheat -D'a()=insert whole code here'.

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 alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: Code Golf Contest #7
« Reply #33 on: September 01, 2014, 12:20:49 pm »
Okay, I think I know how. Here's my guess.

Your file consists of "a();" and you compile it with gcc cheat.c -o cheat -D'a()=insert whole code here'.
Correct! Almost!

This is what it looks like:
Code: (test-noincl-crazy.c) [Select]
a
b

Code: (Makefile.crazy) [Select]
all:
        gcc test-noincl-crazy.c \
           -include "stdio.h" \
           -D'f=for(i=0;i<4;i++){' \
           -D'a=char s[255],*p,r[4],i=0,x=0,c[]="code";' \
           -D'b=void main(){fgets(s,255,stdin);f p=strchr(s+x,c[i]);if(!p){printf("0\n");return;}x=p-s;r[i]=x+1;}f printf("%i\n",r[i]);}}' \
           -o test

To build: Place the two files in the same directory, and run make -f Makefile.crazy. Requires GCC and make.

Again, this was NOT a valid entry, and was just submitted for fun and games! :)
But if there's any lesson from this, it's that C macros are very, very powerful! :D
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

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 #7
« Reply #34 on: September 01, 2014, 11:40:37 pm »
There it is! :D

Oh, and I actually was able to cut 3 bytes from my GS solution...yet TI-BASIC was stil victorious.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

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 #7
« Reply #35 on: September 01, 2014, 11:46:46 pm »
Quote
[11:31:08 PM]   JWinslow23   Yes...1984.
[11:34:35 PM]   JWinslow23   Welp, got a TI-BASIC solution to 177 bytes.

O.O


EDIT: Wait nvm the first part was about another thing on IRC. I just saw your post now. I thought you went from a 1984 bytes solution to 177 lol XD

Offline lirtosiast

  • LV3 Member (Next: 100)
  • ***
  • Posts: 44
  • Rating: +1/-0
    • View Profile
Re: Code Golf Contest #7
« Reply #36 on: June 10, 2015, 11:04:23 am »
Sorry for the necro.

Improving slightly (50->47) on JWinslow23's excellent TI-BASIC answer:

Input Str1
1
For(X,1,4
inString(Str1,sub("CODE",X,1),Ans
If not(Ans
ClrHome
Disp Ans
If Ans
End
« Last Edit: June 10, 2015, 11:42:35 pm by lirtosiast »