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
| from canvas import Canvas | |
| from picture_frame import Pictureframe | |
| def is_number(check_input): | |
| ''' | |
| function checking if your string is a floating point or int | |
| return : bool | |
| ''' | |
| if '.' in check_input: | |
| split_number = check_input.split('.') |
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 Canvas: | |
| ''' | |
| canvas class will hold the data of the area you wish | |
| to hang the pivtures and also contain a list of the | |
| frames you wish to use. | |
| ''' | |
| def __init__(self,width,height): | |
| self._width = width | |
| self._height = height | |
| self._arrangement = ['horizontal' , 'vertical' , 'grid'] |
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 Pictureframe: | |
| def __init__(self,width, height, margin, hang_point): | |
| self._width = width | |
| self._height = height | |
| self._margin = margin | |
| self._hang_point = hang_point | |
| self._hang = [] | |
| def find_area(self): | |
| ''' |
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
| from picture_frame import Pictureframe | |
| class Canvas: | |
| def __init__(self,width,height): | |
| self._width = width | |
| self._height = height | |
| self._arrangement = ['horizontal' , 'vertical' , 'grid'] | |
| self._alignment = ['left' , 'center' , 'right'] | |
| self._position = ['top' , 'center' , 'bottom'] | |
| self._picture_frame_list = [] |
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 Pictureframe: | |
| def __init__(self,width, height, margin, hang_point): | |
| self._width = width | |
| self._height = height | |
| self._margin = margin | |
| self._hang_point = hang_point | |
| self._hang = [] | |
| def find_area(self): | |
| ''' |
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
| def keep_dice(self): | |
| ''' | |
| method function returning a dice list to reroll. | |
| It also stores the dice you want to keep in a separate keep list. | |
| - returns list | |
| ''' | |
| keep_input = input('which dice do you want to keep (comma separated: e.g. 1,1,5)? ') | |
| split_input = keep_input.split(',') | |
| if keep_input == '': |
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
| import random | |
| class Roll: | |
| def __init__(self): | |
| ''' | |
| class holding all the dice functionality for rolling the dice, but | |
| also checking dice values for the gameplay | |
| ''' | |
| self._current_dice_list = [] | |
| self._current_kept_dice = [] |
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
| #import random | |
| from player import Player | |
| from roll import Roll | |
| def main(): | |
| ''' | |
| method holding the game play for our Yatzy game. | |
| ''' | |
| #defining what we work with on the top part of the game. |
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 Player: | |
| def __init__(self, name): | |
| ''' | |
| method holding all player data like name and all the scores. | |
| ''' | |
| self._name = name | |
| self._scoreboard = {} | |
| self._top_score = 0 | |
| self._bottom_score = 0 |
NewerOlder