From fe9ebf8d8bfc6c25bd4e11744fa9c2054b5b2200 Mon Sep 17 00:00:00 2001 From: llnu Date: Wed, 10 Jun 2020 16:57:46 +0200 Subject: [PATCH 1/4] ex40, unfinished --- balazs/python-the-hard-way/ex40/classtest.py | 13 ++++++++++ balazs/python-the-hard-way/ex40/ex40.py | 26 +++++++++++++++++++ balazs/python-the-hard-way/ex40/ex40a.py | 3 +++ balazs/python-the-hard-way/ex40/mystuff.py | 8 ++++++ balazs/python-the-hard-way/ex40/mystuff.pyc | Bin 0 -> 474 bytes 5 files changed, 50 insertions(+) create mode 100644 balazs/python-the-hard-way/ex40/classtest.py create mode 100644 balazs/python-the-hard-way/ex40/ex40.py create mode 100644 balazs/python-the-hard-way/ex40/ex40a.py create mode 100644 balazs/python-the-hard-way/ex40/mystuff.py create mode 100644 balazs/python-the-hard-way/ex40/mystuff.pyc diff --git a/balazs/python-the-hard-way/ex40/classtest.py b/balazs/python-the-hard-way/ex40/classtest.py new file mode 100644 index 0000000..6efea36 --- /dev/null +++ b/balazs/python-the-hard-way/ex40/classtest.py @@ -0,0 +1,13 @@ +class MyStuff(object): + + def __init__(self): + self.tangerine = "ya" + + def apple(self): + print("printing apples") + +thing = MyStuff() +thing.apple() +print(thing.tangerine) + +MyStuff().apple() diff --git a/balazs/python-the-hard-way/ex40/ex40.py b/balazs/python-the-hard-way/ex40/ex40.py new file mode 100644 index 0000000..14de9b5 --- /dev/null +++ b/balazs/python-the-hard-way/ex40/ex40.py @@ -0,0 +1,26 @@ +class Poem(object): + + def __init__(self, lyrics): +# self.lyrics = lyrics + pass + + def tell(self, ): + poem = lyrics + for line in poem: #self.lyrics: + print(line) + + +# drill 2, poem to var: +bday = ["Happy birthday", + " La LA",] + + +happy_bday = Poem(bday) + +another_poem = Poem(["Roses are red, violets a blue", + "I should finish before the time runs out", + "Cows say moo"]) + +happy_bday.tell() + +another_poem.tell() diff --git a/balazs/python-the-hard-way/ex40/ex40a.py b/balazs/python-the-hard-way/ex40/ex40a.py new file mode 100644 index 0000000..3398542 --- /dev/null +++ b/balazs/python-the-hard-way/ex40/ex40a.py @@ -0,0 +1,3 @@ +import mystuff +mystuff.apple() + diff --git a/balazs/python-the-hard-way/ex40/mystuff.py b/balazs/python-the-hard-way/ex40/mystuff.py new file mode 100644 index 0000000..5bbf158 --- /dev/null +++ b/balazs/python-the-hard-way/ex40/mystuff.py @@ -0,0 +1,8 @@ +#mystuff = {'apple': "I AM APPLES!"} +#print(mystuff['apple']) + +def apple(): + print("I AM APPLES!") + +# just a variable +tangerine = "Living refleciton of a dream" diff --git a/balazs/python-the-hard-way/ex40/mystuff.pyc b/balazs/python-the-hard-way/ex40/mystuff.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f3c946787201a50a9e72e114d00df22d5b6d82f GIT binary patch literal 474 zcmc&vJx{|h5OvxjQ3Mk!gW0k;W?)2!3L!u$RYkTANQZq%EICeOJ3yHEiEJ$V2mSyT zRFK*~fF-|scY62n#$N|}?;oEJimhKl@q&IhB+!h#F}5O-uvNnJh~?>+>Kp3IK|LMR z3A?_bmOLF%wg~%#w|sWTXUpaMDnCvsXIl_zs!0tIq;Z7@sTz%0=Squ4Rhg>fFBcZU zJL5{Bj8_)LBUpG1avj<}R*e&}LQ#R&;u(60FQ+FmVu(T3eTZFAWF*_6jnK9hCq%+< zDoer<;oLmYc Date: Fri, 12 Jun 2020 17:00:35 +0200 Subject: [PATCH 2/4] ex42 unfinished --- balazs/python-the-hard-way/ex42/ex42.py | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 balazs/python-the-hard-way/ex42/ex42.py diff --git a/balazs/python-the-hard-way/ex42/ex42.py b/balazs/python-the-hard-way/ex42/ex42.py new file mode 100644 index 0000000..d95965e --- /dev/null +++ b/balazs/python-the-hard-way/ex42/ex42.py @@ -0,0 +1,51 @@ +## Animal is-a object (yes, sort of confusing) look at the extra credit +class Animal(object): + +Pass + +## is-a +class Dog(Animal): + + def __init__(self, name): + ## has-a + self.name = name + + +## is-a +class Person(object): + + + def __init__(self, name): + ## has-a + self.name = name + + +## is-a +class Employee(Person): + + + def __init__(self, name, salary): + ## ?? hmm what is this strange magic? dunno, + super(Employee, self).__init__(name) + ## has-a + self.salary = salary + + + +## rover is-a Dog +rover = Dog("Rover") + +## is-a +satan = Cat("Satan") + +## is-a +mary = Person("Mary") + +## ?? +mary.pet = satan + +## is-a-n employee, has x money +frank = Employee("Frank", 120000) + +## is-a +flipper = Fish() From a6597b28c6928ff52baa2df6005c149ed1275eae Mon Sep 17 00:00:00 2001 From: llnu Date: Fri, 19 Jun 2020 16:44:30 +0200 Subject: [PATCH 3/4] added game sketch --- .../ex45_game_outline/game_outline.org | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 balazs/python-the-hard-way/ex45_game_outline/game_outline.org diff --git a/balazs/python-the-hard-way/ex45_game_outline/game_outline.org b/balazs/python-the-hard-way/ex45_game_outline/game_outline.org new file mode 100644 index 0000000..6844abf --- /dev/null +++ b/balazs/python-the-hard-way/ex45_game_outline/game_outline.org @@ -0,0 +1,64 @@ +* Cli minecraft - game outline + + +** Sketch + +*** Flow +User anwser a couple of question that will decide the modifiers, biome, hardness + +Everything gets initalized, lots of random values + added modifiers + +print "Survive" +User will be presented with options: +- Check the map : 32x32 +- Options based on which grid the person is +- Options based on what the user can craft (if wood=1: do print stick) + +(1): Rest 1 hour +(2): Collect wood +(3): Craft X + +Every hour the user can decide what to do. Extra options are presented based on the requirements fulfilled. + + +*** Mechanics + +25-25-25-25 Biome=desert(lots of sand), moderate(lots of food), monsoon(lots of rivers) +x-y grid 32x32, every grid has a special item, like riverback-water/rocks, forest-food/wood, mountain-rocks/ + +Shall the output be interactive like assign values to function .e.g.: check map which can be callled like 1,2,3 +OR +the user can call any function (e.g.: make stick) and the possible functions are printed (just as an indicator) + + +** I want to have + +TODO prioritize here, best bang for the time basis + + +- Every hour action? An action can be multiple hours? + +- An action can fail? (Fail percentages)? + +- an inventory with things, that you can pick out during things + +- day and night -> notion of time + +- a life building game / survival + +- start in a wood and you can decide to do things + +- health bar / food bar? + +- Map generation -> having a grid an position tracking? + +** Questions + +How can I make it open-world? Generative? + +Biomes, different starting points with randomized items that belong to biomes and you can find them? + +Crafting recipes like minecraft? + +Rand, rand rand! -> different scenarios + From ea6766a473fb161929bfc522535d502291ed9f02 Mon Sep 17 00:00:00 2001 From: llnu Date: Fri, 19 Jun 2020 17:11:47 +0200 Subject: [PATCH 4/4] added new game sketch --- .../ex45_game_outline/game_outline_new.org | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 balazs/python-the-hard-way/ex45_game_outline/game_outline_new.org diff --git a/balazs/python-the-hard-way/ex45_game_outline/game_outline_new.org b/balazs/python-the-hard-way/ex45_game_outline/game_outline_new.org new file mode 100644 index 0000000..1988808 --- /dev/null +++ b/balazs/python-the-hard-way/ex45_game_outline/game_outline_new.org @@ -0,0 +1,11 @@ +* Game outline + +Generate a 32x32 maze where and user have to navigate out of it. + +** Flow + +Map will be displayed +User have some actions (up down ...) and they have to navigate out. + + +Extra: Random actions can happen, where the user can dies if they miss the check