示例#1
0
 def buyProduce(self, credit):
     for x in range(len(self.consumtion)):
         if (Environnement.stock[self.consumtion[x]] > 0):
             credit -= Environnement.buyStock(self.consumtion[x],
                                              self.consumtion_amount[x])
         else:
             credit -= 2000
     return credit
示例#2
0
    def test_win_diagonal(self):
        self.winner = [(0, 0), (1, 1), (2, 2)]
        self.loser = [(0, 1), (0, 2), (1, 2)]
        a_1 = AgentTest(self.winner, 'O')
        a_2 = AgentTest(self.loser, 'X')

        environnement = Environnement()

        test = play_game(a_1, a_2, environnement)

        self.assertEqual(test, 'O')
示例#3
0
 def showEnv(self):
     Environnement.showEnvironnementStock()
     Environnement.showEnvironnementPrice()
示例#4
0
 def turnOver(self):
     Environnement.turnOver()
示例#5
0
 def sellProduce(self, credit):
     credit += Environnement.sellStock(self.product, self.product_amount)
     return credit
示例#6
0
from environnement import Environnement
from random import randint, choice
import yaml

Environnement = Environnement()


class BuildingProcess():
    def buyProduce(self, credit):
        for x in range(len(self.consumtion)):
            if (Environnement.stock[self.consumtion[x]] > 0):
                credit -= Environnement.buyStock(self.consumtion[x],
                                                 self.consumtion_amount[x])
            else:
                credit -= 2000
        return credit

    def sellProduce(self, credit):
        credit += Environnement.sellStock(self.product, self.product_amount)
        return credit

    def turnOver(self):
        Environnement.turnOver()

    def showEnv(self):
        Environnement.showEnvironnementStock()
        Environnement.showEnvironnementPrice()


class Building(BuildingProcess):
    def __init__(self):
示例#7
0
from core import Local_Worker as Worker
from environnement import Environnement
from .overview_window import OverviewWindow
from .model_window import ModelWindow
from .wallet_window import WalletWindow
from tools import *

import os

from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *

env = Environnement(1)

h = 950
w = 550
hp = 1855

if env._platform == 'win32':
    wp = 1080 - 55
elif env._platform == 'Linux':
    wp = 1080 - 30


class MainWindow(QWidget):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.Set_UI()

    def Set_UI(self):
示例#8
0
    agent_1_mark = 'O'
    agent_2_mark = 'X'

    agent_1 = AgentAuto(agent_1_mark, agent_2_mark)
    agent_2 = AgentAuto(agent_2_mark, agent_1_mark)

    agent_1.create_game_tree()
    agent_2.create_game_tree()

    agent_1_win = 0
    agent_2_win = 0
    draw = 0

    for i in range(1000000):
        environnement = Environnement()

        agent_1.new_game()
        agent_2.new_game()

        if i % 2 == 0:
            win = play_game(agent_2, agent_1, environnement)
        else:
            win = play_game(agent_1, agent_2, environnement)

        if agent_1_mark == win:
            agent_1_win += 1
        elif agent_2_mark == win:
            agent_2_win += 1
        else:
            draw += 1
示例#9
0
文件: run.py 项目: openself/TradzQAI
        help=
        "Training or eval mode, default is training. Uselfull only without GUI displayed",
        default=0,
        choices=[0, 1])
    args = parser.parse_args()

    if args.GUI == 1:
        import qdarkstyle
        from PyQt5 import QtGui
        from PyQt5.QtWidgets import QApplication
        from GUI import MainWindow

        app = QApplication(sys.argv)
        app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        launch = MainWindow()
        launch.show()
        sys.exit(app.exec_())

    else:
        from environnement import Environnement
        from core import Local_Worker

        env = Environnement(0)
        if args.mode == 1:
            env.mode = "eval"
        else:
            env.mode = "train"
        worker = Local_Worker(env)
        worker.run(env)
        sys.exit(0)