From 10cabb2cbf8409d2c64b2b6252800d87ee9eea71 Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Sun, 19 Jun 2011 00:06:41 +0200 Subject: Add makefile --- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..96ae2e1 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +OCAMLC=ocamlc.opt +OCAMLOPT=ocamlopt.opt +OCAMLDEP=ocamldep.opt +INCLUDES= +OCAMLFLAGS=$(INCLUDES) +SRCS=cards.ml ltg.ml +BUILDDIR= +DEPEND=.depend + +all: ltg.opt + +ltg.opt: ltg.cmx cards.cmx + $(OCAMLOPT) $(OCAMLFLAGS) -o ltg cards.cmx ltg.cmx + +clean: + rm -f *.cm? *.cmx? *.o *~ + rm -f .depend + +depend: $(SRCS) + $(OCAMLDEP) $(SRCS) > $(DEPEND) + +.SUFFIXES: .mli .ml .cmo .cmi .cmx + +%.cmo : %.ml + $(OCAMLC) -c $(OCAMLFLAGS) $< +%.cmi : %.mli + $(OCAMLC) -c $(OCAMLFLAGS) $< +%.cmx : %.ml + $(OCAMLOPT) -c $(OCAMLFLAGS) $< + +-include $(DEPEND) + -- cgit v1.2.3-70-g09d2 From 74a451bce4fc3106f908e933a564df055d11d1bd Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Sun, 19 Jun 2011 01:23:45 +0200 Subject: Update makefile, use left and right apply in read_move --- Makefile | 6 +++--- ltg.ml | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 96ae2e1..98262de 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,14 @@ OCAMLOPT=ocamlopt.opt OCAMLDEP=ocamldep.opt INCLUDES= OCAMLFLAGS=$(INCLUDES) -SRCS=cards.ml ltg.ml +SRCS=game.ml ltg.ml BUILDDIR= DEPEND=.depend all: ltg.opt -ltg.opt: ltg.cmx cards.cmx - $(OCAMLOPT) $(OCAMLFLAGS) -o ltg cards.cmx ltg.cmx +ltg.opt: ltg.cmx + $(OCAMLOPT) $(OCAMLFLAGS) -o ltg game.cmx ltg.cmx clean: rm -f *.cm? *.cmx? *.o *~ diff --git a/ltg.ml b/ltg.ml index e5de957..8aed118 100644 --- a/ltg.ml +++ b/ltg.ml @@ -1,3 +1,10 @@ +open Game + +let _ = if Array.length Sys.argv < 2 then begin + Printf.printf "You must specify the player number\n"; + exit 1 +end + let me = int_of_string Sys.argv.(1) let opponent = match me with @@ -6,8 +13,10 @@ let opponent = match me with | _ -> failwith "Wrong player_number" let read_move () = Scanf.scanf "%d\n" (fun d -> match d with - | 1 -> Scanf.scanf "%s\n%d\n" (fun s d -> ()) - | 2 -> Scanf.scanf "%d\n%s\n" (fun d s -> ()) + | 1 -> Scanf.scanf "%s\n%d\n" (fun s d -> + Cards.left_apply opponent (card_of_string s) d) + | 2 -> Scanf.scanf "%d\n%s\n" (fun d s -> + Cards.right_apply opponent (card_of_string s) d) | _ -> failwith "Wrong move number" ) -- cgit v1.2.3-70-g09d2