From 3d7309ad2fc6e125d7a4c28e26f7947044d7cd2b Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:54:49 +0000 Subject: [PATCH 1/2] penify/config_6baba master --- .../workflows/snorkell-auto-documentation.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/snorkell-auto-documentation.yml diff --git a/.github/workflows/snorkell-auto-documentation.yml b/.github/workflows/snorkell-auto-documentation.yml new file mode 100644 index 0000000..34c752f --- /dev/null +++ b/.github/workflows/snorkell-auto-documentation.yml @@ -0,0 +1,19 @@ +# This workflow will improvise current file with AI genereated documentation and Create new PR + +name: Penify - Revolutionizing Documentation on GitHub + +on: + push: + branches: ["master"] + workflow_dispatch: + +jobs: + Documentation: + runs-on: ubuntu-latest + steps: + - name: Penify DocGen Client + uses: SingularityX-ai/snorkell-documentation-client@v1.0.0 + with: + client_id: ${{ secrets.SNORKELL_CLIENT_ID }} + api_key: ${{ secrets.SNORKELL_API_KEY }} + branch_name: "master" \ No newline at end of file From 3c31be9120946a4bc7d9635063405f0abdc1dfee Mon Sep 17 00:00:00 2001 From: dbigman Date: Fri, 6 Dec 2024 12:10:11 -0400 Subject: [PATCH 2/2] answers --- __pycache__/vikingsClasses.cpython-311.pyc | Bin 0 -> 5194 bytes vikingsClasses.py | 67 +++++++++++++++------ wargame.py | 2 +- 3 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 __pycache__/vikingsClasses.cpython-311.pyc diff --git a/__pycache__/vikingsClasses.cpython-311.pyc b/__pycache__/vikingsClasses.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..041111558d1b1f2684114765e9bb7517925ffbf0 GIT binary patch literal 5194 zcmd5=-EZ606~ClDOj(paBFA>!*rii9s~msCU62h;vd*)&d?2&2cx^Gmn81j%C0i1` zOWKJAW$;6RX@ej7kir4B0(vO282J<0KSDADSRfD}z+SdD1zNmKGiu>u1| zQ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C?2?tH9D>!{Mg2}|w{NmDaGK_}?1+h=!D4GPXKr1PVNK6h ze+AzOLsr2)LM> z*MbfLlXN`nJ$bGn}LI z5-fx+#ja*cJQn;pQPT*V^`sGS@|H3D9lMI+s{08>T2=`Zh1IY-0M2x_13KWBtBeu$ z*i}5{IYkI&dm;~Hdy*ZdYF;yPb~u$bGAW%h8=yzA^N=O{>r9k)A|OVJTCwCo8MRauGadl zmgJZHLw}2vwQr1S|Fv5GwNk9!J$TT4dB6Me^IzA-eo^h7sddkk!mpxzwdhcJct83+ z1f|H8y4G zXs?gZUh@a?#eMl=`DRs~s>xFodFuP@l?OqZk?YTBn|BS^VMwN;23f8jyM8R4I;J%d z_>jj_6A}UV#(!w!6)O#Im0}8v#gv}6Ht5!H;U)`OPRC_qVlN>Mn$RoT*f*E2fpnW-;x?#jJEDwT3J6kBbS&{Q_A% z@56NKhe^AcHXbfmsz_|A-@%yjhcPjBa3~h6X$cd@Q6f8ooBKZW#G!k5xe@o#X z20Zn~Z(52369p5kzU|$Zd0)WH+aZu|{|NIEhrnm_2UvATxGmJ%ARg)QO02Cn9J(ts zh>xBlp~&_u+XNE;K1_d#!UU0Ej?VHW#%dAzt#pI`U+^>fOX!Dj+x!klBOnMuoy4}; z-Dr;p@P&VzyvDXSM~s1(0N)MAN$K;~*!t#(H4+gZ6FW{yw{XrYIH$uONC=Sz{JGOg NUSr#v6BtYn{{dem4iW$W literal 0 HcmV?d00001 diff --git a/vikingsClasses.py b/vikingsClasses.py index 25322cd..d45bb2c 100644 --- a/vikingsClasses.py +++ b/vikingsClasses.py @@ -5,56 +5,89 @@ class Soldier: def __init__(self, health, strength): - # your code here + self.health = health + self.strength = strength def attack(self): - # your code here + return self.strength def receiveDamage(self, damage): - # your code here + self.health = self.health - damage # Viking - class Viking(Soldier): def __init__(self, name, health, strength): - # your code here + super().__init__(health, strength) + self.name = name def battleCry(self): - # your code here + return ("Odin Owns You All!") def receiveDamage(self, damage): - # your code here + self.health -= damage + if self.health > 0: + return f"{self.name} has received {damage} points of damage" + else: + return f"{self.name} has died in act of combat" + # Saxon class Saxon(Soldier): def __init__(self, health, strength): - # your code here + super().__init__(health, strength) def receiveDamage(self, damage): - # your code here - + self.health -= damage + if self.health > 0: + return f"A Saxon has received {damage} points of damage" + else: + return "A Saxon has died in combat" + # Davicente class War(): def __init__(self): - # your code here + self.vikingArmy = [] + self.saxonArmy = [] def addViking(self, viking): - # your code here + self.vikingArmy.append(viking) def addSaxon(self, saxon): - # your code here + self.saxonArmy.append(saxon) def vikingAttack(self): - # your code here + random_saxon = random.choice(self.saxonArmy) + random_viking = random.choice(self.vikingArmy) + result = random_saxon.receiveDamage(random_viking.strength) + + if random_saxon.health <= 0: + self.saxonArmy.remove(random_saxon) + return result + def saxonAttack(self): - # your code here - + random_saxon = random.choice(self.saxonArmy) + random_viking = random.choice(self.vikingArmy) + result = random_viking.receiveDamage(random_saxon.strength) + + if random_viking.health <= 0: + self.vikingArmy.remove(random_viking) + return result + + + def showStatus(self): - # your code here + if len(self.saxonArmy) == 0: + return "Vikings have won the war of the century!" + elif len(self.vikingArmy) == 0: + return "Saxons have fought for their lives and survive another day..." + else: + return "Vikings and Saxons are still in the thick of battle." + + pass diff --git a/wargame.py b/wargame.py index 31a2adb..ac57f2c 100644 --- a/wargame.py +++ b/wargame.py @@ -1,7 +1,7 @@ # With a correction already implemented: dont forget to initialize an instance of Class "War" -from .vikingsClasses import Soldier, Viking, Saxon, War +from vikingsClasses import Soldier, Viking, Saxon, War import random