-
Notifications
You must be signed in to change notification settings - Fork 0
/
games.py
94 lines (75 loc) · 2.58 KB
/
games.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from player import player
# from alien_invasion import run_game
import pygame
import time
import random
from ship import Ship
from button import Button
from button import Game_Over
import game_functions as gf
from settings import Settings
from pygame.sprite import Group
from game_stats import GameStats
from scoreboard import Scoreboard
from scoreboard import Quit_State
import requests
import numpy as np
from sudoku import main
from sudoku import solve
from pacman import run_packman
from snake import run_snake
responce= requests.get("https://sugoku.herokuapp.com/board?difficulty=easy")
grid = responce.json()['board']
board=np.array(grid)
board_original=board.copy()
board_original2=board.copy()
solve(board_original2)
print("Welcome to the gaming World!!")
def run_game():
# Initialize pygame, settings, and screen object.
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode(
(ai_settings.screen_width, ai_settings.screen_height))
pygame.display.set_caption("Alien Invasion")
# Set FPS
FPS = 60
clock = pygame.time.Clock()
# Make a ship, a group of bullets, and a group of aliens.
ship = Ship(ai_settings, screen)
bullets = Group()
enemy_bullets = Group()
aliens = Group()
# Create an instance to store game statistics, a quit statement and create a scoreboard.
stats = GameStats(ai_settings)
sb = Scoreboard(ai_settings, screen, stats)
qs = Quit_State(ai_settings, screen)
# Create the fleet of aliens.
gf.create_fleet(ai_settings, screen, ship, aliens)
# Make the Play and Game Over button.
play_button = Button(ai_settings, screen, "PRESS ENTER")
game_over = Game_Over(ai_settings, screen, "GAME OVER")
# Load the high score.
gf.load_score(stats)
sb.prep_high_score()
sb.show_score()
# Start the main loop for the game.
while True:
clock.tick(FPS)
gf.check_events(ai_settings, screen, stats, play_button, ship, aliens, bullets, sb, enemy_bullets )
if stats.game_active:
ship.update()
gf.update_bullets(ai_settings, screen, stats, sb,
ship, aliens, bullets)
gf.update_enemy_bullets(ai_settings, screen, stats, sb, ship, aliens, enemy_bullets)
gf.update_aliens(ai_settings, stats, sb, screen, ship, aliens, bullets, enemy_bullets, game_over)
if not stats.game_active:
game_over.draw_button()
gf.update_screen(ai_settings, screen, stats, sb, ship, aliens, bullets, play_button, qs, enemy_bullets, game_over)
def sudoku():
print(board_original2)
return main(board)
def packman():
return run_packman()
def game4():
return run_snake()