Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Reymont committed Nov 5, 2008
1 parent 6540ab5 commit fc6368f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 37 deletions.
19 changes: 19 additions & 0 deletions src/fixed_limit.erl
@@ -0,0 +1,19 @@
%%%% Copyright (C) 2005-2008 Wager Labs, SA

-module(fixed_limit).
-behavior(limit).

-export([blinds/2, raise/5]).

-include("common.hrl").

raise(Low, _, _, _, Stage)
when ?GS_PREFLOP == Stage;
?GS_FLOP == Stage ->
{Low, Low};

raise(_, High, _, _, _) ->
{High, High}.

blinds(Low, _) ->
{Low / 2, Low}.
40 changes: 3 additions & 37 deletions src/limit.erl
Expand Up @@ -2,42 +2,8 @@

-module(limit).

-export([new/3, raise_size/4, blinds/1]).
-export([behaviour_info/1]).

-include("common.hrl").

new(T, L, H) ->
#limit{ type = T, low = L, high = H}.

raise_size(L, _, _, Stage)
when ?LT_FIXED_LIMIT == L#limit.type, ?GS_PREFLOP == Stage;
?LT_FIXED_LIMIT == L#limit.type, ?GS_FLOP == Stage ->
{L#limit.low, L#limit.low};

raise_size(L, _, _, _)
when ?LT_FIXED_LIMIT == L#limit.type ->
{L#limit.high, L#limit.high};

raise_size(L, PotSize, _, Stage)
when ?LT_POT_LIMIT == L#limit.type, ?GS_PREFLOP == Stage ->
{L#limit.low, PotSize};

raise_size(L, PotSize, _, _)
when ?LT_POT_LIMIT == L#limit.type ->
{L#limit.high, PotSize};

raise_size(L, _, Inplay, Stage)
when ?LT_NO_LIMIT == L#limit.type, ?GS_PREFLOP == Stage ->
{L#limit.low, Inplay};

raise_size(L, _, Inplay, _)
when ?LT_NO_LIMIT == L#limit.type ->
{L#limit.high, Inplay}.

blinds(L)
when ?LT_FIXED_LIMIT == L#limit.type ->
{L#limit.low / 2, L#limit.low};

blinds(L) ->
{L#limit.low, L#limit.high}.
behaviour_info(callbacks) ->
[{raise, 5}, {blinds, 2}].

19 changes: 19 additions & 0 deletions src/no_limit.erl
@@ -0,0 +1,19 @@
%%%% Copyright (C) 2005-2008 Wager Labs, SA

-module(no_limit).
-behaviour(limit).

-export([raise/5, blinds/2]).

-include("common.hrl").

raise(Low, _, _, Inplay, Stage)
when ?GS_PREFLOP == Stage ->
{Low, Inplay};

raise(_, High, _, Inplay, _) ->
{High, Inplay}.

blinds(Low, High) ->
{Low, High}.

19 changes: 19 additions & 0 deletions src/pot_limit.erl
@@ -0,0 +1,19 @@
%%%% Copyright (C) 2005-2008 Wager Labs, SA

-module(pot_limit).
-behaviour(limit).

-export([raise/5, blinds/2]).

-include("common.hrl").

raise(Low, _, Pot, _, Stage)
when ?GS_PREFLOP == Stage ->
{Low, Pot};

raise(_, High, Pot, _, _) ->
{High, Pot}.

blinds(Low, High) ->
{Low, High}.

0 comments on commit fc6368f

Please sign in to comment.