Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
optimization challenge
#1
i've been making a brainf*ck like thing for FB, theres loads of room for creative thinking and crazy optimizations in this type of language, and i have two pieces of code to set as a challenge. i've done a little optimization but im sure theres room for more.

heres the interpreter

http://www.streetcds.co.uk/cw_0_1.bas

here are the challenges, choose at your leisure.

you can copy and paste these into the interpreter. least number of symbols is the challenge.

Code:
' Emulate Shell "PAUSE"
    '  This is the equivalent code
    '    Print "Press any key to continue . . . ";
    '    GetKey
    '    Print chr(10);
    '    End
    '  For the challenge, machine must be returned to
    '  pre-existing state, and must include @ to end.
    
    strcpy(@code, "£a£b£c£d£0+++D++llll")
    strcat(@code, ".0+llll-lll------.A-")
    strcat(@code, "---C---------.a+..0l")
    strcat(@code, "llll.Bdlllll+.c.a++£")
    strcat(@code, "+++++.£b.c---.------")
    strcat(@code, ".$.b.$.-----.b.dlll£")
    strcat(@code, "+ll£-.c+.£-.a++.----")
    strcat(@code, "-------.$-.+++++++.$")
    strcat(@code, "+.b.$-l.££b.$.b.$.b.")
    strcat(@code, ",0+lll++.$D$C$B$A$@ ")  ' 199 Instructions

Code:
' Get users name and say hello
    ' machine must be returned to
    ' pre-existing state, except reg c (should contain string len)
    ' and reg d that you can use any way you like
    ' string should still exist in memory and be null terminated
    ' program must include @ to end.

    strcpy(@code, "£a£b£c£d£0+lll-llll-")
    strcat(@code, "--A0+ll+llll---B0b++")
    strcat(@code, "+.a-.-------.C----.a")  
    strcat(@code, "++++++.c.-rr+++++++.")
    strcat(@code, "Ba+++++++.+++++.Da++")    
    strcat(@code, "+.c.b.d.c++++++++++.")  
    strcat(@code, "d----.---.b.a+.c----")
    strcat(@code, ".a.c.br------.bl--.0")
    strcat(@code, "C+[,.D----------:c+C")
    strcat(@code, "d>+]£cB$£0A$Db[£0+A$")
    strcat(@code, "d<D£b-B:$]Ba[$D0]bd£")
    strcat(@code, "0+lll+lll.0+++lllll+")
    strcat(@code, "++++.+++++++..+++.0+")
    strcat(@code, "lllll.£cB$$D£c[d.>Dc")
    strcat(@code, "-C]d$d£0+lll++.$£bC$")
    strcat(@code, "Db[-Bd<Db]d$$$B$A$d@") ' 320 Instructions
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)