昆士兰大学CSSE1001/7030课业解析

题意:

使用Python语言填写leepCoders的模型类

解析:

按照文档的类关系和函数,填写代码模板中的类

Card:卡牌类
​play(self, player: Player, game: a2_support.CodersGame):#在玩家玩牌的时候调用,玩家丢弃手中的牌从牌堆中拾取新的牌。
​action(self, player: Player, game:a2_support.CodersGame, slot: int): #使用特殊牌的时候被调用
str(self) -> str(Card()): #返回当前牌的信息
​__repr__(self) -> str:#同上

Deck:牌堆类
get_cards(self) -> List[Card]: #返回牌堆中的卡组列表
get_card(self, slot) -> Card: #返回指定的slot
top(self) -> Card: #返回最后添加的卡片
remove_card(self, slot): #删除指定slot的卡片
get_amount(self) -> int: #返回牌堆中牌的数量
shuffle(self): #洗牌
pick(self, amount: int=1) -> List[Card]: #取第一张卡并返回
add_card(self, card: Card): #在牌堆顶部添加一张卡
add_cards(self, cards: List[Card]): #在牌堆顶添加一列卡牌
copy(self, other_deck: Card): #从其他的牌堆中复制到当前牌堆
str(self) -> str: #返回牌堆中包含的卡牌的字符串表示
repr(self) -> str: #同上

Player:玩家类
get_name(self) -> str: #返回玩家名称
get_hand(self) -> Deck: #返回玩家的手牌
get_coders(self) -> Deck: #返回玩家手牌中的coderCard
has_won(self) -> bool: #如果玩家手中有4个或以上的coderCard,返回true

Marking:计分类
Total Mark = (functionality + style)/2 #累计分数公式

涉及知识点:

python面向对象、字符串处理

更多可加微信讨论

微信号:alexa_au

pdf全文
Sleeping Coders
Assignment 2
CSSE1001/7030
Semester 2, 2019
Version 1.0.0
15 marks
Due Friday 20th September, 2019, 20:30
Introduction
This assignment follows a programming pattern called MVC (the Model, View, Controller)pattern. You have been provided with the view and controller classes but you will be required to implement several modelling classes.

The modelling classes are based on the children’s card game, Sleeping Queens. Each class you’re required to implement has a specification that is outlined in this document. A specification is a description of each method in a class as well as their parameters and return values.

Once you have correctly implemented the modelling classes, you will have completed a digital
version of Sleeping Coders.
在这里插入图片描述
Gameplay
Sleeping Coders (Coders for short) is a card game that is based on the popular children’s card game, Sleeping Queens. The aim of the game is to wake as many sleeping coders as possible. A sleeping coder is woken by playing a tutor card.

At the start of the game there are 16 coders placed face down in the center of the board, a face down coder card means that coder is sleeping. Each player is dealt five cards randomly. Basic Running of the Game Players will take turns playing a card from their deck, number cards have no action and are meant to be disposed while other cards have actions attributed to their playing.

A tutor card can be played at any time, when a tutor card is played the player who played it can pick up one of the coder cards from the center of the board.

Playing a keyboard kidnapper card will allow the player to take a coder card from another player.

Playing an all-nighter card will allow the player to put another players coder back to sleep (add it back to the center of the board).

The aim of the game is to collect coders by waking them up. The first player to collect 4 coders
wins the game.
Getting Started
Files
a2.py - file where you write your submission
a2_support.py - contains supporting code and part of the controller
gui.py - contains the view
players.txt - a list of random player names
images/ - a directory of card images
Classes
In the diagram below, an arrow indicates that one class stores an instance of another class. An arrow with a head indicates that one class is a subclass of another class. Red classes are classes that have been provided already.

You are encouraged to modify the class structure to by adding classes to reduce code duplication. This can include adding private helper methods.
在这里插入图片描述
The type hints shown in the methods below are purely for your own understanding. Type hints do not need to be used in your assignment.

For all of the examples in the section below, you may assume that the following code has already been executed before each example. Class Diagram

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值