from repository.Repository import Repository from service.WeaponController import WeaponController from UI.ui import UI from domain.Weapon import Weapon repo = Repository() repo.add(Weapon(1, 'shield', 'bronze', 2500000)) repo.add(Weapon(2, 'sword', 'bronze', 750000000)) repo.add(Weapon(3, 'sword', 'silver', 700000000)) repo.add(Weapon(4, 'sword', 'gold', 50000000000)) repo.add(Weapon(5, 'shield', 'bronze', 6000)) controller = WeaponController(repo) ui = UI(repo, controller) ui.start()
def __init__(self, parent=None): super(CreativeChecker, self).__init__(parent) self.ui = UI() self.ui.setupUi(self) self.set_up_backend()
from Repository.repository import Repository from Controller.controller import Controller from UI.ui import UI while True: commands = ["1k.txt", "10k.txt", "100k.txt", "example.txt"] fileName = input("Insert filename: ") if fileName in commands: break repo = Repository(fileName) repo.readFromFile() controller = Controller(repo) new_ui = UI(controller) new_ui.menu() new_ui.startapp()
k = False studentList = Repository() assignmentList = Repository() gradeList = Repository() listInit(studentList, assignmentList, gradeList) settings = 0 elif setting == "text file": k = False studentList = Repository() assignmentList = Repository() gradeList = Repository() readFile("Students.txt ", studentList, Student) readFile("Assignment.txt", assignmentList, Assignment) readFile("Grade.txt", gradeList, Grade) settings = 1 elif setting == "binary": k = False studentList = PickleRepository("Studentspickle.txt") assignmentList = PickleRepository("Assignmentpickle.txt") gradeList = PickleRepository("Gradepickle.txt") settings = 2 else: print("Invalid input!") u = undoCrontroller() s = studentController(studentList, assignmentList, gradeList, u) a = assignmentController(studentList, assignmentList, gradeList, u) g = gradeController(studentList, assignmentList, gradeList, u) ui = UI(s, a, g, u, settings) ui.start()
from UI.ui import UI with open('player_stats.txt', 'w') as f: f.write('0') f.close() with open('comp_stats.txt', 'w') as f: f.write('0') f.close() ui = UI() ui.start_game()
from Entities.board import Board from Service.service import Service from UI.ui import UI # Getting the values for 'DIM' and 'apple_count' from the text file # The text file only contains two numbers, the values for 'DIM' and 'apple_count' settings_file = open("settings.txt", 'r+') values = settings_file.read().split() DIM = int(values[0]) apple_count = int(values[1]) board = Board(DIM, apple_count) service = Service(board) ui = UI(board, service) ui.start()