def main(): repo_st = student_repo_file("student.txt") repo_pr = problemaFileRepo("probleme.txt") repo_not = NotareFileRepository("notare.txt") valid_st = valid_student() valid_pr = valid_problema() valid_not = valid_notare() serv_student = student_service(repo_st, valid_st) serv_problema = problema_service(repo_pr, valid_pr) serv_notare = notare_service(repo_not, valid_not, repo_st, repo_pr) ui_main = ui(serv_student, serv_problema, serv_notare) ui_main.run()
def main(): repo_st=student_repo_file("student.txt") repo_pr=repo_problema() repo_not=repo_notare() valid_st=valid_student() valid_pr=valid_problema() valid_not=valid_notare() serv_student=student_service(repo_st,valid_st) serv_problema=problema_service(repo_pr,valid_pr) serv_notare=notare_service(repo_not,valid_not,repo_st,repo_pr) ui_main=ui(serv_student,serv_problema,serv_notare) ui_main.run()
def appstart(): ''' The brains of the application Creating a repository and controller and launching the application ''' tests().testEverything() new_repository = repository() new_controller = controller(new_repository) new_quiz_repository = quizrepository() new_quiz_controller = quizcontroller(new_quiz_repository) user_interface = ui(new_controller, new_quiz_controller) user_interface.launch()
def testAdd(self): new_repository = repository() new_controller = controller(new_repository) new_quiz_repository = quizrepository() new_quiz_controller = quizcontroller(new_quiz_repository) user_interface = ui(new_controller, new_quiz_controller) assert user_interface.add( [], 'command') == "Please insert valid 'command' attributes!" assert user_interface.add(['1', 'a;2;1;2;1;2;1'], 'command') == "Invalid 'a' id!" assert user_interface.add(['1', '1;2;1;2;3;4;1'], 'command') == "Invalid correct answer!" assert user_interface.add(['1', '1;2;1;2;3;3;1'], 'command') == "Invalid difficulty!"
def testCreate(self): new_repository = repository() new_controller = controller(new_repository) new_quiz_repository = quizrepository() new_quiz_controller = quizcontroller(new_quiz_repository) user_interface = ui(new_controller, new_quiz_controller) assert user_interface.create( [], 'command') == "Please insert valid 'command' attributes!" assert user_interface.create(['1', '2', '3', '4'], 'command') == "Invalid difficulty!" assert user_interface.create( ['1', 'easy', 'asdf', '4'], 'command') == "Invalid 'asdf' number of questions!" assert user_interface.create( ['1', 'easy', '3', '4'], 'command') == "Invalid file name or structure!"
def render_all(game_map, player, camera, game_state, log_frame, action=None, debug=False): entities = game_map.entities items = game_map.items corpses = game_map.corpses terrain = game_map.terrain water = game_map.water camera.move_camera(player.x, player.y, game_map) for x in range(camera.width): for y in range(camera.height): map_x, map_y = camera.to_map_coordinates(x, y) if (map_x, map_y) in player.fov.fov_cells: if (map_x, map_y) in water: render_obj((map_x, map_y), water, camera, 'blue') water.get((map_x, map_y)).explored = True if (map_x, map_y) in terrain: obj = terrain.get((map_x, map_y)) render_obj((map_x, map_y), terrain, camera, obj.color) terrain.get((map_x, map_y)).explored = True if (map_x, map_y) in corpses: obj = corpses.get((map_x, map_y)) render_obj((map_x, map_y), corpses, camera, obj.color) if (map_x, map_y) in items: obj = items.get((map_x, map_y)) render_obj((map_x, map_y), items, camera, obj.color) if (map_x, map_y) in entities: obj = entities.get((map_x, map_y)) render_obj((map_x, map_y), entities, camera, obj.color) elif ((map_x, map_y) in terrain and terrain.get( (map_x, map_y)).explored): render_obj((map_x, map_y), terrain, camera, 'darker orange') elif ((map_x, map_y) in water and water.get( (map_x, map_y)).explored): render_obj((map_x, map_y), water, camera, 'darker blue') ui(game_map, player, camera, game_state, log_frame, action) # debug if debug: show_debug_info(game_map, player, camera, log_frame, db_ui=True, player_coords=True, mouse_coords=True) blt.refresh()
from Game.game import gameBoard from UI.ui import ui g = gameBoard() u = ui(g) u.menu()
from Game.game import board from UI.ui import ui b = board() gameOn = ui(b) gameOn.start()
# coding=UTF-8 from UI.ui import ui if __name__ == "__main__": print("Start Working") g = ui(5) g.run()