Smalltalk代写 | C/CPS506 Assignment Description

这个作业是用Smalltalk完成一个扑克游戏
C/CPS506 Assignment Description

1) Smalltalk requirements:
You will create a class called Poker, with an instance method called deal: that accepts a
simple integer array as input and returns the winning hand. Its usage will be as follows:
| deck winner shuf |
deck := Poker new. “Create new Poker object”
shuf := #(1 2 3 4 5 6 7 8 9) “Sample shuffling”
winner := deck deal: shuf. “Call deal: method with shuf as arg”
Your deal method will return the winning hand as an array of strings, where each element is
a concatenation of the rank and the suit. The suit must be capitalized, and face cards are
represented numerically (11=Jack, 12=Queen, 13=King). An Ace is represented numerically
as 1. For example, if the winning hand was a straight flush from 3-7 in spades, it would be
returned as the following array:
#(‘3S’ ‘4S’ ‘5S’ ‘6S’ ‘7S’)
2) Elixir requirements:
In a single Elixir file called Poker.ex, define a module called Poker, with a function called
deal that accepts a list of integers as an argument and returns the winning hand. Its usage
will be as follows:
winner = Poker.deal [1, 2, 3, 4, 5, 6, 7, 8, 9]
The winning hand must be returned as a list of strings, where each element is a
concatenation of the rank and the suit. The suit must be capitalized, and face cards are
represented numerically (11=Jack, 12=Queen, 13=King). An Ace is represented numerically
as 1. For example, if the winning hand was a straight flush from 3-7 in spades, it would be
returned as the following array:
[“3S”, “4S”, “5S”, “6S”, “7S”]
3) Haskell requirements
In a single Haskell file called Poker.hs, define a module called Poker, with a function called
deal that accepts a list of integers as an argument and returns the winning hand. Its usage
will be as follows:
winner = Poker.deal [1, 2, 3, 4, 5, 6, 7, 8, 9]
The winning hand must be returned as a list of strings, where each element is a
concatenation of the rank and the suit. The suit must be capitalized, and face cards are
represented numerically (11=Jack, 12=Queen, 13=King). An Ace is represented numerically
as 1. For example, if the winning hand was a straight flush from 3-7 in spades, it would be
returned as the following array:
[“3S”, “4S”, “5S”, “6S”, “7S”]
Your Poker.hs file must load cleanly into GHCi. When your submission is tested, the deal
functions will be called from a separate test function. Please ensure your Poker module, and
any additional modules you create, compile correctly.
4) Rust requirements
In a single Rust file called Poker.rs, write a function called deal that accepts an array of
integers as an argument and returns the winning hand. In Rust, the typing of the input
argument and the return value are very important. Rust will NOT implicitly convert anything
for you, so pay extra attention to this. The usage of the deal function must be as follows:
let perm:[u32;9] = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let winner:Vec
= deal(perm);

Your deal function should accept an array of 9 unsigned integers, and your deal function

should return a vector of five Strings. The strings should be formatted in the same way as all

previous assignments.

Your submission should not include a main() function. The tester will implement main().

Finally, the deal function should be declared as public using the pub keyword. The required

signature for your deal function is below:

pub fn deal(perm:[u32;9])->Vec


{

// Your code goes here

}

Testing & Evaluation

Your code will be evaluated using an automated tester written by me. Therefore, it is of

utmost importance that your code compile properly, handle input properly, and return

results in the indicated format for each language. Do not deviate from the requirements or

your code will fail the tester outright. Your code must *work* as a baseline. Half-finished code

that doesn’t compile or is riddled with syntax errors will not be considered.

To help you achieve the baseline of “code that works”, I will be releasing a simple tester for

each language that will evaluate your program for a handful of test cases. The full tester will

work the same way as this simple tester, except it will run a far greater number of tests.

Beyond that, your grade for each assignment submission will be based solely on the fraction

of the tests for which your program returns the correct winning hand. There are no marks for

code style, documentation, or anything of that sort.

Here are some examples of inputs and their expected outputs, using Elixir style lists. These

are the same test cases found in the simple testers.