aboutsummaryrefslogtreecommitdiff
path: root/judge/protocol.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-11-10 09:56:13 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-11-10 09:56:13 +0100
commitd343fcb803e955504b0d6b5c9c852620886c2994 (patch)
tree0b60abd9a3c9036ccf45da491b10d7d64ce71321 /judge/protocol.ml
parent5fecbfb6532487efc711eb1a9763535db720a291 (diff)
downloadCompetIA-d343fcb803e955504b0d6b5c9c852620886c2994.tar.gz
CompetIA-d343fcb803e955504b0d6b5c9c852620886c2994.zip
RETAB!
Diffstat (limited to 'judge/protocol.ml')
-rw-r--r--judge/protocol.ml62
1 files changed, 31 insertions, 31 deletions
diff --git a/judge/protocol.ml b/judge/protocol.ml
index 3f6d548..89248f2 100644
--- a/judge/protocol.ml
+++ b/judge/protocol.ml
@@ -2,40 +2,40 @@
exception Invalid_message of string
type msg =
- | Hello of string (* nom du jeu *)
- | YourTurn of float (* nombre secondes pour jouer *)
- | Play of string (* description textuelle du coup *)
- | OK (* coup accepté *)
- | YouWin
- | YouLose
- | Tie
- | Eliminated
- | FairEnough
+ | Hello of string (* nom du jeu *)
+ | YourTurn of float (* nombre secondes pour jouer *)
+ | Play of string (* description textuelle du coup *)
+ | OK (* coup accepté *)
+ | YouWin
+ | YouLose
+ | Tie
+ | Eliminated
+ | FairEnough
let decode = function
- | "OK" -> OK
- | "You win" -> YouWin
- | "You lose" -> YouLose
- | "Tie" -> Tie
- | "Eliminated" -> Eliminated
- | "Fair enough" -> FairEnough
- | s when String.sub s 0 6 = "Hello " ->
- Hello (String.sub s 6 (String.length s - 6))
- | s when String.sub s 0 10 = "Your turn " ->
- YourTurn (float_of_string (String.sub s 10 (String.length s - 10)))
- | s when String.sub s 0 5 = "Play " ->
- Play (String.sub s 5 (String.length s - 5))
- | s -> raise (Invalid_message s)
+ | "OK" -> OK
+ | "You win" -> YouWin
+ | "You lose" -> YouLose
+ | "Tie" -> Tie
+ | "Eliminated" -> Eliminated
+ | "Fair enough" -> FairEnough
+ | s when String.sub s 0 6 = "Hello " ->
+ Hello (String.sub s 6 (String.length s - 6))
+ | s when String.sub s 0 10 = "Your turn " ->
+ YourTurn (float_of_string (String.sub s 10 (String.length s - 10)))
+ | s when String.sub s 0 5 = "Play " ->
+ Play (String.sub s 5 (String.length s - 5))
+ | s -> raise (Invalid_message s)
let encode = function
- | Hello x -> "Hello " ^ x
- | YourTurn n -> "Your turn " ^ (string_of_float n)
- | Play x -> "Play " ^ x
- | OK -> "OK"
- | YouWin -> "You win"
- | YouLose -> "You lose"
- | Tie -> "Tie"
- | Eliminated -> "Eliminated"
- | FairEnough -> "Fair enough"
+ | Hello x -> "Hello " ^ x
+ | YourTurn n -> "Your turn " ^ (string_of_float n)
+ | Play x -> "Play " ^ x
+ | OK -> "OK"
+ | YouWin -> "You win"
+ | YouLose -> "You lose"
+ | Tie -> "Tie"
+ | Eliminated -> "Eliminated"
+ | FairEnough -> "Fair enough"