Sfoglia il codice sorgente

删除 'gameLife.py'

nonvioce 6 mesi fa
parent
commit
83e28ce046
1 ha cambiato i file con 0 aggiunte e 51 eliminazioni
  1. 0 51
      gameLife.py

+ 0 - 51
gameLife.py

@@ -1,51 +0,0 @@
-import random
-
-
-#主类
-class Timer:
-    def __init__(self):
-        self.time = 0
-
-    def update(self):
-        self.time += 1
-
-
-#交易中心
-class TradeCenter:
-    def __init__(self):
-        #定义当前价格
-        self.price = random.uniform(1,100)#当前股价
-        self.total = 100000#共有多少股
-        self.majorNum = 100000#当前系统持有股
-        self.majorNumOld = 100000#前一天系统持有多少股
-
-    def update(self):
-        #更新价格
-        a = random.uniform(-1,1) + (self.majorNum - self.majorNumOld)/self.total
-        if abs(a)<=0.2*a:
-            self.price = self.price + a
-        elif a>0:
-            self.price = self.price*1.2
-        else:
-            self.price = self.price*0.8
-        #存储前一天持有股
-        self.majorNumOld = self.majorNum
-    
-    def buy(a,self):
-        self.majorNum += a
-
-    def sell(a,self):
-        self.majorNum -= a
-
-class Person:
-    def __init__(self):
-        self.money = 100#可用金额
-        self.Num = 0#持有股数
-    def buy(a,TradeCenter,self):
-        self.money -= a*TradeCenter.price
-        self.Num += a
-        TradeCenter.sell(a)
-    def sell(a,TradeCenter,self):
-        self.money += a*TradeCenter.price
-        self.Num -= a
-        TradeCenter.buy(a)