#! /usr/bin/env python # -*- coding: UTF-8 -*- """ Athenarum Trade: gioco in python creato da TheFox This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. """ # Descrizione del file __module_name__ = "Athenarum Trade" __module_version__ = __revision__ = versione = "0.4b" __module_description__ = "Giochino" import random, sys, time merci=["Verdura","Grano","Tessuti","Olio","Vino","Ferro","Gemme","Argento"] qmerc=[0,0,0,0,0,0,0,0] pra=[(random.randrange(50))+50,(random.randrange(100))+100,(random.randrange(150))+100,(random.randrange(100))+200,(random.randrange(100))+200, (random.randrange(100))+400,(random.randrange(100))+400,(random.randrange(150))+400] prv=[(random.randrange(50))+50,(random.randrange(100))+100,(random.randrange(150))+100,(random.randrange(100))+200,(random.randrange(100))+200, (random.randrange(100))+400,(random.randrange(100))+400,(random.randrange(150))+400] mon=3000 time = 0 # Inizio del programma print print "Athenarum Trade [versio %Beta% ED]" print print "Digita:" print "]>>buy => per acquistare" print "]>>sell => per vendere" print "]>>quit => per uscire\n\n" ch1=0 while ch1 !="quit": if mon < 0: print"Sei diventato sciavo per debiti. Hai Perso!!!" ch1 = "quit" pra=[(random.randrange(50))+50,(random.randrange(100))+100,(random.randrange(150))+100,(random.randrange(100))+200,(random.randrange(100))+200, (random.randrange(100))+400,(random.randrange(100))+400,(random.randrange(150))+400] prv=[(random.randrange(50))+50,(random.randrange(100))+100,(random.randrange(150))+100,(random.randrange(100))+200,(random.randrange(100))+200, (random.randrange(100))+400,(random.randrange(100))+400,(random.randrange(150))+400] fo=0 print time+1,"° giorno\n" print "Soldi: ",mon," Dracme\n" print "magazzino pr.acq pr.ven merce" print "---------------------------------\n" for fo in range(0,8): print " ",qmerc[fo]," ",pra[fo]," ",prv[fo]," <=",merci[fo] ch1 = raw_input("]>> ") if ch1 == "buy": print "Cosa? Premi: " print " 1. Ortaggi" print " 2. Grano" print " 3. Tessuti" print " 4. Olio " print " 5. Vino" print " 6. Ferro" print " 7. Gemme" print " 8. Argento" x=input("#>> ") print ma = mon/pra[x-1] print "Massimo acquistabile ",ma," partite di ",merci[x-1] q=input("Quantità >>") print if q > ma: print "Imbroglione torna domani!\n\n" else: mon = mon - (q * pra[x-1]) qmerc[x-1] = (qmerc[x-1])+q print "ACQUISTO CONCLUSO" print q," partite di ",merci[x-1] print "per ", (q * pra[x-1])," Dracme\n" if ch1 == "sell": print "Cosa? Premi: " print " 1. Ortaggi" print " 2. Grano" print " 3. Tessuti" print " 4. Olio " print " 5. Vino" print " 6. Ferro" print " 7. Gemme" print " 8. Argento" x=input("#>> ") print ma = mon/pra[x-1] print "Massimo vendibile ",qmerc[x-1]," partite di ",merci[x-1] q=input("Quantità >>") if q > qmerc[x-1]: print "Imbroglione torna domani!\n\n" else: mon = mon + (q * pra[x-1]) qmerc[x-1] = (qmerc[x-1])-q print "VENDITA CONCLUSA" print q," partite di ",merci[x-1] print "per ", (q * pra[x-1])," Dracme\n" if ch1 == "quit": if not time: print "Non hai resistito per manco un giorno, persiano infiltrato!" elif time==1: print "Hai resistito per un solo giorno! Ma va a fare l'oplita..." elif time<5: print "Hai resistito solo "+str(time)+" giorni. Dedicati alla politica!" elif time<10: print "Hai resistito per "+str(time)+" giorni. Gli spartani ti hanno dato qualche bustarella?" else: "Hai resistito per "+str(time)+" giorni. Complimenti." print print"Se vuoi essere segnato nell'elenco dei giocatori scrivi il tuo nome" print"Altrementi premi semplicemente INVIO" nome=raw_input("nome >>") if nome != "": pl = open("PL_v0.3.txt","a+") pl.write ("\n---------------------------------\n") pl.write ("Nome =>") pl.write (nome) pl.write ("\nSoldi Finali=> ") pl.write (str(mon)) guad = mon-3000 per = ((guad*100)/3000) pl.write ("\nGuadagno=> ") pl.write (str(guad)) pl.write ("\nGuadagno%=>") pl.write (str(per)) pl.write ("%") pl.write ("\nTempo=> ") pl.write (str(time)) pl.write (" giorni") time = time + 1