[Python] Marble game

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Well, it's a simple little game. Kinda pointless since:
You cannot win
PHP:
from time import sleep
print
print 'Welcome to the 21th game'
print 'The point of this game is to choose a number of marbles out of the 21 provided, you can take any number of marbles between 1 and 3.'
print 'The one that takes the last marble loose.'
print 'You will play against a computer.'
print 'You start'
marbles = 21
loop = 0
while loop != 1:
    print
    print 'How many marbles do you choose?'
    print '1. One'
    print '2. Two'
    print '3. Three'
    choice = input(">>>")
    print
    if choice < 4 and choice > 0:
        marbles = marbles - choice 
        print 'You choose to take ', choice, " marbles, there's now ", marbles, 'marbles'
        if marbles > 0:
            compchoice = 4 - choice
            print
            sleep(1)
            marbles = marbles - compchoice
            print 'The computer takes away ', compchoice, "marbles. there's now", marbles, "marbles"
            sleep(1)
        else:
            print "There's now no marbles left"
            print "You lose"
            loop = 1                
    else:
        print 'You cant pick more than 3 marbles'
 

UndeadDragon

Super Moderator
Reaction score
448
Maybe you should make a game that you can actually win :D

So you don't always loose :rolleyes:
 

Samael88

Evil always finds a way
Reaction score
181
Can't you atleast use some kind of random thing to determine the compchoise?
That would atleast make it a little easier to win:p
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
You get python and copy the code into a text document and name it *something*.py

As for the losing part, I was going to do an AI for it, but this was enough. I just enjoy giving it to people and let them solve it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top