Author Topic: Hello World - Contest  (Read 10345 times)

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Hello World - Contest
« 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:
« Last Edit: 2019-Apr-08 by WPShadow »
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Re: Hello World - Contest
« Reply #1 on: 2019-Mar-12 »
Boy, i'm on the way! (Call me Mr. Complicated) :D
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 424
    • View Profile
Re: Hello World - Contest
« Reply #2 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?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Hello World - Contest
« Reply #3 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 :
Quote
The 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.

Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: Hello World - Contest
« Reply #4 on: 2019-Mar-13 »
Awesome! I'm still working on my version...  :D
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4176
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Hello World - Contest
« Reply #5 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
I came. I saw. I played.

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 424
    • View Profile
Re: Hello World - Contest
« Reply #6 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

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: Hello World - Contest
« Reply #7 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
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 389
  • to program what I have do how should programming?
    • View Profile
Re: Hello World - Contest
« Reply #8 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



Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 424
    • View Profile
Re: Hello World - Contest
« Reply #9 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:
« Last Edit: 2019-Mar-20 by Snoopy »

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: Hello World - Contest
« Reply #10 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...
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1826
    • View Profile
Re: Hello World - Contest
« Reply #11 on: 2019-Mar-25 »
is it too late to submit?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline WPShadow

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1667
    • View Profile
    • http://lostrevenant.blogspot.com
Re: Hello World - Contest
« Reply #12 on: 2019-Mar-25 »
No, submit it!!! I will add you immediately to the poll!  :booze:
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4453
    • View Profile
    • FUED
Re: Hello World - Contest
« Reply #13 on: 2019-Mar-25 »
What? A dreaded deadline appeared! I will try to be a part too, but time is not on my side. ;/

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 424
    • View Profile
Re: Hello World - Contest
« Reply #14 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.
« Last Edit: 2019-Mar-25 by Snoopy »