Question: 1) Smalltalk requirements: Represent each hand as a heterogeneous array. Create a custom class called Poker, with a method that accepts two arrays as arguments
1) Smalltalk requirements:
Represent each hand as a heterogeneous array. Create a custom class called Poker, with a method that accepts two arrays as arguments called winner:vs: . Calling your method might look as follows:
x := Poker new.
hand1 := #(3, H, 10, S, 4, S, 4, C, 5, C).
hand2 := #(2, H, 2, S, 5, S, 2, C, 13, C).
x winner: hand1 vs: hand2.
2) Elixir requirements:
Represent each hand as a heterogeneous list. Name your function for finding the winning hand winner, and call it as follows:
hand1 = [3, H, 10, S, 4, S, 4, C, 5, C] hand2 = [2, H, 2, S, 5, S, 2, C, 13, C] Poker.winner hand1, hand2
Your winner function and all associated helper functions should be defined in a module called Poker, in a file Poker.ex. I should be able to execute my own script that calls the winner function in your Poker module.
3) Haskell requirements: Represent each hand as a list of pair tuples. Name your function for finding the winning hand winner, and call it as follows:
hand1 = [(3, H), (10, S), (4, S), (4, C), (5, C)]
hand2 = [(2, H), (2, S), (5, S), (2, C), (13, C)]
winner hand1 hand2
Your winner function and all associated helper functions should be defined in a module called Poker, in a file Poker.hs. I should be able to load the Poker module into GHCi and call your winner function.
4) Rust requirements:
Represent each hand as an array of pair tuples. Name your function for finding the winning hand find_winner, and call it as follows:
let hand1 = [(3, H), (10, S), (4, S), (4, C), (5, C)];
let hand2 = [(2, H), (2, S), (5, S), (2, C), (13, C)];
let xxx = find_winner (&hand1, &hand2);
Call find_winner from your main function, and print the winning hand in the main function. The hands themselves may be hardcoded.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
