Skip to content

Instantly share code, notes, and snippets.

@techate
techate / forkex.ml
Created December 4, 2017 02:44
Coin-flipping game in OCaml with timeouts on players
open Unix
type player_moves = Heads | Tails
type server_moves = Right | Wrong | Timeout
type player = {
name : string;
brain : out_channel -> unit;
pipe : in_channel * out_channel;
-module(break).
-export([length/1]).
% let list = [1,2,3,4,5,6,7]
%
% var n = 0
% for i in 0..<list.len:
% inc n
% if n > 3: break
% echo n