I was bored, drunk and tired

MouseMouse The Lighter Side of Pessimism Join Date: 2002-03-02 Member: 263Members, NS1 Playtester, Forum Moderators, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
edited October 2006 in Off-Topic
<div class="IPBDescription">and I had a C++ assignment open</div>So I replaced most of the function calls in a <a href="http://en.wikipedia.org/wiki/Slerp" target="_blank">Slerp</a> function I'd written with the actual code from the functions and removed as much whitespace as I could.

Someone let me know if I've missed a bracket somewhere.

Comments

  • KurtKurt Join Date: 2005-05-19 Member: 51960Members
    edited January 2007
  • AlignAlign Remain Calm Join Date: 2002-11-02 Member: 5216Forum Moderators, Constellation
    Isn't there a programming language called Brain F*** meant for these kind of things?
  • CodemanCodeman Join Date: 2002-11-21 Member: 9497Members, Constellation, Reinforced - Shadow
    just wait until you sober up and try to understand it rofl
  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
    <a href="http://www.cs.utah.edu/~elb/folklore/mel.html" target="_blank">http://www.cs.utah.edu/~elb/folklore/mel.html</a>


    mel pwns ju
  • MouseMouse The Lighter Side of Pessimism Join Date: 2002-03-02 Member: 263Members, NS1 Playtester, Forum Moderators, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    I wasn't quite that dumb coed <img src="style_emoticons/<#EMO_DIR#>/biggrin-fix.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin-fix.gif" />, atm its actually commented out below the original function.
    Something for my lecturer to stumble across while he's marking it <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />
  • BlackMageBlackMage [citation needed] Join Date: 2003-06-18 Member: 17474Members, Constellation
    taken from a perl module that checks for email address well-formedness (http://search.cpan.org/~maurice/Email-Valid/Valid.pm)

    "This module determines whether an email address is well-formed, and optionally, whether a mail host exists for the domain."

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--># Regular expression built using Jeffrey Friedl's example in
    # _Mastering Regular Expressions_ (http://www.ora.com/catalog/regexp/).

    $RFC822PAT = <<'EOF';
    [\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\
    xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf
    f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\x
    ff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015
    "]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\
    xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80
    -\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*
    )*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\
    \\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\
    x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x8
    0-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n
    \015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x
    80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^
    \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040
    \t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([
    ^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\
    \\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\
    x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-
    \xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()
    ]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\
    x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\04
    0\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\
    n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\
    015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?!
    [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\
    ]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\
    x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\01
    5()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)<>@,;:".
    \\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]
    )|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^
    ()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\0
    15()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][
    ^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|"[^\\\x80-\xff\
    n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>@,;:".\\\[\]\
    x80-\xff\000-\010\012-\037]*)*<[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?
    :(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-
    \xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:@[\040\t]*
    (?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015
    ()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()
    ]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\0
    40)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\
    [^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\
    xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*
    )*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80
    -\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x
    80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t
    ]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\
    \[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])
    *\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x
    80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80
    -\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015(
    )]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\
    \x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*@[\040\t
    ]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\0
    15()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015
    ()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(
    \040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|
    \\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80
    -\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()
    ]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x
    80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^
    \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040
    \t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".
    \\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff
    ])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\
    \x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x
    80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015
    ()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\
    \\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)?(?:[^
    (\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-
    \037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\
    n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|
    \([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))
    [^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff
    \n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\x
    ff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(
    ?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\
    000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\
    xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\x
    ff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)
    *\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*@[\040\t]*(?:\([^\\\x80-\x
    ff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-
    \xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)
    *(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\
    ]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]
    )[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-
    \xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\x
    ff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(
    ?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80
    -\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<
    >@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x8
    0-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:
    \([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]
    *(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)
    *\)[\040\t]*)*)*>)
    EOF

    $RFC822PAT =~ s/\n//g;<!--c2--></div><!--ec2-->
  • GlissGliss Join Date: 2003-03-23 Member: 14800Members, Constellation, NS2 Map Tester
    01101001001000000110000101101101001000000111001001101111011000100110111101110100
  • ToneeTonee Wub wuB UK Join Date: 2003-10-25 Member: 21926Members, Constellation
  • mrTheftermrThefter Join Date: 2006-10-02 Member: 58053Members
    edited October 2006
    This is lovely.
    True hackers.

    It took me 20 min to understand that mel article.

    I'm afraid the other stuff is still too complicated for me. I'm only a C/C++/Java/Python/Pawn programmer.
  • SoulSkorpionSoulSkorpion Join Date: 2002-04-12 Member: 423Members
    *grin* nice. My maths is far worse than my C++, so I'm not going to try to unravel it properly.

    The variable names are still legible, though, so it's not quite <a href="http://www.ioccc.org/" target="_blank">IOCCC</a>-level unreadable.
  • BlackMageBlackMage [citation needed] Join Date: 2003-06-18 Member: 17474Members, Constellation
    screw the iocc, my code snippet was lifted out of <a href="http://www.cpan.org/" target="_blank">cpan</a>
  • KurtKurt Join Date: 2005-05-19 Member: 51960Members
    That's why most applications don't follow RFCs correctly. <img src="style_emoticons/<#EMO_DIR#>/wink-fix.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink-fix.gif" />

    Incorporating a regex that long would cause fellow developers to soil themselves
  • BlackMageBlackMage [citation needed] Join Date: 2003-06-18 Member: 17474Members, Constellation
    we *could* try just sending the message off and hoping it gets to wherever it was supposed to go but that would be logical.
  • Private_ColemanPrivate_Coleman PhD in Video Games Join Date: 2002-11-07 Member: 7510Members
    <!--quoteo(post=1570809:date=Oct 22 2006, 10:54 AM:name=Princess_of_Power)--><div class='quotetop'>QUOTE(Princess_of_Power @ Oct 22 2006, 10:54 AM) [snapback]1570809[/snapback]</div><div class='quotemain'><!--quotec-->
    01101001001000000110000101101101001000000111001001101111011000100110111101110100
    <!--QuoteEnd--></div><!--QuoteEEnd-->

    That's too advanced for me, PJ. All the other stuff I could understand, but this one's got me stumped <img src="style_emoticons/<#EMO_DIR#>/confused-fix.gif" style="vertical-align:middle" emoid="???" border="0" alt="confused-fix.gif" />
  • coriscoris Join Date: 2003-07-08 Member: 18034Members, Constellation
    <!--quoteo(post=1570809:date=Oct 22 2006, 05:54 PM:name=Princess_of_Power)--><div class='quotetop'>QUOTE(Princess_of_Power @ Oct 22 2006, 05:54 PM) [snapback]1570809[/snapback]</div><div class='quotemain'><!--quotec-->
    01101001001000000110000101101101001000000111001001101111011000100110111101110100
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    i am robot
  • tigersmithtigersmith Join Date: 2004-11-11 Member: 32749Members, Constellation, Reinforced - Supporter
    <!--quoteo(post=1570881:date=Oct 23 2006, 12:56 AM:name=mrThefter)--><div class='quotetop'>QUOTE(mrThefter @ Oct 23 2006, 12:56 AM) [snapback]1570881[/snapback]</div><div class='quotemain'><!--quotec--> This is lovely.
    True hackers.

    It took me 20 min to understand that mel article.

    I'm afraid the other stuff is still too complicated for me. I'm only a C/C++/Java/Python/Pawn programmer. <!--QuoteEnd--></div><!--QuoteEEnd-->

    Python sucks lol.
  • BlackMageBlackMage [citation needed] Join Date: 2003-06-18 Member: 17474Members, Constellation
    i like python. it runs decently and does as it's told. i also like the ability to modify programs while they're running.
    java, on the other hand ... NULLPO!
  • MouseMouse The Lighter Side of Pessimism Join Date: 2002-03-02 Member: 263Members, NS1 Playtester, Forum Moderators, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    UPDATE: it actually works!
    We tested it in class yesterday against a 'real' slerp function. When doing 5 million slerps, my function was only a few seconds slower.
  • MelatoninMelatonin Babbler Join Date: 2003-03-15 Member: 14551Members, Constellation
    <!--quoteo(post=1570803:date=Oct 22 2006, 03:54 PM:name=puzl)--><div class='quotetop'>QUOTE(puzl @ Oct 22 2006, 03:54 PM) [snapback]1570803[/snapback]</div><div class='quotemain'><!--quotec-->mel pwns ju
    <!--QuoteEnd--></div><!--QuoteEEnd-->

    quoted for truth.
  • tigersmithtigersmith Join Date: 2004-11-11 Member: 32749Members, Constellation, Reinforced - Supporter
    <!--quoteo(post=1571546:date=Oct 28 2006, 12:37 AM:name=Mouse)--><div class='quotetop'>QUOTE(Mouse @ Oct 28 2006, 12:37 AM) [snapback]1571546[/snapback]</div><div class='quotemain'><!--quotec--> UPDATE: it actually works!
    We tested it in class yesterday against a 'real' slerp function. When doing 5 million slerps, my function was only a few seconds slower. <!--QuoteEnd--></div><!--QuoteEEnd-->

    LOL i cant believe it..well yes i can but thats funny
Sign In or Register to comment.