Code hacks: Difference between revisions

From Armagetron Advanced
TiTnAsS (talk | contribs)
No edit summary
Lucifer (talk | contribs)
m Removed TnA's script because it's not really an armagetronad code hack
Line 6: Line 6:
</pre> </code>" </nowiki> </pre>
</pre> </code>" </nowiki> </pre>
Note: there is no <nowiki><code></nowiki> in front of the script.
Note: there is no <nowiki><code></nowiki> in front of the script.
== TiTnAsS pro version of "Take" ==
<pre>
numMatches = 15
player1 = raw_input("Player 1's name: ")
player2 = raw_input("Player 2's name: ")
players = (player1,player2)
currentPlayer = 0
print "The rules to this game are simple."
print "You can't take more then 3 matches."
print "The person to take the last match is the loser."
print "Good luck! :)"
while numMatches > 0:
    print " "
    print "It's",players[currentPlayer] + "'s","turn."
    print "There are",numMatches,"matches left."
    inputValid = False
    while inputValid is not True:
        numTaken = str(raw_input("How many matches do you want to take? ") )
        if numTaken.isdigit():
            numTaken = int(numTaken)
            if numTaken > 3 or numTaken <= 0:
                print "You must pick 1-3 matches.  You picked " + str(numTaken)
            else:
                inputValid = True
        else:
            print "You must enter a number from 1 to 3."
    numMatches = numMatches - numTaken
    currentPlayer = 1 - currentPlayer
print players[currentPlayer],"is the winner!"
</pre> </code>

Revision as of 04:01, 27 August 2006

From time to time people do various hacks to the code or write various scripts and programs to support the game. We'll try to collect them here so you can use them too. If you have a hack you'd like to add, just add it here. For it to format correctly, put

<nowiki> 
"<pre> 
Copy paste your script here, in the space inbetween the code and pre commands.

" </nowiki>

Note: there is no <code> in front of the script.