E D R , A S I H C RSS

Invest Multi - 09.22

~cpp 

import pickle
import time
import sys
   
user={}
t0,t1,t2="1","1","1"
nations={'KOREA':0 ,'JAPAN':700 , 'CHINA':300, 'INDIA':100}
items={'INT':400 , 'DOUBLE':800}

def start_menu():
    print '*'*25
    print '1. Current Nation states '
    print '2. My business '
    print '3. Move to another Nation '
    print '4. Invest to this Nation '
    print '5. View Ranking '
    print '6. Earn Money '
    print '*'*25
    

def Move():
    global t0,t1,t2,user
    print '*'*10
    print '1. JAPAN '
    print '2. CHINA '
    print '3. INDIA '
    print '*'*10
    select = input('Select Menu -->')
    if select == 1:
        user[t2] = 'JAPAN'
    elif select == 2:
        user[t2] = 'CHINA'
    else:
        user[t2] = 'INDIA'
    start_menu()
        
def Invest():
    global t0,t1,t2,user
    print 'Current Nation is : ',user[t2]
    

def join():
    global user,t0,t1,t2 
    t0 = raw_input('INPUT ID ---->')
    user[t0] = raw_input('INPUT PASSWORD ---->')
    t1 = t0+'money'
    user[t1] = 5000
    t2 = t0+'nation'    
    user[t2] = 'KOREA'
    f= open('t7.txt','a+')

    pickle.dump(user, f)
    f.close()

    f = open('t7.txt','r')

    f.close()

def State():
    pass

if __name__ == '__main__':
    join()
    start_menu()
    select = raw_input('Select Menu -->')
    if select == '1':
        State()
    elif select == '2':
        Business()
    elif select == '3':
        Move()
    elif select == '4':
        Invest()
    elif select == '5':
        Ranking()
    elif select == '6':
        Earn()
    
        

09.23
~cpp 
import pickle
import time
import sys
   
user={}
ID,MONEY,NATION,INVEST="","","",""
nation={'KOREA':0 ,'JAPAN':0.8 , 'CHINA':0.3, 'INDIA':0.1}
items={'INT':400 , 'DOUBLE':800}
f= open('t8.txt','a+')


def join():
    global user,ID,MONEY,NATION 
    ID = raw_input('INPUT ID ---->')
    user[ID] = raw_input('INPUT PASSWORD ---->')
    '''if user.has_key(ID) == False:'''
    MONEY = ID+'money'
    user[MONEY] = 5000
    NATION = ID + 'nation'    
    user[NATION] = 'KOREA'
    '''
        for i in range(0,4):
            for j in range(0,3):
                temp = ID + nation.keys()[i] + items.keys()[j]
                user[temp] = 0
    '''        
        
        
def start_menu():
    print '*'*25
    print '1. Current Nation states '
    print '2. My business '
    print '3. Move to another Nation '
    print '4. Invest to this Nation '
    print '5. View Ranking '
    print '6. Earn Money '
    print '7. Save and Exit '
    print '*'*25
    select_menu()
    
def select_menu():
    select = raw_input('Select Menu -->')
    if select == '1':
        m.state()
    elif select == '2':
        m.business()
    elif select == '3':
        m.move()
    elif select == '4':
        m.invest()
    elif select == '5':
        m.ranking()
    elif select == '6':
        m.earn()
    elif select == '7':
        m.exit()
    else :
        start_menu()


