558 Lines Of QuickBasic Glory
-
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 -
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
LINreminds 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!
-
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
LINWell, everybody has to begin somewhere and then find out how to do it better. I really hope I can recover some of my early masterpieces from the tapes of my old computer. Back then I had the choice between machine language (I recently recovered one of my earliest working games, a Lunar Lander 'clone') and Tiny BASIC (because the interpreter needed a little more than 2k of my precious 4k RAM). If you look at the grammar of Tiny BASIC (http://en.wikipedia.org/wiki/Tiny_BASIC[^]), then you will see that coding horrors are as good as certain with it.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
-
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
LINaspdotnetdev 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) -
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
LINCTRL+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. -
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)I'm pretty sure I just typed out any characters I saw on my keyboard. :)
-
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!
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:
-
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
LINawesome! :)
-
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
LINWhy 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[^]
-
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[^]
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. :)
-
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
LINStraightforward 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.
-
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. :)
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.
-
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)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"><Click Me!></a></b>
Do I get a cookie?Agh! Reality! My Archnemesis![^]
| FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy -
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"><Click Me!></a></b>
Do I get a cookie?Agh! Reality! My Archnemesis![^]
| FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchyYes, 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) -
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)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 -
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
LINI 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 -
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 EditionI didn't run any benchmarks, but I doubt running 60 or so IF statements for each character would be extremely performant. :)
-
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.
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
-
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)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."
-
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
LINHey sir wi juant to iuse ur code in mexico can u ad ;P ń support
RS