Initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Project exclude paths
|
||||||
|
/venv/
|
||||||
21
Дом с привидениями.py
Normal file
21
Дом с привидениями.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Ghost Game
|
||||||
|
from random import randint
|
||||||
|
print('Дом с привидениями')
|
||||||
|
feeling_brave = True
|
||||||
|
score = 0
|
||||||
|
while feeling_brave:
|
||||||
|
ghost_door = randint(1, 3)
|
||||||
|
print('Впереди три двери...')
|
||||||
|
print('Привидение за одной из них.')
|
||||||
|
print('Какую ты откроешь?')
|
||||||
|
door = input('1, 2 или 3? ')
|
||||||
|
door_num = int(door)
|
||||||
|
if door_num == ghost_door:
|
||||||
|
print('ПРИВИДЕНИЕ!!!')
|
||||||
|
feeling_brave = False
|
||||||
|
else:
|
||||||
|
print('Привидения нет.')
|
||||||
|
print('Ты переходишь в следующую комнату')
|
||||||
|
score = score + 1
|
||||||
|
print('Убегай!')
|
||||||
|
print('Ты проиграл! Твой счёт', score)
|
||||||
24
Дом с привидениями2.py
Normal file
24
Дом с привидениями2.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Ghost Game
|
||||||
|
from random import randint
|
||||||
|
print('Дом с привидениями')
|
||||||
|
feeling_brave = True
|
||||||
|
score = 0
|
||||||
|
while feeling_brave:
|
||||||
|
ghost_door = randint(1, 3)
|
||||||
|
print('Впереди три двери...')
|
||||||
|
print('Привидение за одной из них.')
|
||||||
|
print('Какую ты откроешь?')
|
||||||
|
door = input('1, 2 или 3? ')
|
||||||
|
door_num = int(door)
|
||||||
|
if door_num > 3 or door_num < 1:
|
||||||
|
print('Не обманывай!!!')
|
||||||
|
else:
|
||||||
|
if door_num == ghost_door:
|
||||||
|
print('ПРИВИДЕНИЕ!!!')
|
||||||
|
feeling_brave = False
|
||||||
|
else:
|
||||||
|
print('Привидения нет.')
|
||||||
|
print('Ты переходишь в следующую комнату')
|
||||||
|
score = score + 1
|
||||||
|
print('Убегай!')
|
||||||
|
print('Ты проиграл! Твой счёт', score)
|
||||||
17
Кнопочки.py
Normal file
17
Кнопочки.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from tkinter import *
|
||||||
|
|
||||||
|
|
||||||
|
def bAaction():
|
||||||
|
print('Спасибо!')
|
||||||
|
|
||||||
|
|
||||||
|
def bBaction():
|
||||||
|
print('Урмяяяяяуу! Мне больно')
|
||||||
|
|
||||||
|
|
||||||
|
window = Tk()
|
||||||
|
buttonA = Button(window, text='Нажми!', command=bAaction)
|
||||||
|
buttonB = Button(window, text='Не нажимай!', command=bBaction)
|
||||||
|
buttonA.pack()
|
||||||
|
buttonB.pack()
|
||||||
|
window.mainloop()
|
||||||
92
Черепашка домик.py
Normal file
92
Черепашка домик.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
from turtle import *
|
||||||
|
def t_c(do, val):
|
||||||
|
do = do.upper()
|
||||||
|
if do == 'F':
|
||||||
|
forward(val)
|
||||||
|
elif do == 'B':
|
||||||
|
backward(val)
|
||||||
|
elif do == 'R':
|
||||||
|
right(val)
|
||||||
|
elif do == 'L':
|
||||||
|
left(val)
|
||||||
|
elif do == 'U':
|
||||||
|
penup()
|
||||||
|
elif do == 'D':
|
||||||
|
pendown()
|
||||||
|
elif do == 'N':
|
||||||
|
reset()
|
||||||
|
else:
|
||||||
|
print('Я не знаю такой команды')
|
||||||
|
|
||||||
|
def s_a(program):
|
||||||
|
cmd_list = program.split('-')
|
||||||
|
for command in cmd_list:
|
||||||
|
cmd_len = len(command)
|
||||||
|
if cmd_len == 0:
|
||||||
|
continue
|
||||||
|
cmd_type = command[0]
|
||||||
|
num = 0
|
||||||
|
if cmd_len > 1:
|
||||||
|
num_string = command[1:]
|
||||||
|
num = int(num_string)
|
||||||
|
print(command, ':', cmd_type, num)
|
||||||
|
t_c(cmd_type, num)
|
||||||
|
instructions = ''' Напиши программу для черепашки:
|
||||||
|
к примеру N-F100-R45-U-F100-L45-D-F100-R90-B50
|
||||||
|
- = разделитель
|
||||||
|
U/D = поднять/опустить перо
|
||||||
|
F100 = вперёд 100
|
||||||
|
B50 = назад 50
|
||||||
|
R90 = вправо 90
|
||||||
|
L45 = влево 45'''
|
||||||
|
screen = getscreen()
|
||||||
|
while True:
|
||||||
|
t_program = screen.textinput('Чертёжный автомат', instructions)
|
||||||
|
print(t_program)
|
||||||
|
if t_program == None or t_program.upper() == 'END':
|
||||||
|
break
|
||||||
|
s_a(t_program)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user