Jump to content





Photo

Pick-A-Mod Source Code

Posted by le717 , in Triangular Minifigure Blog 19 January 2013 · 272 views

Since I had one interested party in the Pick-A-Mod source code, and since there really is no harm in releasing it (and any programmer can figure out how to remake it in any language they know), the Pick-A-Mod source code is in a spoiler below. . I made some minor changes to it, such as converting it for both Python 2.7.3 and 3.3, and added the ability to quit the while loop by pressing q. The code is pretty self-explanatory, so I did not leave any comments. Enjoy.

Pick-A-Mod
Spoiler




Well, since we're playing at how many lines we can do this in...

import random, webbrowser
#you really don't need to alias an import if you're only using it once

raw_input("Welcome to Pick-A-Mod!\nPress anything to begin: ")
staff = ("Cyrem", "Addictgamer", "antillies", "Cirevam", "Amauros", "apemax", "Oboe Shoes")
while True:
   if  raw_input(random.choice(staff)+"\nThis is good, yes?").lower() in ['', 'y', 'yes']: break
   else: pass
webbrowser.open_new_tab("http://www.rockraidersunited.org/index.php?app=members&module=messaging&section=send&do=form")
You can use &fromMemberID=IDNUMBERHERE to add the name into the Recipient Name field.
Of course, you'd need to add their user ID numbers into it to do that.

You can use &fromMemberID=IDNUMBERHERE to add the name into the Recipient Name field.
Of course, you'd need to add their user ID numbers into it to do that.


I knew there was some URL trick to do that, just couldn't figure it out!

I knew there was some URL trick to do that, just couldn't figure it out!

Oh look, the perfect opportunity to use a dictionary.

Well, since we're playing at how many lines we can do this in...

*code snip*


import this

The Zen of Python

//Lines 2 and 3 only
Explicit is better than implicit.
Simple is better than complex.

You line all your code up on a few lines, I spread it out. You have a few implied statements, I have explicitly stated them. When I write code, a tutorial, or anything, I strive for neat, understandable text that can be read easily. My source shows that. However, I'm not going to bonk you over the head saying to code the same way as I, since we are all different, and everyone has their own style. ;)
Sometimes less is more :P

Edit: It's also not that the code is complex, it's that the code is condensed.

October 2014

S M T W T F S
      1234
567891011
12131415161718
192021 22 232425
262728293031 

Search My Blog

Recent Entries

Recent Comments

0 user(s) viewing

0 members, 0 guests, 0 anonymous users