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 e627d6f..9b2f7de 100644 Binary files a/__pycache__/BlackJack.cpython-310.pyc and b/__pycache__/BlackJack.cpython-310.pyc differ diff --git a/__pycache__/Ledger.cpython-310.pyc b/__pycache__/Ledger.cpython-310.pyc index d43bf6c..f80275d 100644 Binary files a/__pycache__/Ledger.cpython-310.pyc and b/__pycache__/Ledger.cpython-310.pyc differ