This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Simple start to a game in PyQt5 | |
# move with arrow keys, spacebar to fire bullets | |
# Used graphics from https://opengameart.org/content/space-shooter-redux | |
# (reduced by 50%) | |
# Got some hints from https://www.youtube.com/watch?v=8ntEQpg7gck series | |
# and http://zetcode.com/gui/pyqt5/tetris/ | |
# | |
import sys | |
from PyQt5.QtCore import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QApplication, | |
QMainWindow, QFrame, QDockWidget, QDialog, QFileDialog, QMessageBox{ | |
background: white; | |
border: none; | |
color: #212121; | |
} | |
QToolBar { | |
background: #0097A7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###[Q] Форматирование | |
Чтобы отформатировать код, выделите его мышью и нажмите на кнопку `{}` редактора. | |
###[Q] Работа за автора | |
Согласно правилам форума, вопросы не должны сводиться к решению либо завершению учебных заданий за учащихся. Пожалуйста, уточните, что вы сделали сами и что не получилось. | |
###[Q] Примите ответ | |
Если вам дан исчерпывающий ответ, отметьте его как верный (нажмите на галку рядом с выбранным ответом). | |
###[Q] Всеобъемлющий вопрос |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Automaton: | |
def __init__(self, nstates): | |
self.transitions = [{} for i in range(nstates)] | |
self.accept_states = [False] * nstates | |
def register(self, source_state, char, target_state): | |
self.transitions[source_state][char] = target_state | |
def register_accept(self, state): | |
self.accept_states[state] = True |