Skip to content

Commit

Permalink
shortened lines and updated authors
Browse files Browse the repository at this point in the history
  • Loading branch information
max-charlamb committed Dec 8, 2019
1 parent 1fa578e commit 5856807
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion authors.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let hours_worked = [10; 8; 8]
let hours_worked = [15;15;15]
3 changes: 2 additions & 1 deletion bot.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ module Bot:BotSig = struct
and play_med_helper hand pile queen_played queen_table =
let pile_suite = (fst (pile |> List.rev |> List.hd)).suite in
if PartialDeck.voided pile_suite hand then
play_bad_cards hand pile pile_suite [] {rank=Queen; suite=Spade} bad_cards
play_bad_cards hand pile pile_suite []
{rank=Queen; suite=Spade} bad_cards
else
match queen_played, queen_table with
| true, false -> play_highest hand pile pile_suite []
Expand Down
6 changes: 4 additions & 2 deletions partialdeck.mli
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ module type PartialDeckSig = sig
(** [count_points t] is the number of points in partial deck [t]. *)
val count_points: t -> int

(** [merge t1 t2] is the partial deck containing all the cards in t1 and t2.*)
(** [merge t1 t2] is the partial deck containing
all the cards in t1 and t2. *)
val merge: t -> t -> t

(** [contains_hearts t] is true if [t] contains any hearts. Otherwise false.*)
(** [contains_hearts t] is true if [t] contains any hearts.
Otherwise false. *)
val contains_hearts: t -> bool

(** [string_of_partialdeck t] is a string representing the deck [t]. *)
Expand Down
12 changes: 7 additions & 5 deletions round.ml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ module Round:RoundSig = struct
)
(-1,false) players |> fst

(** [id_to_name id t] is the name of the player with id=[id] in round [t]. *)
(** [id_to_name id t] is the name of
the player with id=[id] in round [t]. *)
let id_to_name id t =
(List.nth t.players id).name

Expand Down Expand Up @@ -268,7 +269,7 @@ module Round:RoundSig = struct
let contains_other_cards = (PartialDeck.voided Club user.hand) &&
(PartialDeck.voided Diamond user.hand) &&
(PartialDeck.voided Spade user.hand) in
if not t.hearts_broken && card.suite = Heart && not contains_other_cards
if not t.hearts_broken && card.suite = Heart && not contains_other_cards
then
raise (Default "Hearts are not yet broken! Play another card.") else ()

Expand Down Expand Up @@ -399,8 +400,8 @@ module Round:RoundSig = struct
else player) t.players


(** [list_to_deck lst deckacc] is the deck representation of the lst of cards in
[lst]. *)
(** [list_to_deck lst deckacc] is the deck
representation of the lst of cards in [lst]. *)
let rec list_to_deck deckacc lst =
match lst with
| (h, _) :: t -> list_to_deck (PartialDeck.insert h deckacc) t
Expand Down Expand Up @@ -476,7 +477,8 @@ module Round:RoundSig = struct
| (_,0) -> t
| (Play,id) ->
internal_play t.next_player
(Bot.play (List.nth t.players id).hand t.pile (get_difficulty t) t.qspade_played) t
(Bot.play (List.nth t.players id).hand t.pile (get_difficulty t)
t.qspade_played) t
| (Lead,id) ->
internal_lead t.next_player
(Bot.lead (List.nth t.players id).hand t.pile (get_difficulty t)) t
Expand Down

0 comments on commit 5856807

Please sign in to comment.