Начало создания ядра версия 0.0.1
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Card:
|
||||||
|
STARTING_CARDS = 7
|
||||||
|
low_gap = 0
|
||||||
|
hight_gap = 9
|
||||||
|
color_special_quantity = 2
|
||||||
|
no_color_special_quantity = 4
|
||||||
|
color = ("green", "yellow", "red", "blue")
|
||||||
|
color_special = ["add_two", "revers", "skip"]
|
||||||
|
no_color_special = ["choose color", "add_quad"]
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
from card_info import Card
|
||||||
|
from random import shuffle
|
||||||
|
from player import Player
|
||||||
|
|
||||||
|
class Core:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.end_card = ""
|
||||||
|
self.info_card = Card()
|
||||||
|
self.cards = []
|
||||||
|
for i in self.info_card.color:
|
||||||
|
for j in range(self.info_card.low_gap, self.info_card.hight_gap + 1):
|
||||||
|
self.cards.append(i + " " + str(j))
|
||||||
|
for i in self.info_card.color:
|
||||||
|
for j in self.info_card.color_special:
|
||||||
|
for u in range(0, self.info_card.color_special_quantity):
|
||||||
|
self.cards.append(i + " " + j)
|
||||||
|
|
||||||
|
for i in self.info_card.no_color_special:
|
||||||
|
for j in range(0, self.info_card.no_color_special_quantity):
|
||||||
|
self.cards.append(i)
|
||||||
|
|
||||||
|
|
||||||
|
def randomize(self) -> None:
|
||||||
|
shuffle(self.cards)
|
||||||
|
|
||||||
|
def get_cards(self) -> str:
|
||||||
|
return self.cards.pop()
|
||||||
|
|
||||||
|
def get_starting_hand(self) -> list:
|
||||||
|
cards = []
|
||||||
|
for i in range(self.info_card.STARTING_CARDS):
|
||||||
|
cards.append(self.cards.pop())
|
||||||
|
return cards
|
||||||
|
|
||||||
|
def first_card(self) -> str:
|
||||||
|
self.end_card = self.cards.pop()
|
||||||
|
return self.end_card
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cards = Core()
|
||||||
|
cards.randomize()
|
||||||
|
print(cards.first_card(), end="--\n\t")
|
||||||
|
Misha = Player()
|
||||||
|
Misha.get_first_card(cards.get_starting_hand())
|
||||||
|
for i in Misha.view_card():
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
class Player:
|
||||||
|
def __init__(self):
|
||||||
|
self.have_cards = []
|
||||||
|
|
||||||
|
def get_card(self, card: str) -> None:
|
||||||
|
self.have_cards.append(card)
|
||||||
|
|
||||||
|
def view_card(self) -> list:
|
||||||
|
return self.have_cards
|
||||||
|
|
||||||
|
def get_first_card(self, cards: list):
|
||||||
|
for i in cards:
|
||||||
|
self.have_cards.append(i)
|
||||||
Reference in New Issue
Block a user