|
Member
(06-29-2012, 02:55 PM)
|
The NeoGAF Weekly Recreational Programming Challenge
#1
What's going on?
The short and sweet is: A weekly topic, people code stuff, someone wins. We are in week 2. Here is the countdown to voting: ![]() List of challenges Week 1 (Flora) ...... Winner: (1) lorebringer generates fractal-based plant life on your browser. (Post) (Solution link) (Source) Week 2 (Mazes) .... Happening right now! CODE, YOU FOOLS. CODE!! Rules How does it work? Each Friday, a programming challenge is posted. Any NeoGAF member can take part in the challenge. You can use any programming language you like to take part in the challenge. Once you're happy with your submission, you point us to either a compilate or the source code. How you do this exactly is up to you. Neither screenshots nor video suffice though. The challenge runs until Thursday. On Thursday, we try to determine who won the challenge. We do this by voting. Voting ends on Friday. Who posts the challenge? I post the first challenge. After that, it's up to the challenge winner to either post the next challenge, or to give someone else the opportunity to post a challenge. How does voting work? Each NeoGAF member gets one vote. After voting is started with an appropriate post, challenge submissions are still accepted, but will probably get less votes. All challenge submissions are rounded up in a post to make it easy to find them. They are listed in order of submission post date. It is okay to submit multiple times, as long as the submissions are dissimilar enough from each other. Members vote for submissions, not for posters. They do this by saying "I vote for (some submission)" or similar. What do I win? That is for the challenge poster to decide. It might only be internets, it might be a Steam game, whatever. Of course it makes sense if the challenge poster has made sure he can actually produce the price when it's time. Also, remember that NeoGAF has a global audience, so things like iTunes codes only work if the region applies, for instance. The person who has posted the challenge cannot claim the prize. If said person wins his own challenge, the prize goes to the next-best participant. The right to post a new challenge remains with the winner though, it is not attached to the prize. What kind of challenges are okay? Don't post overly hard challenges. Don't post challenges that would take a lot of time to complete. Don't post challenges that are actually your homework assignments or similar. Don't post challenges that need a lot of research. Apart from that, pretty much anything goes. Preferably, you post challenges that are cool for non-programmers to experience. That includes audio- and video-related challenges, and ones that demand input and create output of some kind. But that's not really mandatory. Does it have to be one week only? As a challenge poster, you can extend the deadline if you want to at any point. The maximum amount of weeks a challenge can run is 4 weeks. You should only extend the deadline if you feel like it makes the challenge better though. Do I have to write perfect code? No. It's not about perfect code. It's about programming for entertainment, coming up with a cool thing, showing it off, and being proud of it. So there is nothing that can disqualify you. Just don't destroy stuff or delete files with your code. So you can certainly write shitty code and get away with it in here. You might get lucky though insofar as others might give you pointers on what you might want to do differently. What about copyright, trademarks and all that? Use common sense. For example, if you invent a new collision detection algorithm that dwarfs all other algorithms out there while you're coding for a challenge, you might not want to publish it without making sure you're satisfied with the results of said publishing. Other than that, assume you're writing public domain code because noone on these boards can guarantee you rights to anything. Of course, you cannot use trademarked content, and you have to respect the copyright of others. We're not above the law just because we're having a friendly coding challenge. What are the go-to languages for this? C, C++, Python, Java, C#, Objective C, Javascript. Can I use custom frameworks, obscure platforms, esoteric programming languages? If you do this, you need to be able to make it trivial for everyone to check your stuff out. For example, if you want to use LÖVE, then go ahead, but do it with the current release, and provide instructions on how to run your solution. If someone else has already posted run instructions, then it suffices to reference that post. Where can I go to get help regarding all things programming? Provided you've already used a search engine to dig for answers, you're of course welcome in the Programming |OT|.
Last edited by wolfmat; 07-10-2012 at 01:10 PM.
|
|
|
|
Member
(06-29-2012, 02:56 PM)
|
Challenge Week 1 — 2012-06-29 - 2012-07-05
#2
Challenge Week 1: Flora
Write an application that generates visual representations of plants on the screen. Price Penny Arcade Adventures: Precipice of Darkness Combo Pack on Steam. The gift is already in my Steam inventory. Voting has started! Voting ends at 2012-07-06 1500 GMT ![]() If you participate, you should be ready to post a challenge once voting is done and you are the winner. Good luck! Submissions Winner: (1) lorebringer generates fractal-based plant life on your browser. (Post) (Solution link) (Source) Votes: 7 (2) wolfmat makes a scrolling terminal thing. (Post) (Source) Votes: 2 (3) Half and half uses fractals and adds mood with colours. (Post) (Source) Votes: 2
Last edited by wolfmat; 07-06-2012 at 03:27 PM.
|
|
Member
(06-29-2012, 04:22 PM)
|
#5
I wanted to mess around with and learn some Canvas stuff and this sounds like the perfect opportunity to jump in!
edit: just a taste of what I got done today... http://i.imgur.com/aRMbt.png D: Canvas is pretty damn cool.
Last edited by rhfb; 06-29-2012 at 10:28 PM.
|
|
Member
(06-29-2012, 10:55 PM)
|
#7
Edit: I also started with grass (after making the console rasterize based on block characters and stuff):
Quote:
Last edited by wolfmat; 06-30-2012 at 09:57 AM.
|
|
Member
(06-30-2012, 10:57 AM)
|
#14
I just draw randomized segmented lines like a crazy person, and apply finetuning. Fractals would work as well though. They would probably yield much more unique outcomes as well.
The biggest question mark for beginners who know for-loops, functions and all that is probably "How do I make a window with a surface on which I can draw pixels?". It's actually easy to find out though, and not a complicated thing at all. You usually don't have to reinvent any of this. Once you know how to draw pixels, and maybe images, it's just a matter of playing with it. "So I start here, and then I draw a line to there, and from that point to there, and here comes the rotated blossom pic I made in MS Paint" is a valid approach. Or you do something completely different. |
|
Member
(06-30-2012, 05:22 PM)
|
#24
Awesome idea. I've been meaning to do some stuff on L-Systems (Wikipedia) since I heard about them in my computer graphics lecture. I initially wanted to do something with Java, but since it doesn't seem too easy to use colors in Java console applications I switched to C#. Probably for the better, anyways.
|
|
Member
(06-30-2012, 06:22 PM)
|
#26
|
|
Member
(07-01-2012, 01:50 AM)
|
#30
You fractal tree people are making my stuff look terrible :(
And canvas is pretty cool, don't know if I'm going to try to animate my stuff or just make it static since I'm putting controls on the page the canvas is on to interact with it (change how much grass is present, the time of day, number of flowers, ect). |
|
Member
(07-01-2012, 01:59 AM)
|
#32
I guess we should establish some ground rules though.
1) Is your application prohibited from using textures, what graphic libraries can you use? 2) How much of a framework can you use (i.e. could someone use DirectX, Unreal, Unity) or are you expecting the use of raw programming languages 3) Shouldn't 100% of the source of the application be publicly accessible to ensure the first 2? |
|
Member
(07-01-2012, 02:06 AM)
|
#33
|
|
Member
(07-01-2012, 02:53 AM)
|
#34
And since this is a graphical challenge I guess people wouldn't need to release their source code, but if I can't see how someone did something the odds of me voting for them are slim :p |
|
Member
(07-01-2012, 06:06 AM)
|
#35
Demanding that everyone makes the source code available for everyone is something I don't see a reason for. Sometimes, it's not even realistic. If you do a cool trick in your code, maybe you want to talk about it a little at least, maybe post a snippet or whatever. But if you want to keep the magic completely under the hood, then go ahead and only publish whatever's necessary to get your app running. If it turns out this breaks the whole thing, then we can always change the rules. But I don't think it will. As for DirectX, Unreal, Unity, LÖVE, GameMaker, OpenGL, LWJGL, JMonkey, maybe even werkkzeug: You can use whatever you like. Even the Blender built-in game engine is cool beans, and that one makes graphical challenges pretty easy, comparatively. It's your choice. So if you want to use pygame or stb_truetype or some obscure math lib, go right ahead. Addendum to the rules: The person who has posted the challenge cannot claim the prize. If said person wins his own challenge, the prize goes to the next-best participant. The right to post a new challenge remains with the winner though, it is not attached to the prize.
Last edited by wolfmat; 07-01-2012 at 06:09 AM.
|
|
Member
(07-01-2012, 04:06 PM)
|
#37
Last edited by Tacitus_; 07-01-2012 at 04:15 PM.
|
|
Member
(07-01-2012, 04:43 PM)
|
#38
I think my entry is pretty much done. There's loads of stuff I'd like to do with it still but I should really get back to my other work.
You can run it here: http://lifenoodles.ronkmonster.com/ I have the defaults set low enough that most pcs should be fine to run it but feel free to crank the number of trees up a lot and see how it performs. Let me know if it won't run or does something odd as I've only tested in chrome and firefox. Chrome is much faster drawing this than Firefox is as well. You can get the source from the page just with a rightclick -> save as but here's the direct download link anyway: http://lifenoodles.ronkmonster.com/plants.zip Disclaimer: I still need to optimise and clean up the source, it's a hacky mess. Don't judge me gaf.
Last edited by lorebringer; 07-01-2012 at 05:03 PM.
|
|
Member
(07-01-2012, 06:51 PM)
|
#39
I'll immediately add your submission to the list in the challenge post. Edit: Done. It works well in my Firefox, so hooray.
Last edited by wolfmat; 07-01-2012 at 06:56 PM.
|
|
Member
(07-01-2012, 07:24 PM)
|
#41
|
|
Member
(07-01-2012, 10:17 PM)
|
#44
Here's my submission: flora.py
Edit: This version is for consoles that can only do ASCII: flora_bw.py I'll post a GIF later. Here's a screenshot though:
Quote:
0. Make sure you've got Python 2.6.7 or above installed, but NOT Python 3 or above. Python 2 is the way to go in this case. 1. Make sure you have a terminal that supports UTF-8 2. Make sure the terminal supports ANSI colours and escape sequences 2. Set the font to Menlo Regular 14pt 3. Set the line spacing to 0.81 4. Set the letter spacing to 1 How to run it: 0. Open the terminal 1. Navigate to the directory where flora.py is 2. python flora.py 3. Let it run 4. If you want to exit the program, press Ctrl-C Fun stuff: — You can resize the terminal before running; the thing adjusts — It is unpredictable, but self-similar, and has no fractal stuff — It scrolls and there's shadowing (lol) Not so fun stuff: — It might flicker, that's because the fillrate is severely limited. Reduce your terminal size. — Minimal terminal height is 15 lines — It has only been tested thoroughly on Mac OS X If you do not have Menlo, then play around with terminal fonts until it looks right. It's not easy for me to find out which font works perfectly everywhere. Sorry for that. Menlo is a standard OS X font. Note that the program clears the screen by basically scrolling down. If your terminal starts slowing down after running the program, clear the terminal's line buffer (or type "reset" without quotes and press enter).
Last edited by wolfmat; 07-02-2012 at 03:10 AM.
Reason: Windows console dimensions fix
|
|
Member
(07-01-2012, 11:11 PM)
|
#46
I don't have menlo (I'm running windows 7), but I have a similar font. I can't get your script to run, using python 3.1.
If I execute "python flora.py" from the command line, the error I get is: Code:
D:\temp>python flora.py
Traceback (most recent call last):
File "flora.py", line 26, in <module>
height, width = os.popen('stty size', 'r').read().split()
ValueError: need more than 0 values to unpack
|
|
Member
(07-01-2012, 11:18 PM)
|
#48
I replaced it with 80, 80 as strings. It runs now, but I can't figure out how to have the command line use utf-8. it scrolls endlessly with
Code:
Γûê←[32mΓûê←[32mΓûê←[32mΓûê← Γûê←[32mΓûê←[92mΓûê←[32mΓûê← Γûê←[31mΓûê←[31mΓûê←[30mΓûê← Γûê←[32mΓûê←[32mΓûê←[32mΓûê← Γûê←[92mΓûƒ←[92mΓûê←[32mΓûê← Γûê←[32mΓûê←[92mΓûê←[32mΓûê← |
|
Member
(07-01-2012, 11:53 PM)
|
#49
Yes, you need a better console. UTF-8 support is key, and ANSI colour support via escape sequences is also necessary. Otherwise, it's just broken, and I don't know how to fix it.
Well, I could make a variant that uses no colour, and non-UTF-8 letters. Anyway, here's something that can detect the console dimensions on Windows, at least: http://pastebin.com/LRLFSwmT |
|
Member
(07-02-2012, 12:10 AM)
|
#50
Okay, for the poor Windows folks who only have cmd, and anyone else who enjoys ASCII art, here's an alternative: flora_bw.py
Quote:
I'm done! That's it! Thanks for the bug report, usea! Looking forward to what you guys come up with! Edit: The second screenshot managed to get there after 6 steps because I adjusted the redraw line, takes too long otherwise with such a big image.
Last edited by wolfmat; 07-02-2012 at 12:45 AM.
Reason: Screenshot
|