class Menu:
    
    def move(self):
        global ID,MONEY,NATION,user
        print '*'*10
        print '1. JAPAN '
        print '2. CHINA '
        print '3. INDIA '
        print '*'*10
        select = input('Select Menu -->')
        if select == 1:
            user[NATION] = 'JAPAN'
        elif select == 2:
            user[NATION] = 'CHINA'
        else:
            user[NATION] = 'INDIA'
        print '  WELCOME TO  ', user[NATION]
        start_menu()

             
    def invest(self):
        global ID,MONEY,NATION,user,INVEST
        print 'This Nation has these items :: ' ,items.keys()[0] ,' , ', items.keys()[1] 
        print items.keys()[0] , ' :: ' , items.values()[0] , ' bytes '
        print items.keys()[1] , ' :: ' , items.values()[1] , ' bytes '
        print 'What item do you want to invest ? '
        print '1. ' ,items.keys()[0]
        print '2. ' ,items.keys()[1]
        select = input('select ----> ')
        quantity = input('How Many do want to buy this item ? ')

        if select == 1:
            INVEST = user[ID] + user[NATION] +items.keys()[0]
            user[INVEST] = nation[user[NATION]] * items.values()[0] * quantity
            print 'You invested to ' , items.keys()[0], 'as much ', quantity , 'in', user[NATION] 
            print 'You consumed ' , user[INVEST] , ' bytes'
            user[MONEY] = user[MONEY]- user[INVEST]
            print 'Your remained bytes is ' , user[MONEY]

        elif select == 2:
            INVEST = user[ID] + user[NATION] + items.keys()[1]
            user[INVEST] = nation[user[NATION]] * items.values()[1] * quantity
            print 'You invested to ' , items.keys()[1], 'as much ', quantity , 'in', user[NATION] 
            print 'You consumed ' , user[INVEST] , ' bytes'
            user[MONEY] = user[MONEY]- user[INVEST]
            print 'Your remained bytes is ' , user[MONEY]

        start_menu()

    def state(self):
        Temp = user[NATION]
        print user[NATION]
        print 'The Market price is ' , nation[user[NATION]] , ' bytes '
        print 'This Nation has these items :: ' ,items.keys()[0] ,' , ', items.keys()[1] 
        print items.keys()[0] , ' :: ' , items.values()[0] , ' bytes '
        print items.keys()[1] , ' :: ' , items.values()[1] , ' bytes '
        start_menu()

    def business(self):
        for i in range(0,4):
            for j in range(0,3):
                temp = ID + nation.keys()[i] + items.keys()[j]
                print items.keys()[j] , ' in ' , nation.keys()[i] , ' : ',  user[temp]
        print 'My location is ' , user[NATION]
        print 'Current my money is ' , user[MONEY] , ' bytes'
    
    def exit(self):
        pickle.dump(user, f)
        f.close()
        print 'Log out,  Thank you~~!'
 
if __name__ == '__main__':
    m = Menu()
    join()
    start_menu()
    
    
9.25 ALPHA Version complete.
~cpp 
import pickle 
import time 
import sys 

ID,MONEY,NATION,INVEST="","","","" 
nation={'KOREA':0 ,'JAPAN':0.8 , 'CHINA':0.3, 'INDIA':0.1} 
items={'INT':400 , 'DOUBLE':800} 
user = {}
f= open('t8.txt','a+')
 
def join():
    global user,ID,MONEY,NATION
    ID = raw_input('INPUT ID ---->') 
    user[ID] = raw_input('INPUT PASSWORD ---->')
    MONEY = ID+'money' 
    user[MONEY] = 5000 
    NATION = ID + 'nation'     
    user[NATION] = 'KOREA'
    temp = ID + 'CHINAINT'
    user[temp] = 0
    temp = ID + 'CHINADOUBLE'
    user[temp] = 0   
    temp = ID + 'JAPANINT'
    user[temp] = 0
    temp = ID + 'JAPANDOUBLE'
    user[temp] = 0
    temp = ID + 'INDIAINT'
    user[temp] = 0
    temp = ID + 'INDIADOUBLE'
    user[temp] = 0
    
def start_menu(): 
    print '*'*25 
    print '1. Current Nation states ' 
    print '2. My business ' 
    print '3. Move to another Nation ' 
    print '4. Invest to this Nation ' 
    print '5. View Ranking ' 
    print '6. Give up this game ' 
    print '7. Save and Exit '
    print '*'*25 
    select_menu() 
     
def select_menu(): 
    select = raw_input('Select Menu -->') 
    if select == '1': 
        m.state() 
    elif select == '2': 
        m.business() 
    elif select == '3': 
        m.move() 
    elif select == '4': 
        m.invest() 
    elif select == '5': 
        m.ranking() 
    elif select == '6': 
        m.bankrupt() 
    elif select == '7': 
        m.exit() 
    else :  
        start_menu()
 
