Esempio n. 1
0
from base import player
import random
import operator

player_05 = player.Player("NA", 0)


def action(board, arr_player):
    return moiturn(board)


# list những thẻ có thể lấy ngay
def listthecothemua(board):
    thecothelay = []
    if len(player_05.card_upside_down) > 0:
        for the in player_05.card_upside_down:
            if player_05.checkGetCard(the) == True:
                thecothelay.append(the)
    for the in board.dict_Card_Stocks_Show["III"]:
        if player_05.checkGetCard(the) == True:
            thecothelay.append(the)
    for the in board.dict_Card_Stocks_Show["II"]:
        if player_05.checkGetCard(the) == True:
            thecothelay.append(the)
    for the in board.dict_Card_Stocks_Show["I"]:
        if player_05.checkGetCard(the) == True:
            thecothelay.append(the)
    return thecothelay


# list những nguyên liệu có thể lấy 2
Esempio n. 2
0
from base import player
import random
import math
player_04 = player.Player("KingOfDestruction", 0)


def action(board, arr_player):
    return turn(board, player_04)


def price_card(card, player):
    price = 0
    for typestock in list(card.stocks.keys()):
        price += card.stocks[typestock] - player.stocks_const[typestock]
    if price <= 0:
        return 0.1
    return price


def turn(board, player_04):
    thecothelay = list_card_can_buy(board, player_04)
    nguyenlieucothelay2 = listnguyenlieulay2(board)
    nguyenlieucon = listnguyenlieucon(board)
    #action

    #Lấy thẻ
    if len(thecothelay) > 0:
        list_card_value = []
        for card in thecothelay:
            #lấy thẻ có điểm
            if card.score > 1:
Esempio n. 3
0

from base import player
import random
player_02 = player.Player("QueenOfGame", 0)
    

#Scan thẻ target trên bàn
def list_target_cards(board):
    target_cards = []
    type = ["III", "II", "I"]
    for i in type:
        for card in board.dict_Card_Stocks_Show[i]:
            if card.score == 5 and sum(card.stocks.values()) == 10:
                target_cards.append(card)
            if card.score == 4 and sum(card.stocks.values()) == 7:
                target_cards.append(card)
            if card.score == 3 and sum(card.stocks.values()) == 6:
                target_cards.append(card)
            if card.score == 2 and sum(card.stocks.values()) == 2:
                target_cards.append(card)
            if card.score == 1 and sum(card.stocks.values()) == 4:
                target_cards.append(card)
    target_cards_rank = []
    score = [3, 5, 4, 3, 2, 1]

    for i in score:
        for card in target_cards:
            if card.score == i:
                if card.score == 5:
                    if check_any_card_5score_onhand() == False:
Esempio n. 4
0
from base import player
import random
import math
player_01 = player.Player("KING", 0)


def action(board, arr_player):
    return turn(board, player_01)


def turn(board, player_01):
    thecothelay = listthecothemua(board)
    nguyenlieucothelay2 = listnguyenlieulay2(board)
    nguyenlieucon = listnguyenlieucon(board)
    #action

    #Lấy thẻ
    if len(thecothelay) > 0:
        list_card_value = []
        for card in thecothelay:
            #lấy thẻ có điểm
            if card.score > 1:
                card_value = sum(list(card.stocks.values())) / card.score
                list_card_value.append([card, card_value])
        if len(list_card_value) > 0:
            card_get = list_card_value[0][0]
            card_value = list_card_value[0][1]
            for item in list_card_value:
                if item[1] < card_value:
                    card_get = item[0]
                    card_value = item[1]
Esempio n. 5
0
from base.board import Board
from base import player
import random
import operator
player_03 = player.Player("TheGod", 0)


def action(board, arr_player):
    return moiturn(board)


def danhsachthe(board):
    danhsachthe = []
    danhsachthe.extend(player_03.card_upside_down)
    danhsachthe.extend(board.dict_Card_Stocks_Show["III"])
    danhsachthe.extend(board.dict_Card_Stocks_Show["II"])
    danhsachthe.extend(board.dict_Card_Stocks_Show["I"])
    return danhsachthe


# hàm trả nl:


def Luachonbothe(board, *args):
    dict_bo = {
        "red": 0,
        "blue": 0,
        "white": 0,
        "green": 0,
        "black": 0,
        "auto_color": 0