Openpoker原始碼分析

2021-05-22 11:24:01 字數 3523 閱讀 2767

1。什麼是openpoer

2。現有的關於openpoker的資料

如何執行和測試

http://blog.csdn.net/stephenxu111/archive和/2008/06/20/2570070.aspx

3。今天開始我們一起分析原始碼

獲得原始碼

4。從**入手

all() –>                     %%系統啟動入口 

mnesia:start(),            %%資料庫啟動

ok = mnesia:wait_for_tables([game_config], 10000),

%% make sure the basics work

db:test(),                 %%資料庫管理模組

proto:test(),              %%協議編碼解碼模組

hand:test(),               %%牌面模組

pot:test(),                %%檯面模組

player:test(),             %%使用者模組

game:test(),               %%遊戲模組

cardgame:test(),           %%紙牌遊戲模組

deal_cards:test(),         %%處理紙牌模組

deck:test(),               %%牌桌模組

fixed_limit:test(),        %%固定限制模組

delayed_start:test(),      %%延遲啟動模組

blinds:test(),             %%

betting:test(),

showdown:test(),           %%關閉模組

login:test(),              %%登陸模組

%% run tests

test10(),

test20(),

test30(),

test40(),

test50(),

test60(),

test70(),

test80(),

test90(),

test100(),

test110(),

test120(),

test130(),

test135(),

test140(),

test150(),

test160(),

test170(),

test180(),

ok.

%%% create player

test10() ->

db:delete(player),            %刪除原有使用者  

counter:reset(player),        %計數器重置

nick = "p",                   

%% player does not exist

?match(}, player:start("blah")),

= player:create(nick, "foo", "", 100),      %建立新使用者 

?match(1, id),

= player:start(nick),                          %啟動新使用者

?match(, db:get(player, id, pid)),

player:stop(pid),                                        %停止新使用者

timer:sleep(100),

?match(, db:get(player, id, pid)),

ok.

%%% create game

test20() ->

db:delete(game_xref),         %刪除原有遊戲

counter:reset(game),          %計數器重置

gametype = ?gt_irc_texas,     %遊戲型別

limittype = ,

= cardgame:start(gametype,           %啟動新遊戲

2, limittype),

?match(1, cardgame:call(game, 'id')),

?match(0, cardgame:call(game, 'joined')),

?match(, db:get(game_xref, 1, pid)),

cardgame:stop(game),                            %停止遊戲

timer:sleep(100),

?match(, db:find(game_xref, 1)),

ok.

%%% basic seat query

test30() ->

db:delete(game_xref),

db:delete(player),

players = = make_players(1),

game = make_game(2, players),

x = cardgame:call(game, 'seat query'),

?match([,

], x),

z = cardgame:call(game, 'joined'),

?match(1, z),

cardgame:stop(game),

kill_players(players),

ok.

spring原始碼分析 spring原始碼分析

1.spring 執行原理 spring 啟動時讀取應用程式提供的 bean 配置資訊,並在 spring 容器中生成乙份相應的 bean 配置登錄檔,然後根據這張登錄檔例項化 bean,裝配好 bean 之間的依賴關係,為上 層應用提供準備就緒的執行環境。二 spring 原始碼分析 1.1spr...

思科VPP原始碼分析(dpo機制原始碼分析)

vpp的dpo機制跟路由緊密結合在一起。路由表查詢 ip4 lookup 的最後結果是乙個load balance t結構。該結構可以看做是乙個hash表,裡面包含了很多dpo,指向為下一步處理動作。每個dpo都是新增路由時的乙個path的結果。dpo標準型別有 dpo drop,dpo ip nu...

redux原始碼分析(三) 原始碼部分

下面是每個部分的一些解讀 createstore apicreatestore reducer,initialstate enhancer 曾經非常好奇這個函式的第二個引數到底是initialstate還是enhancer,因為見過兩種寫法都有的,以為是版本問題。看了原始碼才發現,都可以的。如果你不...