Page 1 of 2

Season's Greetings PurePunch contest

Posted: Tue Nov 27, 2012 5:06 pm
by djes
~ December 2012 ~

Season's Greetings PurePunch contest

The contest is now OVER, please vote here : http://www.purebasic.fr/english/viewtop ... 14&t=52694

Theme
  • The fantastic PB 5.00 Demo !
    Show your skills thanks to the new PureBasic version. This demonstration could be an utility, a game, a 3D graphical demonstration, whatever you're able to do with the new PureBasic version, while pushing the limits !
    May the best win !
Gifts & Sponsors
  • Fred and Fantaisie software are happy to sponsor the contest :
  • First prize : a PureBasic Teddy Bear !
  • Second prize : a PureBasic Mug
  • Third prize : a PureBasic Mousepad
    If you want also to be a sponsor, please contact me.
The rules
  • 1° The program will be created using Purebasic 5.00 (minimum), API allowed, demo version allowed, no userlib.
    2° The program source will only have a maximum of 80 lines of 80 characters max per line.
    3° To be unique, either a complete creation, or bringing something new to an existing code.
    Must not to be harmful
    5° Possibility to add a graphic file (only one image, or sprite, or texture...), maximum size 512 pixels width by 512 pixels height, 32 bits. Post it on the forum or on another site which must be reachable during the contest length, or included in a full project archive posted in the forum.
    6° Possibility to add a sound file (and only one) maximum size 1Mb. Post it on another site which must be reachable during the contest length, or included in a full project archive posted in the forum.
    7° It will be possible to add a line (not accounted), at the beginning of the source, to alert the user of a program specificity (for example, a delay or a particular subsystem). This line must be like

    Code: Select all

    MessageRequester("Information", "Message", #PB_MessageRequester_Ok)
    Time limit : Dec 31st, 2012 @ 11:59pm
  • At the end of this period, a topic will be created to vote for the best code (only people registered in the forum before Nov 27th are allowed to vote). To maintain suspense, you'll be asked to give 3 points for your favorite, two for the second, one for the third. The vote will take place from Jan 1st, 2013 to Jan 14th @ 23:59. After verification, winners will be contacted to receive their prizes.
How to post
  • Post the code on this forum, after adding and completing the following header:

Code: Select all

;*****************************************************************************
;*
;* Season's Greetings PurePunch Demo contest
;* PureBasic 5.00
;* 80 lines of 80 chars, 1 month delay
;*
;* Name     :  
;* Author   : 
;* Date     : 
;* Notes    :
;*
;*****************************************************************************
Good luck to all players ! :) :)

PS : All 'official' forum's topics about PurePunch

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 12:39 am
by kenmo
It's been a while, I will try to enter something :)

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 2:45 am
by BasicallyPure
Question,
djes wrote:2° The program source will only have a maximum of 80 lines of 80 characters max per line.
Can a line have colons ":" and still be counted as a single line?

B.P.

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 3:47 am
by idle
yes BP you can use colons and any tricks you desire to aid punching you creation into the format
have a look at previous punches search for purepunch

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 9:33 am
by Kurzer
Yes, BasicallyPure. Maybe you will have a look at one of the previous contests?
There are some tricks to write "small" code (e.g. using macros).
http://www.purebasic.fr/english/viewtop ... 12&t=38908

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 7:38 pm
by BasicallyPure
Thanks idle,
Thanks kurzer.

I'm going to assume that the 12 lines for the header don't count as part of the 80 lines.

B.P.

Re: Season's Greetings PurePunch Demo contest

Posted: Wed Nov 28, 2012 10:17 pm
by citystate
that's right BP. At least, that's how it's been in previous punches

Re: Season's Greetings PurePunch Demo contest

Posted: Thu Nov 29, 2012 9:52 am
by djes
Citystate is right.

Good news : Fred will sponsor the contest, so there will be some prizes for the winner :)

Re: Season's Greetings PurePunch Demo contest

Posted: Fri Nov 30, 2012 2:27 pm
by djes
Prize list is ready :)

Re: Season's Greetings PurePunch Demo contest

Posted: Fri Nov 30, 2012 11:35 pm
by Sveinung
Shall we post our contributions here in this thread?

Regards
Sveinung

Re: Season's Greetings PurePunch Demo contest

Posted: Sat Dec 01, 2012 12:05 am
by c4s
Maybe it would be better if the contributions wouldn't be posted in public (just PM to djes?!) until the contest has finished. This way people won't steal code/ideas from others ( ;-) ) and won't be demotivated too fast if someone made a uber-cool contribution...

Re: Season's Greetings PurePunch Demo contest

Posted: Sat Dec 01, 2012 1:24 am
by electrochrisso
c4s wrote:Maybe it would be better if the contributions wouldn't be posted in public (just PM to djes?!) until the contest has finished. This way people won't steal code/ideas from others ( ;-) ) and won't be demotivated too fast if someone made a uber-cool contribution...
I am with you c4s. :wink:

Re: Season's Greetings PurePunch Demo contest

Posted: Sat Dec 01, 2012 11:57 am
by djes
The only thing asked is that the code be posted in this forum (or by PM OK) before the Dec 31st @ 12:59pm. If you're posting before, your code may inspire the other, change the whole competition, heighten the difficulty or demotivate, of course ! But wait and maybe you're doing the same thing someone else, maybe better, maybe a little bug and your code does not work, and the users cannot tell you !

Feel free :)

Re: Season's Greetings PurePunch Demo contest

Posted: Mon Dec 03, 2012 1:30 pm
by djes
Two first codes by french forum users :

Code: Select all

;*****************************************************************************
;*
;* Season's Greetings PurePunch Demo contest
;* PureBasic 5.00
;* 80 lines of 80 chars, 1 month delay
;*
;* Name     : Line Counter & Longest line  
;* Author   : falsam
;* Date     : 29.11.2012
;* Notes    : off contest - copy code to test in the clipboard
;*
;*****************************************************************************
B$=GetClipboardText():E$=#CRLF$:For i=1 To CountString(B$,E$)+1:L+1
If Len(StringField(B$,i,E$))>C:C=Len(StringField(B$,i,E$)):EndIf:Next
Debug "Line Counter "+Str(L):Debug "Longest line : "+Str(C)

Code: Select all

;*****************************************************************************
;*
;* Season's Greetings PurePunch Demo contest
;* PureBasic 5.00
;* 80 lines of 80 chars, 1 month delay
;*
;* Name     : Pure4Power
;* Author   : cederavic
;* Date     : 12/01/2012
;* Notes    : Hmmm... Better to play with two players!
;*          : media.png can be downloaded here : http://slimevoid.net/games/pure4power/media.png
;*
;*****************************************************************************
#width=512:#height=440
Global Dim g(6,5),tu=1,pw=-1,Dim f(6,5):Declare checkWin()
InitSprite():UsePNGImageDecoder():UsePNGImageEncoder()
OpenWindow(0,0,0,#width,#height,"Pure4Power",13107201)
CanvasGadget(0,0,0,#width,#height,#PB_Canvas_ClipMouse)
media=LoadImage(#PB_Any,"media.png")
GrabImage(media,0,0,0,512,440)
GrabImage(media,1,0,440,72,72)
GrabImage(media,2,72,440,72,72)
LoadFont(0,"Consolas",22,#PB_Font_HighQuality|#PB_Font_Bold)
playertuTime=ElapsedMilliseconds()
Repeat:Repeat:wEvent=WindowEvent():If wEvent=16:quit=#True:EndIf
If wEvent=#WM_LBUTTONUP And dp=#False:If pw=0
dropCol=Int((WindowMouseX(0)-8)/72)
If g(dropCol,0)=0:dp=#True:dy=0:EndIf:Else:FreeArray(g()):Global Dim g(6,5)
tu=1:pw=0:EndIf:EndIf:Until wEvent=#Null:If dp=#True:dy+12
cr=Int((dy-8)/72)+1:If cr=6:dp=#False:g(dropCol,cr-1)=tu:checkWin()
If tu=1:tu=2:Else:tu=1:EndIf:playertuTime=ElapsedMilliseconds():Else
If g(dropCol,cr) > 0:dp=#False:g(dropCol,cr -1)=tu:checkWin()
If tu=1:tu=2:Else:tu=1:EndIf
playertuTime=ElapsedMilliseconds():EndIf:EndIf:EndIf
StartDrawing(CanvasOutput(0))
DrawingMode(#PB_2DDrawing_Gradient):LinearGradient(0,0,0,#height)
BackColor(RGBA(182,180,255,255)):FrontColor(RGBA(100,182,255,255))
Box(0,0,#width,#height,RGBA(0,42,224,255)):If (dp=#True)
DrawAlphaImage(ImageID(tu),dropCol * 72+4,dy+4):ElseIf (pw=0)
DrawAlphaImage(ImageID(tu),Int((WindowMouseX(0)-8)/72) * 72+4,4,128)
EndIf:For x=0 To 6:For y=0 To 5:If (g(x,y) > 0):If (pw=0)
DrawAlphaImage(ImageID(g(x,y)),x * 72+4,y * 72+4):Else
DrawAlphaImage(ImageID(g(x,y)),x * 72+4,y * 72+4,63+f(x,y) * 192)
EndIf:EndIf:Next:Next:DrawAlphaImage(ImageID(0),0,0)
DrawingMode(#PB_2DDrawing_Transparent|#PB_2DDrawing_AlphaBlend)
DrawingFont(FontID(0)):If (pw > 0)
text.s="Player "+Str(pw)+" has won!"
DrawText(#width/2-TextWidth(text)/2+2,126,text,RGBA(32,32,32,127))
DrawText(#width/2-TextWidth(text)/2,128,text,RGBA(42,241,64,255))
text.s="Click to play again"
DrawText(#width/2-TextWidth(text)/2+2,126+48,text,RGBA(32,32,32,127))
DrawText(#width/2-TextWidth(text)/2,128+48,text,RGBA(42,241,64,255))
ElseIf (pw=0):If (ElapsedMilliseconds()-playertuTime < 3000)
alpha.f=255-(255 * (ElapsedMilliseconds()-playertuTime)/3000.0)
text.s="Player "+Str(tu)+" turn"
If tu=1:color=RGBA(255,174,0,alpha):Else:color=RGBA(255,16,16,alpha):EndIf
DrawText(#width/2-TextWidth(text)/2+2,126,text,RGBA(32,32,32,(alpha/2)))
DrawText(#width/2-TextWidth(text)/2,128,text,color):EndIf:Else
text.s="Click to Play"
DrawText(#width/2-TextWidth(text)/2+2,126,text,RGBA(32,32,32,127))
DrawText(#width/2-TextWidth(text)/2,128,text,RGBA(242,180,100,255))
EndIf:StopDrawing():Until quit=#True:End
Procedure p(x,y,dx,dy,player,win):If x<0 Or x>6 Or y<0 Or y>5
ProcedureReturn win:EndIf:If g(x,y)<>player:ProcedureReturn win:EndIf
If g(x,y)=player:f(x,y)=1:ProcedureReturn p(x+dx,y+dy,dx,dy,player,win+1):EndIf
EndProcedure
Procedure checkWin():For x=0 To 6:For y=0 To 5:If (g(x,y) > 0)
For dx=-1 To 1:For dy=-1 To 1:If (dx <> 0 Or dy <> 0):FreeArray(f())
Global Dim f(6,5):If p(x,y,dx,dy,g(x,y),0) >= 4
pw=g(x,y):ProcedureReturn pw:EndIf:EndIf:Next:Next:EndIf
Next:Next:ProcedureReturn 0:EndProcedure
With this picture : Image

Re: Season's Greetings PurePunch Demo contest

Posted: Tue Dec 04, 2012 5:29 am
by electrochrisso

Code: Select all

;*****************************************************************************
;*
;* Season's Greetings PurePunch Demo contest
;* PureBasic 5.00
;* 80 lines of 80 chars, 1 month delay
;*
;* Name     : Meal Master Quickview
;* Author   : electrochrisso
;* Date     : 04.12.2012
;* Notes    : Download Recipes Here: http://home.earthlink.net/~darkstar105/
;*
;*****************************************************************************
OpenWindow(0,100,0,842,540,"Meal Master Quickview",#PB_Window_SystemMenu)
CreateToolBar(0,WindowID(0)):ToolBarStandardButton(0,#PB_ToolBarIcon_Open)
ListViewGadget(0,0,28,200,512)
EditorGadget(1,202,28,640,512,#PB_Editor_ReadOnly)
SetGadgetColor(0,#PB_Gadget_BackColor,$FAFFF5)
SetGadgetColor(1,#PB_Gadget_BackColor,$F0FFFF)
SetGadgetFont(1,LoadFont(0,"Courier",10))
Repeat:Select WaitWindowEvent():Case #PB_Event_Menu:Select EventMenu()
Case 0:f$=OpenFileRequester("Open Menu Master File","","Text (*.txt)",0)
If f$:If ReadFile(0,f$):ClearGadgetItems(0):SetGadgetText(1,""):Repeat
a$=ReadString(0):If Left(a$,12)="      Title:":AddGadgetItem(0,-1,Mid(a$,13))
EndIf:Until Eof(0):CloseFile(0):EndIf:EndIf:EndSelect
Case #PB_Event_Gadget:Select EventGadget():Case 0:If ReadFile(0,f$)
Repeat:a$=ReadString(0)
Until a$=Left(a$,12)+GetGadgetItemText(0,GetGadgetState(0))
While a$<>"MMMMM":If a$<>"MMMMM":b$+a$+#CRLF$:a$=ReadString(0):EndIf:Wend
CloseFile(0):EndIf:SetGadgetText(1,b$):b$="":EndSelect
Case #PB_Event_CloseWindow:End:EndSelect:ForEver