<commit_before>from players import *
from card_sort import *
from trick_handle import *
from score_game import *
from auction import *
from verbose import *


# The object that will commence the game
class RoundStart:
    def __init__(self):
        # Create the Deck of Cards
        self.gamedeck = BDeck()

        # Shuffles Deck
        self.gamedeck.shuffle()

        # Current Dealer 's'-South 'w'-West 'n'-North 'e'-East
        self.dealer = 's'

        # Current Vulnerability '-'-None 'B'-Both 'N'-NorthSouth 'E'-EastWest
        self.vul = 'B'

        # The history of the game
        self.history = ''

        # The declarer
        self.declarer = ''

        # The Auction Session
        self.asession = ''

        # Boolean variable to check if auction is complete
        self.auctioncomplete = 0

        # The Trick Session
        self.tsession = ''

        # Boolean variable to check if tricks are complete
        self.trickscomplete = 0

        # Create Players
        self.playerlst = []
        for i in range(4):
            self.playerlst.append(Player())
            self.playerlst[i].designation = i

            # Sorts Hand for the players
            self.playerlst[i].collecthand(CardSort.csort(self.gamedeck.givehand()))

        if verbose:
            print("South Cards")
            print(self.playerlst[0].checkhand() + "\n")




    # The method that enters the bids to the
    def enter_bid(self, bid):

        if debug:
            print("Place Bid: ", end='')
            bid = input()

        self.asession = AuctionSession.bidding(bid, self.playerlst, self.history, self.dealer, self.vul)

        return self.asession

    def enter_card(self, card):

        if debug:
            print("Enter Card: ", end='')
            card =  input()

        self.tsession = Trick.tricksession(card, self.playerlst, self.history, self.dealer, self.vul, self.declarer)


# Testing
# Assumptions: Human player is always South and dealer, human player is never dummy. For now human always goes first.
# Both teams are vulnerable. Doubles and redoubles do not affect the game.
bgame = RoundStart()

# Temporary EXAMPLE Auction Session and Trick Handling, The prints should be ignored becuase they are used for debug purposes.
# The method enter_bid,accepts one integer parameter and returns a list.
# The list at index [1] contains the history of the auction
# The list at index [2] contains the next set of moves for the AI.
while bgame.auctioncomplete == 0:
    aresult = bgame.enter_bid(0)
    bgame.history = aresult[1]

    print("AI MOVES: " + str(aresult[2]))
    if aresult[0] == 1:
        bgame.auctioncomplete = 1



<commit_msg>Update _begin_game.py<commit_after>from players import *
from card_sort import *
from trick_handle import *
from score_game import *
from auction import *
from verbose import *


# The object that will commence the game
class RoundStart:
    def __init__(self):
        # Create the Deck of Cards
        self.gamedeck = BDeck()

        # Shuffles Deck
        self.gamedeck.shuffle()

        # Current Dealer 's'-South 'w'-West 'n'-North 'e'-East
        self.dealer = 's'

        # Current Vulnerability '-'-None 'B'-Both 'N'-NorthSouth 'E'-EastWest
        self.vul = 'B'

        # The history of the game
        self.history = ''

        # The declarer
        self.declarer = ''

        # The Auction Session
        self.asession = ''

        # Boolean variable to check if auction is complete
        self.auctioncomplete = 0

        # The Trick Session
        self.tsession = ''

        # Boolean variable to check if tricks are complete
        self.trickscomplete = 0

        # Create Players
        self.playerlst = []
        for i in range(4):
            self.playerlst.append(Player())
            self.playerlst[i].designation = i

            # Sorts Hand for the players
            self.playerlst[i].collecthand(CardSort.csort(self.gamedeck.givehand()))

        if verbose:
            print("South Cards")
            print(self.playerlst[0].checkhand() + "\n")


    # The method that enters the bids to the
    def enter_bid(self, bid):
        self.asession = AuctionSession.bidding(bid, self.playerlst, self.history, self.dealer, self.vul)
        return self.asession

        """
        if debug:
            print("Place Bid: ", end='')
            bid = input()

        self.asession = AuctionSession.bidding(bid, self.playerlst, self.history, self.dealer, self.vul)

        return self.asession"""


    def enter_card(self, card):

        if debug:
            print("Enter Card: ", end='')
            card =  input()

        self.tsession = Trick.tricksession(card, self.playerlst, self.history, self.dealer, self.vul, self.declarer)

    def enter_bidding_loop(self, bid):
         aresult = self.enter_bid(bid)
         self.history = aresult[1]

         print("AI MOVES: " + str(aresult[2]))
         if aresult[0] == 1:
            self.auctioncomplete = 1

# Testing
# Assumptions: Human player is always South and dealer, human player is never dummy. For now human always goes first.
# Both teams are vulnerable. Doubles and redoubles do not affect the game.
bgame = RoundStart()
# Temporary EXAMPLE Auction Session and Trick Handling, The prints should be ignored becuase they are used for debug purposes.
# The method enter_bid,accepts one integer parameter and returns a list.
# The list at index [1] contains the history of the auction
# The list at index [2] contains the next set of moves for the AI.
"""while bgame.auctioncomplete == 0:
    aresult = bgame.enter_bid(0)
    bgame.history = aresult[1]

    print("AI MOVES: " + str(aresult[2]))
    if aresult[0] == 1:
        bgame.auctioncomplete = 1"""




{'fraction_non_alphanumeric': 0.09760333449114275, 'fraction_numerical': 0.00538381382424453, 'mean_word_length': 2.3502036067481096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3176598', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1658, 'n_words': 544}