Main forum > Competitions

Hello World - Contest

<< < (2/6) > >>

Ian Price:
Here's mine. Not especially complicated, but definitely more complex than just typing PRINT"HELLO WORLD",10,10

:P


--- Code: (glbasic) ---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

--- End code ---

SnooPI:
Use the space key to find out who is saying "Hello World" ;)


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

--- End code ---

WPShadow:
Here is my little code... Hope you like it  =D


--- Code: (glbasic) ---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

--- End code ---

Qedo:
Here is my RND code   :S


--- Code: (glbasic) ---
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



--- End code ---

SnooPI:
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:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version