This file contains 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 Girl(GameElement): | |
IMAGE = "Girl" | |
SOLID = True | |
def __init__(self): | |
GameElement.__init__(self) | |
self.last_move = 0 | |
self.velocity_y = 1 | |
def update(self, dt): |
This file contains 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 Rock(GameElement): | |
IMAGE = "Rock" | |
SOLID = True | |
def interact(self, player): | |
del_x = player.x - self.x | |
del_y = player.y - self.y | |
next_x = self.x - del_x | |
next_y = self.y - del_y |
This file contains 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
target_el = GAME_BOARD.get_el(self.x, self.y) | |
if target_el == PLAYER: | |
global GAME_OVER | |
GAME_OVER = True | |
GAME_BOARD.draw_msg("You've been eaten! Ha Ha Ha!") | |
self.board.set_el(self.x, self.y, self) | |
_____ | |
def keyboard_handler(): |
This file contains 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
#assignment is done via <-, equality is id with only one = | |
prompt <- '>' | |
#printing is done via show | |
show 'What's your name?' | |
#the input from user is taken via user_input = raw_input in python |
This file contains 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
list HANGMAN | |
HANGMAN:0 <- ''' | |
+---+ | |
| | | |
| | |
| | |
| | |
| | |
=========''' |
This file contains 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
file_input: stmt_list ENDMARKER | |
stmt_list: (NEWLINE | stmt)* | |
stmt: simple_stmt | compound_stmt | |
simple_stmt: print_stmt | assignment | |
print_stmt: 'show' (atom)+ |
This file contains 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
show "What's your name?" | |
name <- string_prompt | |
show "Hello ", name | |
show "Let's play a game! Pick any number between 1 and 20." | |
show "You have 5 tries!" |
This file contains 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
import pprint | |
def nested_tree(edges): | |
nested = {} | |
for i in edges: | |
key = i[0] | |
value = {} | |
temp = i[1] |