Posts

Showing posts from January, 2022

Python - BlackJack

import random class Player(object):     def _init_(self, name, point=0, balance=1000):         self.balance = balance         self.name = name         self.point = point     def sub(self, amount):         self.balance -= amount     def add(self, amount):         self.balance += amount     def show(self):         print("You have Rs" + self.balance + " left") class Dealer(object):     def _init_(self, point=0):         self.point = point def getrandom(group):     x = random.choice(group)     group.remove(x)     return x def getcard(pl , dl):     # if i==1:         x = getrandom(cards) + getrandom(cards)         print(pl.name + " got" , x)         y = getrandom(cards)         print("De...

Python - TicTacToe

def print_board(board):     print("        |               |")     print("   "+board[0]+"    |       "+board[1]+"       |    "+board[2])     print("        |               |")     print("----------------------------------")     print("        |               |")     print("   "+board[3]+"    |       "+board[4]+"       |    "+board[5])     print("        |               |")     print("----------------------------------")     print("        |               |")   ...