<commit_before>#!/usr/bin/python3
"""Rand: The pesudo-random master."""

import random

# Import base class for AI agent
from base import AIBase


class Rand(AIBase):
    def __init__(self):
        super().__init__()   # pref. way of calling parent init

        print("RandAI loaded")

    def act(self):
        """Overriding base class act."""
        
        name = self.identity['name']
        if self.pNum==self.gs['active_player']:
            if self.gs['mode'] == 1: # Play
                print(name, self.pNum, "is playing...")
                legal_cards = []
                for c in self.hand:
                    if self.is_legal_play(c):
                        legal_cards.append(c)
                chosen_card = random.randint(0,len(legal_cards)-1)
                self.play(legal_cards[chosen_card])
                print(name, self.pNum, "plays",
                      self.print_card(legal_cards[chosen_card]))

            elif self.gs['mode'] == 2: # Bid
                print(name, self.pNum, "is bidding...")
                r = random.random()
                if self.is_legal_bid(self.gs['high_bid']+1) and (r < 0.6):
                    self.bid(self.gs['high_bid']+1)
                    print(name, self.pNum, "bids", bid)
                else:
                    self.bid(0)<commit_msg>Tweaked RandAI to match what I said it was going to do.<commit_after>#!/usr/bin/python3
"""Rand: The pesudo-random master."""

import random

# Import base class for AI agent
from base import AIBase


class Rand(AIBase):
    def __init__(self):
        super().__init__()   # pref. way of calling parent init

        print("RandAI loaded")

    def act(self):
        """Overriding base class act."""
        
        name = self.identity['name']
        if self.pNum==self.gs['active_player']:
            if self.gs['mode'] == 1: # Play
                print(name, self.pNum, "is playing...")
                legal_cards = []
                for c in self.hand:
                    if self.is_legal_play(c):
                        legal_cards.append(c)
                chosen_card = random.randint(0,len(legal_cards)-1)
                self.play(legal_cards[chosen_card])
                print(name, self.pNum, "plays",
                      self.print_card(legal_cards[chosen_card]))

            elif self.gs['mode'] == 2: # Bid
                print(name, self.pNum, "is bidding...")
                r = random.random()
                if self.is_legal_bid(self.gs['high_bid']+1) and (r < 0.5):
                    self.bid(self.gs['high_bid']+1)
                    print(name, self.pNum, "bids", bid)
                else:
                    self.bid(0)
{'fraction_non_alphanumeric': 0.13077496274217584, 'fraction_numerical': 0.007451564828614009, 'mean_word_length': 1.6042677012609117, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1952369', 'n_tokens_mistral': 839, 'n_tokens_neox': 789, 'n_words': 180}