Poll
Question:
Vote the Hello World - Contest
Option 1: Hemlos
votes: 2
Option 2: Ian Price
votes: 1
Option 3: Snoopy
votes: 1
Option 4: Qedo
votes: 0
Option 5: MrPlow
votes: 0
Hi,
it's time for a new contest and it's time for a little action in the forum.
Here we go:
DefinitionWrite a
hello world program in GLBasic as complicated as possible!!!
Rules
- Write the whole program only in GLBasic
- no third party libraries
- Don't use unnecessary code lines (like 1000 loops)
- Don't copy from an already published code
GoalThe output on the screen is black and it says "Hello World" and that's it. No Action, no fancy backgrounds, only a black screen with a few nice letters. =D
SubmissionJust post your code here in a codeblock, so everybody can study your awesome work.
WinnerThis is a fun contest and there is nothing to win... Nevertheless, together we can choose a winner...
Good luck and have fun.
=====
Winner of the contest:
:enc:
Hemlos :enc:
Boy, i'm on the way! (Call me Mr. Complicated) :D
:D Funny !
Just a question, can it be complicated and short or the number of lines of code is also important?
Game on!
Compiled as a console program.
Note: only a few lines in main code, but what it does is pretty complicated.
// --------------------------------- //
// Project: HelloWorld
// Start: Tuesday, March 12, 2019
// IDE Version: 15.238
// By Hemlos
// Instructions: compile as console
AUTOPAUSE FALSE
SYSTEMPOINTER TRUE
LOCAL HelloWorld AS lib_String_Object_
HelloWorld.is$ = "hElLo wOrLd"
LOCAL BGColor% = 0, TColor% = 15
STDCOLOR TColor,BGColor
STD_OUT( HelloWorld.is$ )
STD_OUT( HelloWorld._Capitalize$() )
STD_OUT( HelloWorld._Capwords$() )
STD_OUT( HelloWorld._Swapcase$() )
STD_OUT( HelloWorld._RFill$(3, "!") )
STD_OUT( HelloWorld._LFill$(3, "!") )
STD_OUT( HelloWorld._Left$(14) )
STD_OUT( HelloWorld._Right$(11) )
STD_OUT( HelloWorld._Swapcase$() )
STD_OUT( HelloWorld._Upper$() )
STD_OUT( HelloWorld._Lower$() )
STD_OUT( HelloWorld._Encrypt$("GLBasic") )
STD_OUT( HelloWorld._Decrypt$("GLBasic") )
STD_OUT( HelloWorld._Replace$("world","GLBasic") )
STD_OUT( HelloWorld._Replace$("GLBasic","world") )
STD_OUT( HelloWorld._Capitalize$() )
STD_OUT( HelloWorld._Capwords$() )
SLEEP 60000
END
FUNCTION STD_OUT: showThis$, restTimeMS% = 1000 // clearscreen, stdout, sleep. restTimeMS% = millseconds sleep time (integer) defaults one second
CLEARSCREEN
STDOUT "\n\n\n "
STDOUT showThis$
SLEEP restTimeMS%
RETURN 0
ENDFUNCTION
Include this String object library lib_String_Object.gbas :
QuoteThe message exceeds the maximum allowed length (20000 characters).
You'll have to download the .rar to see it in action. :zzz:
Note: the string lib is mine own creation, based 100% on GLBasic command structures, and inspired by the Python Language.
Awesome! I'm still working on my version... :D
Here's mine. Not especially complicated, but definitely more complex than just typing PRINT"HELLO WORLD",10,10
:P
GLOBAL n%
GLOBAL map%[]
DIM map[100][16]
text_data()
WHILE TRUE
FOR y=0 TO 7
FOR x=0 TO 61
IF map[x][y]<>0 THEN DRAWRECT x*1+20,y*1+20,1,1,RGB(255,255,255)
NEXT
NEXT
SHOWSCREEN
WEND
FUNCTION text_data:
RESTORE text
FOR y=0 TO 7
FOR x=0 TO 61
READ n
map[x][y]=n
NEXT
NEXT
STARTDATA text:
DATA 1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,0
DATA 1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,0,0,1,1,1,1,1
DATA 1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1
DATA 1,1,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1
DATA 1,1,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,1
DATA 1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,0,1,1,0,1,1,0,1,1,1,1,0,0,1,1,0,0,0,1,1,0,1,1
DATA 1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1
DATA 1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,1,1,1,1,0
ENDDATA
ENDFUNCTION
Use the space key to find out who is saying "Hello World" ;)
// --------------------------------- //
// Project: CompHelloWorld
GLOBAL ok%, ntest%, pos%, line$
GLOBAL fw%, fh%
GLOBAL site$ = "www.glbasic.com"
GLOBAL page$ = "xmlhelp.php?lang=en&id=69&action=view"
GLOBAL file$ = "print.php"
GLOBAL normal_helloworld$ = "Hello World", complicated_helloworld$
WHILE ok% = FALSE
ok% = NETWEBGET(site$, "/"+page$, 80, file$) // Get the file ont the net
SLEEP 2000
INC ntest%
IF ntest% >= 10 THEN GOTO error
WEND
ok% = OPENFILE(1, file$, TRUE) // Open the file
IF ok%
WHILE TRUE // Scan the Hello World in the file
READLINE 1, line$
pos% = INSTR(line$, normal_helloworld$)
complicated_helloworld$ = MID$(line$, pos%, LEN(normal_helloworld$))
IF complicated_helloworld$ = normal_helloworld$ THEN BREAK
IF ENDOFFILE(1)
CLOSEFILE 1
GOTO error
ENDIF
WEND
ELSE
CLOSEFILE 1
GOTO error
ENDIF
CLOSEFILE 1
GETFONTSIZE fw%, fh%
WHILE TRUE
PRINT UCASE$(complicated_helloworld$), 0, 0 // HELLO WORLD
IF KEY(57) THEN PRINT "FROM " + UCASE$(site$), (LEN(complicated_helloworld$) + 1) * fw%, 0, TRUE // FROM A SITE IN THE WORLD
SHOWSCREEN
WEND
END
error:
PRINT "ARGHH!! NOT HELLO WORLD FROM " + UCASE$(site$), 0, 0
SHOWSCREEN
MOUSEWAIT
END
Here is my little code... Hope you like it =D
main()
FUNCTION main:
PRINT getOutput$("a547b28e9c95036c97e1369efc64d7216b9af46ed24e5cbcb6d81c6984d3c1f4f5b5e31aff81c6261cae7d0bab45346d76910dbfc04691c8fc0a8b46ab9a8c14127fc443ec71175cdf24375f8d71780f"), 0, 0
SHOWSCREEN
KEYWAIT
END
ENDFUNCTION
FUNCTION getOutput$: info$
LOCAL decrypted$, binaryLines$[], loop, pos, sum, digit, output$
DIM binaryLines$[11]
// String decryption
decrypted$ = DECRYPT$("GlbasicRocks", info$)
// Here I'm spliting the whole binary string into 11 parts of 7 "letters"
FOR loop = 0 TO 10
binaryLines$[loop] = MID$(decrypted$, 0 + (loop * 7), 7)
NEXT
// A little binary check
FOREACH b$ IN binaryLines$[]
sum = 0
FOR pos = 0 TO 6
// converts binary in decimal
digit = MID$(b$, pos, 1)
IF digit = 1 AND pos = 0 THEN INC sum, 64
IF digit = 1 AND pos = 1 THEN INC sum, 32
IF digit = 1 AND pos = 2 THEN INC sum, 16
IF digit = 1 AND pos = 3 THEN INC sum, 8
IF digit = 1 AND pos = 4 THEN INC sum, 4
IF digit = 1 AND pos = 5 THEN INC sum, 2
IF digit = 1 AND pos = 6 THEN INC sum, 1
NEXT
// and decimal to ascii
output$ = output$ + CHR$(sum)
NEXT
RETURN output$
ENDFUNCTION
Here is my RND code :S
SETFONT 0,3
GLOBAL a[]
DIM a[11]
SEEDRND 505
FOR i=0 TO 10
a[i]=RND(126)
NEXT
PRINT CHR$(a[0]+a[1]/10*3)+CHR$(a[1]+a[4])+CHR$(a[2]+a[3]/5) _
+CHR$(a[2]+a[3]/5)+CHR$(a[9]-1)+CHR$(a[7])+CHR$(a[5]+a[7]-10)+CHR$(a[9]-1) _
+CHR$(a[1]+a[10])+CHR$(a[2]+a[3]/5)+CHR$(a[3]),0,0
SHOWSCREEN
MOUSEWAIT
END
We can already say one thing: all the codes are really different, it's cool :)
EDIT
Well, after testing his code (with his nice library), I vote for Hemlos.
Very good job guy :good:
I added a poll so everybody can vote.
I would say we can end the contest on sunday 31.03.2019...
If somebody want to add some code I can change the poll anytime!
Was this ok? Should we do more little things like this? I have a few funny ideas for short contests like this...
is it too late to submit?
No, submit it!!! I will add you immediately to the poll! :booze:
What? A dreaded deadline appeared! I will try to be a part too, but time is not on my side. ;/
I thought that only the participants had the right to vote and that they were not allowed to vote for their code.
Quote from: WPShadow
Was this ok? Should we do more little things like this? I have a few funny ideas for short contests like this...
Yes it's funny and motivating.
Moreover, I'm sure we're learning things with this kind of small contest.
Should we raise the deadline? 15.04.? Or longer?
If it's too long, it'll be boring.
Small contest, small deadline :)
Ok, small contest, small deadline...
I'll raise the deadline to 07.04., so there should be enough time to code and vote... :booze:
Still working on my version of Hello World.... it's to complicated, so i win? :-[ :-[ :-[
hm.. nice ideas, read from DATA, webpage, encoded string, RND numbers, what more can be done? Curious what You will do Schranz0r to beat them ;)
i have a guess, the code will procrastinate :good:
Schranz0r, you should code faster...
The contest ends this weekend... :good:
I never start, it was a joke :D....
Maybe today, you will see, or not ^^
My Entry!
I went another route initially but scrapped that and went with this version ...
SETSCREEN 800,600,FALSE
SMOOTHSHADING TRUE
CLEARSCREEN
GLOBAL string$="Hello World"
GLOBAL nn=0
GLOBAL bin$=""
TYPE udg
binary$=""
ENDTYPE
GLOBAL udgs[] AS udg
PRINT string$,100,100,1
WHILE 1=1
LOCAL countbin = 0
FOR s = 0 TO LEN(string$)*8 STEP 8
FOR m = 0 TO 7 // 1 to 10
FOR n = s+0 TO s+8
IF GETPIXEL(100+n,100+m)>RGB(254,254,254)
bin$=bin$+"1"
SETPIXEL 100+n,100+m,0x000000
ELSE
bin$=bin$+"0"
ENDIF
nn=n
IF LEN(bin$)=9
countbin=0
LOCAL u AS udg
u.binary$=bin$
DIMPUSH udgs[],u
bin$=""
ENDIF
NEXT
NEXT
NEXT
LOCAL cnt%=0
LOCAL space%=0
FOREACH uu IN udgs[]
INC cnt,8
IF cnt = 64
INC space,64
cnt = 0
ENDIF
FOR pp = 0 TO 7
IF MID$(uu.binary$,pp,1)=0 THEN ALPHAMODE -.1
PRINT ".",30+(pp*8/1.8)+space,200+cnt/1.8
ALPHAMODE -.99
NEXT
NEXT
SHOWSCREEN
WEND
Nice one! :good:
Everything is prepared for the next competition... We will see in the poll on sunday who's the winner! :booze:
Finally, I really voted for Hemlos (I was not going to vote for me =D).
But frankly, all the codes are good because they are all different, well done guys! :good:
ah.. can't decide, all entries have something interesting.. btw. WPShadow You forgot to include yourself in poll :D
I'm only the "promoter" of the contest, so my code will only be some kind of example...
I've a great idea for the next contest and will set it up this week, if somebody would like to join it =D
:good:
The string object lib i used, is up-to-date and ready to rock and roll.
Feel free to use it if you find handy, enjoy.
Thank you!
:good: