当前位置: 首页>>代码示例>>PHP>>正文


PHP Card::watch_card方法代码示例

本文整理汇总了PHP中Card::watch_card方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::watch_card方法的具体用法?PHP Card::watch_card怎么用?PHP Card::watch_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card::watch_card方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: counting

 /**
  * 結算
  * @param $discards
  */
 public function counting($discards, $command = false)
 {
     $ret = [];
     $cardObj = new Card();
     echo "蓋牌結算 : <br>";
     foreach ($discards as $key => $values) {
         echo '[玩家' . ($key + 1) . '] :';
         $cardObj->watch_card($values, $command);
         foreach ($values as $val) {
             $ret[$key] += $val % 13 == 0 ? 13 : $val % 13;
         }
     }
     arsort($ret);
     $person = array_keys($ret);
     return $person[0];
 }
开发者ID:evelynocean,项目名称:poker_sevens,代码行数:20,代码来源:Flow.php

示例2: json_encode

// 玩家
$players = array("玩家1", "玩家2", "玩家3", "玩家4", "玩家5");
// 發牌
$cardObj = new Card();
$cards = $cardObj->create();
$cards = $cardObj->shuffle($cards);
$groups = $cardObj->Dealer(count($players), $cards);
// suit
$suit = $cardObj->suit();
echo json_encode($groups) . '<br>';
//$groups = json_decode('[[14,3,47,6,20,33,17,51,9,11,29],[21,13,7,5,34,8,40,10,30,12,31],[32,16,43,28,45,42,15,36,26,25],[23,38,52,22,39,27,2,44,24,49],[35,41,48,4,37,1,19,46,50,18]]');
// testing
foreach ($groups as $key => $val) {
    echo '[' . $players[$key] . '] &emsp;';
    sort($val);
    $cardObj->watch_card($val);
}
echo '<hr>';
// 遊戲開始
$flow = new Flow();
$tab = new Table();
$flow::$members = count($players);
// 第一手
$card = $flow->fire($groups);
$tab->add($card);
echo $players[$flow->now_player()] . ' : ' . $suit[$card] . '<br>';
for ($i = 0; $i < 55; $i++) {
    $flow->move_next();
    $card = $flow->run($tab->get_on_table());
    if (!$card) {
        echo '[' . $i . '] ' . $players[$flow->now_player()] . ' : PASS ! <br>';
开发者ID:evelynocean,项目名称:poker_sevens,代码行数:31,代码来源:test_rule.php

示例3: array

include_once '../start/autoload.php';
$players = array("玩家1", "玩家2", "玩家3", "玩家4", "玩家5");
// 發牌
$cardObj = new Card();
$cards = $cardObj->create();
$cards = $cardObj->shuffle($cards);
$groups = $cardObj->Dealer(count($players), $cards);
//echo json_encode($groups).'<br>';
// suit
$suit = $cardObj->suit();
// testing 顯示各家手牌
foreach ($groups as $key => $val) {
    fwrite(STDOUT, '[' . $players[$key] . ']');
    sort($val);
    $cardObj->watch_card($val, true);
}
fwrite(STDOUT, '--------------------------------------');
// 遊戲開始
$flow = new Flow();
$tab = new Table();
$flow::$members = count($players);
// 第一手
$card = $flow->fire($groups);
$tab->add($card);
fwrite(STDOUT, $players[$flow->now_player()] . '出牌: ' . $suit[$card]);
for ($i = 0; $i < 55; $i++) {
    $flow->move_next();
    fwrite(STDOUT, " || " . $players[$flow->now_player()] . "請出牌:");
    $str = trim(fgets(STDIN));
    if (empty($str)) {
开发者ID:evelynocean,项目名称:poker_sevens,代码行数:30,代码来源:testing.php


注:本文中的Card::watch_card方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。