GLBasic forum

Main forum => Competitions => Topic started by: WPShadow on 2019-Mar-12

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
Title: Hello World - Contest
Post by: WPShadow on 2019-Mar-12
Hi,

it's time for a new contest and it's time for a little action in the forum.

Here we go:



Definition

Write 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

Goal

The 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

Submission

Just post your code here in a codeblock, so everybody can study your awesome work.

Winner

This 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:
Title: Re: Hello World - Contest
Post by: Schranz0r on 2019-Mar-12
Boy, i'm on the way! (Call me Mr. Complicated) :D
Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Mar-13
 :D Funny !

Just a question, can it be complicated and short or the number of lines of code is also important?
Title: Re: Hello World - Contest
Post by: Hemlos on 2019-Mar-13
Game on!
Compiled as a console program.
Note: only a few lines in main code, but what it does is pretty complicated.


Code (glbasic) Select
// --------------------------------- //
// 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.

Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-13
Awesome! I'm still working on my version...  :D
Title: Re: Hello World - Contest
Post by: Ian Price on 2019-Mar-13
Here's mine. Not especially complicated, but definitely more complex than just typing PRINT"HELLO WORLD",10,10

:P

Code (glbasic) Select

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
Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Mar-14
Use the space key to find out who is saying "Hello World" ;)

Code (glbasic) Select

// --------------------------------- //
// 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
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-14
Here is my little code... Hope you like it  =D

Code (glbasic) Select

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
Title: Re: Hello World - Contest
Post by: Qedo on 2019-Mar-16
Here is my RND code   :S

Code (glbasic) Select


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


Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Mar-20
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:
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-25
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...
Title: Re: Hello World - Contest
Post by: MrPlow on 2019-Mar-25
is it too late to submit?
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-25
No, submit it!!! I will add you immediately to the poll!  :booze:
Title: Re: Hello World - Contest
Post by: erico on 2019-Mar-25
What? A dreaded deadline appeared! I will try to be a part too, but time is not on my side. ;/
Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Mar-25
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.
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-25
Should we raise the deadline? 15.04.? Or longer?
Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Mar-25
If it's too long, it'll be boring.
Small contest, small deadline  :)
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Mar-26
Ok, small contest, small deadline...

I'll raise the deadline to 07.04., so there should be enough time to code and vote...  :booze:
Title: Re: Hello World - Contest
Post by: Schranz0r on 2019-Mar-29
Still working on my version of Hello World.... it's to complicated, so i win?  :-[ :-[ :-[
Title: Re: Hello World - Contest
Post by: dreamerman on 2019-Mar-29
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 ;)
Title: Re: Hello World - Contest
Post by: Hemlos on 2019-Mar-29
i have a guess, the code will procrastinate  :good:
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Apr-01
Schranz0r, you should code faster...

The contest ends this weekend...   :good:
Title: Re: Hello World - Contest
Post by: Schranz0r on 2019-Apr-01
I never start, it was a joke :D....
Maybe today, you will see, or not  ^^
Title: Re: Hello World - Contest
Post by: MrPlow on 2019-Apr-01
My Entry!

I went another route initially but scrapped that and went with this version ...

Code (glbasic) Select
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
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Apr-02
Nice one!  :good:

Everything is prepared for the next competition... We will see in the poll on sunday who's the winner!  :booze:
Title: Re: Hello World - Contest
Post by: SnooPI on 2019-Apr-03
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:
Title: Re: Hello World - Contest
Post by: dreamerman on 2019-Apr-06
ah.. can't decide, all entries have something interesting.. btw. WPShadow You forgot to include yourself in poll :D
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Apr-08
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
Title: Re: Hello World - Contest
Post by: Hemlos on 2019-Apr-09
 :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.
Title: Re: Hello World - Contest
Post by: WPShadow on 2019-Apr-09
Thank you!
:good: