Skip to content

Commit

Permalink
Assignment 2 Excersize 2.b
Browse files Browse the repository at this point in the history
  • Loading branch information
roca committed Feb 1, 2013
1 parent 618768c commit 7d52eb0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hw2provided.sml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,13 @@ fun card_color(card) =
(Spades , _) => Black
|(Clubs , _) => Black
|(Diamonds , _) => Red
|(Hearts , _) => Red
|(Hearts , _) => Red

fun card_value(card) =
case card of
(_ , Jack) => 10
|(_ , Queen) => 10
|(_ , King) => 10
|(_ , Ace) => 11
| (_,Num x) => x

13 changes: 13 additions & 0 deletions hw2providedTests.sml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ card_color(Spades,Ace) = Black;
card_color(Clubs,Ace) = Black;
card_color(Diamonds,Ace) = Red;
card_color(Hearts,Ace) = Red;


(* 2.b *)
card_value(Spades,Ace) = 11;
card_value(Clubs,Ace) = 11;
card_value(Diamonds,Ace) = 11;
card_value(Hearts,Ace) = 11;

card_value(Spades,Num 9) = 9;
card_value(Spades,Num 3) = 3;
card_value(Clubs,Jack) = 10;
card_value(Diamonds,Queen) = 10;
card_value(Hearts,King) = 10;

0 comments on commit 7d52eb0

Please sign in to comment.