Skip to content

Instantly share code, notes, and snippets.

View martinaaberge's full-sized avatar

Martin Andersson Aaberge martinaaberge

View GitHub Profile
import requests
#import urllib.request
from bs4 import BeautifulSoup
url_list = "https://medium.com/@timdenning"
print (f'fetching data for: {url_list}')
response = requests.get(url_list).text
soup = BeautifulSoup(response , 'html.parser')
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('.')
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']
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):
'''
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 = []
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):
'''
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 == '':
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 = []
#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.
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