From 848d5e3cf9622b8cbf22fffbe0357187cd5bdea0 Mon Sep 17 00:00:00 2001 From: BigGamerGary Date: Fri, 14 Apr 2023 20:45:36 +1000 Subject: [PATCH] Ledger Style changes --- .vscode/launch.json | 16 ++++++++++++++++ BlackJack.py | 6 +++--- Ledger.py | 20 ++++---------------- __pycache__/BlackJack.cpython-310.pyc | Bin 5540 -> 5464 bytes __pycache__/Ledger.cpython-310.pyc | Bin 2129 -> 1912 bytes 5 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..306f58e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/BlackJack.py b/BlackJack.py index 49c39dc..474069d 100644 --- a/BlackJack.py +++ b/BlackJack.py @@ -136,10 +136,10 @@ class BlackJack: async def play_game(self, ID, bet, recv, send): gameOver = False - playerStats = self.ledger.readLedger(ID) + playerStats = self.ledger.read(ID) if playerStats is None: - self.ledger.writeLedger(ID) - playerStats = self.ledger.readLedger + self.ledger.write(ID) + playerStats = self.ledger.read self.deal() while not gameOver: diff --git a/Ledger.py b/Ledger.py index fc0fe72..ba34943 100644 --- a/Ledger.py +++ b/Ledger.py @@ -12,18 +12,18 @@ class Ledger(): LOSSES integer DEFAULT 0 ); """) - def readLedger(self, ID): + def read(self, ID): self.data.execute("""SELECT USERID, MONEY, WINS, LOSSES FROM ledger WHERE USERID = ?""", (ID,)) data = self.data.fetchone() return data - def writeLedger(self, ID): + def write(self, ID): query = """ INSERT INTO ledger(USERID) VALUES(?) """ self.data.execute(query, (ID,)) self.db.commit() - def updateLedger(self, data, newData): + def update(self, data, newData): query = """ UPDATE ledger SET MONEY = ?, WINS = ?, @@ -33,19 +33,7 @@ class Ledger(): self.data.execute(query, data) def main(): - ledger = Ledger() - ledger.writeLedger(10121) - ID = 10121 - data = ledger.readLedger(ID) - - ID = 2 - playerStats = ledger.readLedger(ID) - if playerStats is None: - print("Not real") - ledger.writeLedger(ID) - playerStats = ledger.readLedger(ID) - - print(playerStats) + pass if __name__ == "__main__": main() \ No newline at end of file diff --git a/__pycache__/BlackJack.cpython-310.pyc b/__pycache__/BlackJack.cpython-310.pyc index e627d6f26f9da13294fe04763aeac0a6c6d1c087..9b2f7de9e3c0ee5ad7303149a6dad8596daeb9fc 100644 GIT binary patch delta 517 zcmZ{hJ4gdT5QcY-%jMp0H5diOMh#k6DWtIwwG$HTEQF1sffF|Yn~f3DT1Xa4A%WOy zA%czAi>;Ez-qKE+IF|=O!CQ`9{{8-c=H^Oyt0a4*&z zQ9a{Hsud;1IBA$o0)*-nEizFxP(4M}8mM@qa*geyCUbI_XhKEDbCT;#VCTnauCi-x zP!oNvLE6CI_bBKwdQ7Pvp?jiN^w)J9X<+1?5N-x6@#to%Himw3nL0JtB$RB#jk;V4 z3H7MLVNb4@QI_k}FG?4{6eNQo$t8nOg?e4iie|9^%tLM*x$s{uM6Q>&xQ*b*5d2#j z+qdH>l^vXmTLU^;BpAPruCbvDDX%+AlEY8Pk-3z3^0wrB8%kovzY2V|jK8TZv%)TI zCr;Qwxgg&CB{3P?KtsF)tF{6vE;(LbrY5Gtbn0~~BZ1V3U$eifV0KiI4=-Uye1s1_ De!YW) delta 613 zcmZ|M&r2IY6bJBm<7PA2AIWC3t!+J+qZ)e9QxAdCgP_oZ&>lp3DSa`-z(ywvLYQD7 z;8BF3C$*aD$(yJb>9zDO2*tmkhu(T9c(HFc3BiCn49m`Z-gkcNubGpQ+i+cr(ewTE z_oqK+?p+oxw8)j=r=HL0tzDJIOr6V?Vn;-#U}(29VL-|uwL>b` zSMI1HDO5&Q$rv=3>Oz~6j?&8Ng52MjP(ofR8?%&iF<7lU2<#V`RAl#1^II5~C!2aO z8%Np{`9n9o66ExuSK9LGd>7=HGBDqPMTTsFj)K180mA~C3RaD_6PA^QK_bUVJ{d~I zZH6Wm66c0fw1Zw^iQLmiT|h3$Tb8d0jt}AJ(sTeXxwkysjNbu#R%f)~WvY5UtRhv2 z6|#3ppMIea^GklqSg1wC_qWh&na!xtz@q+}KbQ>UEBdV~maKflw-u~bTCZTPV{!+&AbOD2x=Y}ar@`k7H}}eXp9T)aB;^!3*mspY4oP} Yk^{ewyVHLQaPBQFf-mqve+{nw18Vu2#{d8T diff --git a/__pycache__/Ledger.cpython-310.pyc b/__pycache__/Ledger.cpython-310.pyc index d43bf6cbb422f971ee123108e5e5969a34bd2ca7..f80275d8c682d59bfc22caa43862264f78f4f5b9 100644 GIT binary patch delta 248 zcmca8@Pm&ppO=@50SNS7TcoUF*~k~otjJQ7nwY{56f0%}5(11|j4X^*+&-x(>8V9} zAi2rYn0G6)mKSA~q>8|lu`miS@iA8MK$U?dH#e{pGV&=xg-Q!j5=&Aiv$6%LvO(BV z2+cCALX1_ss46?y8eD)X7#M-r8Kjg2NTe_XGiWmU6>$UE=mZZ?>=sLIVrHH)NI4Ub YU|}qhpZuF$icx;D7>5}vGte*p0Wdo?!vFvP delta 465 zcmeytcTs>ZpO=@50SNNWZcqNfx{)uMS(mFQH8I5}H6=Z@h#x3Z%myR`7`Yf(7^?&! z!g>f5le?IA>vNYEWtOBu