Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. 558 Lines Of QuickBasic Glory

558 Lines Of QuickBasic Glory

Scheduled Pinned Locked Moved The Weird and The Wonderful
comquestion
25 Posts 16 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A AspDotNetDev

    This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

    SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
    DIM Letter AS STRING
    STATIC PrintColor AS INTEGER
    STATIC Left AS INTEGER
    STATIC Top AS INTEGER
    IF FunctionNum = 0 THEN
    FOR i = 1 TO LEN(Variable1)
    Letter = MID$(Variable1, i, 1)
    IF Letter = "A" THEN
    LINE (Left + 2, Top)-STEP(1, 0), PrintColor
    LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
    LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
    LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
    LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
    END IF
    IF Letter = "B" THEN
    LINE (Left, Top)-STEP(5, 0), PrintColor
    LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
    LINE (Left, Top + 6)-STEP(5, 0), PrintColor
    LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
    LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
    LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
    END IF
    IF Letter = "C" THEN
    LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
    LINE (Left + 2, Top)-STEP(3, 0), PrintColor
    LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
    LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
    LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
    LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
    LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
    END IF
    IF Letter = "D" THEN
    LINE (Left, Top)-STEP(4, 0), PrintColor
    LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
    LINE (Left, Top + 6)-STEP(4, 0), PrintColor
    LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
    LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
    LIN

    I Offline
    I Offline
    Ian Shlasko
    wrote on last edited by
    #4

    aspdotnetdev wrote:

    IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

    Does anyone even USE that character? Seriously, man... Too much free time :)

    Proud to have finally moved to the A-Ark. Which one are you in?
    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

    A P L L V 5 Replies Last reply
    0
    • A AspDotNetDev

      This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

      SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
      DIM Letter AS STRING
      STATIC PrintColor AS INTEGER
      STATIC Left AS INTEGER
      STATIC Top AS INTEGER
      IF FunctionNum = 0 THEN
      FOR i = 1 TO LEN(Variable1)
      Letter = MID$(Variable1, i, 1)
      IF Letter = "A" THEN
      LINE (Left + 2, Top)-STEP(1, 0), PrintColor
      LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
      LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
      LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
      LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
      END IF
      IF Letter = "B" THEN
      LINE (Left, Top)-STEP(5, 0), PrintColor
      LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
      LINE (Left, Top + 6)-STEP(5, 0), PrintColor
      LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
      LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
      LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
      END IF
      IF Letter = "C" THEN
      LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
      LINE (Left + 2, Top)-STEP(3, 0), PrintColor
      LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
      LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
      LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
      LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
      LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
      END IF
      IF Letter = "D" THEN
      LINE (Left, Top)-STEP(4, 0), PrintColor
      LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
      LINE (Left, Top + 6)-STEP(4, 0), PrintColor
      LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
      LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
      LIN

      J Offline
      J Offline
      josda1000
      wrote on last edited by
      #5

      CTRL+V is the best function ever. Once you learn that, you never need anything else... lol

      Josh Davis
      This is what plays in my head when I finish projects.

      D 1 Reply Last reply
      0
      • I Ian Shlasko

        aspdotnetdev wrote:

        IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

        Does anyone even USE that character? Seriously, man... Too much free time :)

        Proud to have finally moved to the A-Ark. Which one are you in?
        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #6

        I'm pretty sure I just typed out any characters I saw on my keyboard. :)

        [Forum Guidelines]

        1 Reply Last reply
        0
        • K Kevin Drzycimski

          reminds me of my first steps in BASIC i didnt even know of functions, so all code was in one gigantic file with many GOTOs different targets were marked by global variables:

          type = 3
          GOTO 2000

          ...

          2000
          IF (type = 1) THEN
          GOTO 2001
          ELSE IF (type = 2) THEN
          GOTO 2002
          ELSE IF (type = 3) THEN
          GOTO 2003
          ELSE IF (type = 4) THEN
          GOTO 2004
          ELSE
          ...

          this was truly spaghetti code but i am not ashamed. when i learned functions later they felt so great! and even OO later, oh my god!

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #7

          Yeah, not sure why I wrote it the way I did. Looks like I have to call the same function 3 times... once to set the color, once to set the coordinate, and once to print the text. Guess I just didn't like too many parameters. :doh:

          [Forum Guidelines]

          1 Reply Last reply
          0
          • A AspDotNetDev

            This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

            SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
            DIM Letter AS STRING
            STATIC PrintColor AS INTEGER
            STATIC Left AS INTEGER
            STATIC Top AS INTEGER
            IF FunctionNum = 0 THEN
            FOR i = 1 TO LEN(Variable1)
            Letter = MID$(Variable1, i, 1)
            IF Letter = "A" THEN
            LINE (Left + 2, Top)-STEP(1, 0), PrintColor
            LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
            LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
            LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
            LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
            END IF
            IF Letter = "B" THEN
            LINE (Left, Top)-STEP(5, 0), PrintColor
            LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
            LINE (Left, Top + 6)-STEP(5, 0), PrintColor
            LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
            LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
            LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
            END IF
            IF Letter = "C" THEN
            LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
            LINE (Left + 2, Top)-STEP(3, 0), PrintColor
            LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
            LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
            LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
            LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
            LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
            END IF
            IF Letter = "D" THEN
            LINE (Left, Top)-STEP(4, 0), PrintColor
            LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
            LINE (Left, Top + 6)-STEP(4, 0), PrintColor
            LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
            LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
            LIN

            D Offline
            D Offline
            Dave Calkins
            wrote on last edited by
            #8

            awesome! :)

            1 Reply Last reply
            0
            • A AspDotNetDev

              This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

              SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
              DIM Letter AS STRING
              STATIC PrintColor AS INTEGER
              STATIC Left AS INTEGER
              STATIC Top AS INTEGER
              IF FunctionNum = 0 THEN
              FOR i = 1 TO LEN(Variable1)
              Letter = MID$(Variable1, i, 1)
              IF Letter = "A" THEN
              LINE (Left + 2, Top)-STEP(1, 0), PrintColor
              LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
              LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
              LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
              LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
              END IF
              IF Letter = "B" THEN
              LINE (Left, Top)-STEP(5, 0), PrintColor
              LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
              LINE (Left, Top + 6)-STEP(5, 0), PrintColor
              LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
              LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
              LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
              END IF
              IF Letter = "C" THEN
              LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
              LINE (Left + 2, Top)-STEP(3, 0), PrintColor
              LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
              LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
              LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
              LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
              LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
              END IF
              IF Letter = "D" THEN
              LINE (Left, Top)-STEP(4, 0), PrintColor
              LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
              LINE (Left, Top + 6)-STEP(4, 0), PrintColor
              LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
              LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
              LIN

              C Offline
              C Offline
              CaptainSeeSharp
              wrote on last edited by
              #9

              Why didn't you use a special data file where basic number data could be fed through a simple algorithm that would draw your character?

              Invisible Empire: A New World Order Defined (High Quality 2:14:01)[^] Watch the Fall of the Republic (High Quality 2:24:19)[^] The Truthbox[^]

              A 1 Reply Last reply
              0
              • C CaptainSeeSharp

                Why didn't you use a special data file where basic number data could be fed through a simple algorithm that would draw your character?

                Invisible Empire: A New World Order Defined (High Quality 2:14:01)[^] Watch the Fall of the Republic (High Quality 2:24:19)[^] The Truthbox[^]

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #10

                Because it was my first semester programming and I was an idiot (I also might not have learned how to access files yet). That's why I posted this in the Coding Horrors forum. :)

                [Forum Guidelines]

                G 1 Reply Last reply
                0
                • A AspDotNetDev

                  This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

                  SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
                  DIM Letter AS STRING
                  STATIC PrintColor AS INTEGER
                  STATIC Left AS INTEGER
                  STATIC Top AS INTEGER
                  IF FunctionNum = 0 THEN
                  FOR i = 1 TO LEN(Variable1)
                  Letter = MID$(Variable1, i, 1)
                  IF Letter = "A" THEN
                  LINE (Left + 2, Top)-STEP(1, 0), PrintColor
                  LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
                  LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
                  LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
                  LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
                  END IF
                  IF Letter = "B" THEN
                  LINE (Left, Top)-STEP(5, 0), PrintColor
                  LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                  LINE (Left, Top + 6)-STEP(5, 0), PrintColor
                  LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
                  LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
                  LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
                  END IF
                  IF Letter = "C" THEN
                  LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
                  LINE (Left + 2, Top)-STEP(3, 0), PrintColor
                  LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
                  LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
                  LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
                  LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
                  LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
                  END IF
                  IF Letter = "D" THEN
                  LINE (Left, Top)-STEP(4, 0), PrintColor
                  LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                  LINE (Left, Top + 6)-STEP(4, 0), PrintColor
                  LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
                  LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
                  LIN

                  O Offline
                  O Offline
                  oggenok64
                  wrote on last edited by
                  #11

                  Straightforward Basic code and not even close to a horror in my opinion. The purpose of the routine is clear, there are no wacky algorithms, and it's easy to locate an error, if say a "j" is not being displayed correctly. And yes, I know that "Else If" would have been preferable and a "Select ... Case" even better.

                  1 Reply Last reply
                  0
                  • A AspDotNetDev

                    Because it was my first semester programming and I was an idiot (I also might not have learned how to access files yet). That's why I posted this in the Coding Horrors forum. :)

                    [Forum Guidelines]

                    G Offline
                    G Offline
                    Gordon Kushner
                    wrote on last edited by
                    #12

                    Don't beat yourself up. It's called a learning curve. ;) FWIW, I could not look back at the code I wrote in my first two years without wanting to throw up in my mouth a little bit.

                    A 1 Reply Last reply
                    0
                    • I Ian Shlasko

                      aspdotnetdev wrote:

                      IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

                      Does anyone even USE that character? Seriously, man... Too much free time :)

                      Proud to have finally moved to the A-Ark. Which one are you in?
                      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                      P Offline
                      P Offline
                      peterchen
                      wrote on last edited by
                      #13

                      Ian Shlasko wrote:

                      Does anyone even USE that character?

                      I have some custom HTML building routines where ` is used instead of double quotes, e.g. s= TextTag("b,a href=`link`", _T("<Click Me!>")) that would generate <b><a href="link">&lt;Click Me!&gt;</a></b> Do I get a cookie?

                      Agh! Reality! My Archnemesis![^]
                      | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                      I 1 Reply Last reply
                      0
                      • P peterchen

                        Ian Shlasko wrote:

                        Does anyone even USE that character?

                        I have some custom HTML building routines where ` is used instead of double quotes, e.g. s= TextTag("b,a href=`link`", _T("<Click Me!>")) that would generate <b><a href="link">&lt;Click Me!&gt;</a></b> Do I get a cookie?

                        Agh! Reality! My Archnemesis![^]
                        | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                        I Offline
                        I Offline
                        Ian Shlasko
                        wrote on last edited by
                        #14

                        Yes, but it's a stale cookie. The fresh ones came from a different site, so they were blocked :)

                        Proud to have finally moved to the A-Ark. Which one are you in?
                        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                        1 Reply Last reply
                        0
                        • I Ian Shlasko

                          aspdotnetdev wrote:

                          IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

                          Does anyone even USE that character? Seriously, man... Too much free time :)

                          Proud to have finally moved to the A-Ark. Which one are you in?
                          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                          L Offline
                          L Offline
                          leppie
                          wrote on last edited by
                          #15

                          Ian Shlasko wrote:

                          Does anyone even USE that character?

                          A lot in LISP and Scheme. I'm sure other languages use it too.

                          xacc.ide
                          IronScheme - 1.0 RC 1 - out now!
                          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                          1 Reply Last reply
                          0
                          • A AspDotNetDev

                            This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

                            SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
                            DIM Letter AS STRING
                            STATIC PrintColor AS INTEGER
                            STATIC Left AS INTEGER
                            STATIC Top AS INTEGER
                            IF FunctionNum = 0 THEN
                            FOR i = 1 TO LEN(Variable1)
                            Letter = MID$(Variable1, i, 1)
                            IF Letter = "A" THEN
                            LINE (Left + 2, Top)-STEP(1, 0), PrintColor
                            LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
                            LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
                            LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
                            LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
                            END IF
                            IF Letter = "B" THEN
                            LINE (Left, Top)-STEP(5, 0), PrintColor
                            LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                            LINE (Left, Top + 6)-STEP(5, 0), PrintColor
                            LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
                            LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
                            LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
                            END IF
                            IF Letter = "C" THEN
                            LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
                            LINE (Left + 2, Top)-STEP(3, 0), PrintColor
                            LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
                            LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
                            LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
                            LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
                            LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
                            END IF
                            IF Letter = "D" THEN
                            LINE (Left, Top)-STEP(4, 0), PrintColor
                            LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                            LINE (Left, Top + 6)-STEP(4, 0), PrintColor
                            LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
                            LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
                            LIN

                            L Offline
                            L Offline
                            leppie
                            wrote on last edited by
                            #16

                            I bet it was fast :)

                            xacc.ide
                            IronScheme - 1.0 RC 1 - out now!
                            ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                            A 1 Reply Last reply
                            0
                            • L leppie

                              I bet it was fast :)

                              xacc.ide
                              IronScheme - 1.0 RC 1 - out now!
                              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                              A Offline
                              A Offline
                              AspDotNetDev
                              wrote on last edited by
                              #17

                              I didn't run any benchmarks, but I doubt running 60 or so IF statements for each character would be extremely performant. :)

                              [Forum Guidelines]

                              1 Reply Last reply
                              0
                              • G Gordon Kushner

                                Don't beat yourself up. It's called a learning curve. ;) FWIW, I could not look back at the code I wrote in my first two years without wanting to throw up in my mouth a little bit.

                                A Offline
                                A Offline
                                AspDotNetDev
                                wrote on last edited by
                                #18

                                I'm not beating myself up. I'm beating my old self up. Which is in contrast to my current self, who is quite not idiotic. Well, until 10 years from now when I see my current self as an idiot too. ;P

                                [Forum Guidelines]

                                1 Reply Last reply
                                0
                                • I Ian Shlasko

                                  aspdotnetdev wrote:

                                  IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

                                  Does anyone even USE that character? Seriously, man... Too much free time :)

                                  Proud to have finally moved to the A-Ark. Which one are you in?
                                  Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                  L Offline
                                  L Offline
                                  LloydA111
                                  wrote on last edited by
                                  #19

                                  Ian Shlasko wrote:

                                  Does anyone even USE that character? Seriously, man... Too much free time

                                  The GCC compiler can use the ` character for parts of parameters to some of it's commands... I'm not sure which ones exactly, or even why they even decided to allow the ` character :doh: . I never bothered to figure out where the ` character could be used with it because it seems such a useless character. I don't even know what it's called... a wonky apostrophe? :laugh: Your right though, who even uses the ` character? :)


                                  "People demand freedom of speech to make up for the freedom of thought which they avoid."

                                  D 1 Reply Last reply
                                  0
                                  • A AspDotNetDev

                                    This post relates to the coding horror I posted about earlier today. I dug up my old Tetris code and I found it... the following is the 558 line QuickBasic subroutine I made in high school that prints a string to the screen. Enjoy. :)

                                    SUB PrintMain (Variable1 AS STRING, Variable2 AS STRING, FunctionNum AS INTEGER)
                                    DIM Letter AS STRING
                                    STATIC PrintColor AS INTEGER
                                    STATIC Left AS INTEGER
                                    STATIC Top AS INTEGER
                                    IF FunctionNum = 0 THEN
                                    FOR i = 1 TO LEN(Variable1)
                                    Letter = MID$(Variable1, i, 1)
                                    IF Letter = "A" THEN
                                    LINE (Left + 2, Top)-STEP(1, 0), PrintColor
                                    LINE (Left + 1, Top + 1)-STEP(3, 0), PrintColor
                                    LINE (Left, Top + 2)-STEP(1, 4), PrintColor, BF
                                    LINE (Left + 4, Top + 2)-STEP(1, 4), PrintColor, BF
                                    LINE (Left + 2, Top + 4)-STEP(1, 0), PrintColor, BF
                                    END IF
                                    IF Letter = "B" THEN
                                    LINE (Left, Top)-STEP(5, 0), PrintColor
                                    LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                                    LINE (Left, Top + 6)-STEP(5, 0), PrintColor
                                    LINE (Left + 3, Top + 3)-STEP(2, 0), PrintColor
                                    LINE (Left + 5, Top + 1)-STEP(1, 1), PrintColor, B
                                    LINE (Left + 5, Top + 4)-STEP(1, 1), PrintColor, B
                                    END IF
                                    IF Letter = "C" THEN
                                    LINE (Left + 5, Top + 1)-STEP(1, 0), PrintColor
                                    LINE (Left + 2, Top)-STEP(3, 0), PrintColor
                                    LINE (Left + 1, Top + 1)-STEP(1, 0), PrintColor
                                    LINE (Left, Top + 2)-STEP(1, 2), PrintColor, B
                                    LINE (Left + 1, Top + 5)-STEP(1, 0), PrintColor
                                    LINE (Left + 2, Top + 6)-STEP(3, 0), PrintColor
                                    LINE (Left + 5, Top + 5)-STEP(1, 0), PrintColor
                                    END IF
                                    IF Letter = "D" THEN
                                    LINE (Left, Top)-STEP(4, 0), PrintColor
                                    LINE (Left + 1, Top + 1)-STEP(1, 4), PrintColor, B
                                    LINE (Left, Top + 6)-STEP(4, 0), PrintColor
                                    LINE (Left + 4, Top + 1)-STEP(1, 0), PrintColor
                                    LINE (Left + 5, Top + 2)-STEP(1, 2), PrintColor, B
                                    LIN

                                    R Offline
                                    R Offline
                                    robertosalazar
                                    wrote on last edited by
                                    #20

                                    Hey sir wi juant to iuse ur code in mexico can u ad ;P ń support

                                    RS

                                    A 1 Reply Last reply
                                    0
                                    • R robertosalazar

                                      Hey sir wi juant to iuse ur code in mexico can u ad ;P ń support

                                      RS

                                      A Offline
                                      A Offline
                                      AspDotNetDev
                                      wrote on last edited by
                                      #21

                                      robertosalazar wrote:

                                      to iuse ur code

                                      While the above terrible code is an excellent example, iUse™ is a registered trademark of Apple™. Please discontinue your use of this term. ;P

                                      [Forum Guidelines]

                                      1 Reply Last reply
                                      0
                                      • I Ian Shlasko

                                        aspdotnetdev wrote:

                                        IF Letter = "`" THEN LINE (Left + 2, Top)-STEP(1, 1), PrintColor, B LINE (Left + 3, Top + 2)-STEP(1, 0), PrintColor END IF

                                        Does anyone even USE that character? Seriously, man... Too much free time :)

                                        Proud to have finally moved to the A-Ark. Which one are you in?
                                        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                        V Offline
                                        V Offline
                                        Vikram A Punathambekar
                                        wrote on last edited by
                                        #22

                                        Adnan Siddiqui always used it in place of apostrophes. But he's not been around for a few years now, I guess his bomb suit finally worked.

                                        Cheers, विक्रम (Got my troika of CCCs!) After all is said and done, much is said and little is done.

                                        1 Reply Last reply
                                        0
                                        • L LloydA111

                                          Ian Shlasko wrote:

                                          Does anyone even USE that character? Seriously, man... Too much free time

                                          The GCC compiler can use the ` character for parts of parameters to some of it's commands... I'm not sure which ones exactly, or even why they even decided to allow the ` character :doh: . I never bothered to figure out where the ` character could be used with it because it seems such a useless character. I don't even know what it's called... a wonky apostrophe? :laugh: Your right though, who even uses the ` character? :)


                                          "People demand freedom of speech to make up for the freedom of thought which they avoid."

                                          D Offline
                                          D Offline
                                          dawmail333
                                          wrote on last edited by
                                          #23

                                          It's called the backtick, gets a few obscure uses. I think you can use it for formatting at SO though. Some text-based markup systems (possibly Markdown?) use it to denote code etc. Just sayin'. :-\

                                          Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                                          B 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups