
Old thread here.
The idea stems from an internet forum phenomenon where forum goers submit tidbits based on rules provided in the initial post. This, combined in a programming forum, would be a great source of learning for everyone and a great opportunity to be apart of a nifty community project!
Rules:
- 1) You are only allowed up to 15 lines of code per submission. You may remove, alter or correct any lines of code that have already been added; this will count against your total lines.
2) You are only allowed to make an additional submission of code after two others have posted their own submission. There is no limit to "posting submissions" as long as you obey the rule.
3) You may not use the "same line" character(none of these: A$ = "yes" : B$ = "no").
4) All PureBasic commands are allowed(including Ogre). However, Includes and custom Libraries are not.
5) All new code submissions must use the latest code submission.
6) Please comment your code. Since this project is meant for us to learn from each other, why leave code without comments? You are not required to leave comments.
7) No external files can be included. This includes pictures and sounds. However OS included items such as Icons and Cursors, etc, are allowed.
And finally, the code must compile after each new submission! As long as the project compiles, then your code qualifies! Other users may finish your intended code, or you may finish it once you're able to post again! Just make sure it compiles!
Code: Select all
;------------------------------------------------------------------------------------------------
; PureBasic Community "Evolving Code" - Second Incantation
;
; Started: July 15, 2010
; Last Revision: July 15, 2010
;
; Contributors:
;
;------------------------------------------------------------------------------------------------
; Enumation started, so save everyone some lines for their constants!
Enumeration
#PBC_Window_0 = 0 ; PBC = PureBasic Community, hope it don't sound too bad
#PBC_Gadget_Text_0
EndEnumeration
Global ScreenWidth.l = 300, ScreenHeight.l = 200, EventID.l
Title$ = "Evolving Code!"
TextString$ = "Feel the PurePower!"
Text0Length.l = Len(TextString$)*5.5 ; This will hopefully save someone a line incase they wish to edit the string
OpenWindow(#PBC_Window_0,0,0,ScreenWidth,ScreenHeight,Title$,#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ; Hopefully this will give us something to play with :)
TextGadget(#PBC_Gadget_Text_0,1,1,Text0Length.l,20,TextString$) ; I just a text gadget for us to play with
Repeat
EventID = WaitWindowEvent(20) ; So we don't kill our laptops CPU :(
Until EventID = #PB_Event_CloseWindow