• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.
  • Hey Guest. Check out the NeoGAF 2.2 Update Thread for details on our new Giphy integration and other new features.

Devs and people who want to be Devs: pythonchallenge.com is an incredible way to learn a new programming language

Mar 18, 2020
1,194
3,104
535
www.pythonchallenge.com

This is basically a set of riddles that can be solved (or rather, should be solved) using your computer. You can pretty much use any programming language you want but level 5 and 23 require Python so it's pretty much recommended to use that. They get harder with each level and the complexity ramps up pretty fast. They aren't aimed at genius level programmers, pretty much anyone can solve the riddles (some require clever tricks) provided they put some effort in them. However, there is no guidance on how to solve them and the hints are very cryptic in nature.

They can totally be solved by beginners though provided you are ok with using google and stackoverflow (to get help using third party libraries, not looking up solutions).

Each riddle has it's own address eg level 0 is: http://www.pythonchallenge.com/pc/def/0.html
To advance to the next level, you need to find the name of the next html document. This one (level 0) is called 0.html.

Basically, you have a base url
Code:
http://www.pythonchallenge.com/pc/def/<NEXT LEVEL ID HERE>.html
where you add the id for the next level.

The first one is pretty easy and can be solved without typing any code. Check it out by typing the solution into the base url and navigate to the site.

I'm only up to level 9 and level 7 has been my favorite so far.

Don't open if you want to avoid spoilers.



The html for level 7 contains nothing but this picture. No hint is given. Looking at the source code of the site is pointless as it's pretty barebones so the solution has to be coded into the picture. I first read up on steganography but quickly dropped it since it seems a bit hard for this early level and decoding it without the password seems impossible anyways.

The metadata of the image contains an interesting comment though:
Created with The GIMP
The creator fiddled with the image using gimp. Since I had it installed, I opened the picture with gimp and played around with the color settings. The area in the middle is obviously doctored in. Zooming in shows several rectangles with a fixed width of 7 pixels.


Using the color picker tool you can extract the exact RGB values of the rectangles which looks like this

The first selected rectangle has a color of 0x737373 which is R=115, G=115, B=115. I checked every rectangle and for every single one R==B==G. Another interesting thing is that every color point can be represented by 8 bits which in turn can be represented by an ASCII character.

That means those rectangles are nothing more than ASCII characters encoded as colored rectangles.

Going through the first 5 rectangles and extracting the R (or B or G) values leads to the sequence 115, 109, 97, 114, 116. Converting them to a string is trivial in any language so I'll skip that part. All thats left is pretty much going through all rectangles. Which leads to the name of the next html (level 8).

Writing a python script for this is pretty easy using the PIL package. Open picture, loop through pixels 0 to width, at height / 2 and step 7 pixels at a time extracting either R or B or G. Last step, convert them to a string using join or whatever.

This honestly feels kind of addictive. Since it's a great way to learn a new programming language, I'd recommend solving them using one you aren't familiar with. Just skip puzzle 5 and 23 since they require python specific libraries. Or better yet, start with Python if you aren't proficient yet.
 

mango drank

Member
May 12, 2009
1,554
1,892
1,205
Made it up to #4 using basic JS and looking through my old notes from Free Code Camp. But I never learned linked lists, and from Googling they don't look straightforward, so I'm out.
 
  • Like
Reactions: Fictive

kamkamkam

Member
Jan 11, 2021
214
482
295
Made it up to #4 using basic JS and looking through my old notes from Free Code Camp. But I never learned linked lists, and from Googling they don't look straightforward, so I'm out.
Linked lists sound complex but are cake. Every node points to the next node.

Scavenger hunts are a real world example. Ex. First clue describes the location of the second clue. Second leads to third, so on and so forth.
 

Soodanim

Member
Feb 24, 2012
7,170
2,461
1,005
United Kingdom
I might look into this as Python could be useful for me in the future, but level 7 seems more like obscure ARG cryptic nonsense where Python is an after thought.