class Menu:
    def move(self): 
        global ID,MONEY,NATION,user 
        print '*'*10 
        print '1. JAPAN ' 
        print '2. CHINA ' 
        print '3. INDIA ' 
        print '*'*10 
        select = input('Select Menu -->') 
        if select == 1: 
            user[NATION] = 'JAPAN' 
        elif select == 2: 
            user[NATION] = 'CHINA' 
        else: 
            user[NATION] = 'INDIA' 
        print '  WELCOME TO  ', user[NATION] 
        start_menu() 
    
    def invest(self): 
        global ID,MONEY,NATION,user,INVEST
        if user[NATION] == 'KOREA':
            print 'Can not invest this nation!!'            
        else:
            print 'This Nation has these items :: ' ,items.keys()[0] ,' , ', items.keys()[1]  
            print items.keys()[0] , ' :: ' , items.values()[0] , ' bytes ' 
            print items.keys()[1] , ' :: ' , items.values()[1] , ' bytes ' 
            print 'What item do you want to invest ? ' 
            print '1. ' ,items.keys()[0] 
            print '2. ' ,items.keys()[1]
            select = input('select ----> ') 
            quantity = input('How Many do want to buy this item ? ') 
            if select == 1: 
                INVEST = ID + user[NATION] +items.keys()[0]
                user[INVEST] = nation[user[NATION]] * items.values()[0] * quantity 
                print 'You invested to ' , items.keys()[0], 'as much ', quantity , 'in', user[NATION]  
                print 'You consumed ' , user[INVEST] , ' bytes' 
                user[MONEY] = user[MONEY]- user[INVEST] 
                print 'Your remained bytes is ' , user[MONEY]
            elif select == 2: 
                INVEST = ID + user[NATION] + items.keys()[1] 
                user[INVEST] = nation[user[NATION]] * items.values()[1] * quantity 
                print 'You invested to ' , items.keys()[1], 'as much ', quantity , 'in', user[NATION]  
                print 'You consumed ' , user[INVEST] , ' bytes' 
                user[MONEY] = user[MONEY]- user[INVEST] 
                print 'Your remained bytes is ' , user[MONEY]
        start_menu() 
 
    def state(self): 
        Temp = user[NATION] 
        print user[NATION] 
        print 'The Market price is ' , nation[user[NATION]] 
        print 'This Nation has these items :: ' ,items.keys()[0] ,' , ', items.keys()[1]  
        print items.keys()[0] , ' :: ' , items.values()[0] , ' bytes ' 
        print items.keys()[1] , ' :: ' , items.values()[1] , ' bytes ' 
        start_menu() 
 
    def business(self):
        print 'My location is ' , user[NATION]
        print 'Current my money is ' , user[MONEY] , ' bytes'
        temp = ID + 'CHINAINT'
        print 'INT in CHINA : ', user[temp]
        temp = ID + 'CHINADOUBLE'
        print 'DOUBLE in CHINA : ', user[temp]
        temp = ID + 'JAPANINT'
        print 'INT in JAPAN : ', user[temp]
        temp = ID + 'JAPANDOUBLE'
        print 'DOUBLE in JAPAN : ', user[temp]
        temp = ID + 'INDIAINT'
        print 'INT in INDIA : ', user[temp]
        temp = ID + 'INDIADOUBLE'
        print 'DOUBLE in INDIA : ', user[temp]
        start_menu()
  
    def ranking(self):
        print ID, ':' , user[MONEY] , ' bytes'
        start_menu()

    def bankrupt(self):
        if user[MONEY] > 0:
            print 'Consider your decide again. You still have some money.'
            start_menu()            
        else:
            user[NATION] = 'KOREA'
            print 'You become bankrupt!! You must make new ID for continuing this game.'
            m.exit()
             
    def exit(self): 
        pickle.dump(user, f)

        f.close() 
        print 'Log out,  Thank you~~!' 
  
if __name__ == '__main__': 
    m = Menu() 
    join() 
    start_menu()

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:28
Processing time 0.0109 sec