当前位置: 首页 > 软件库 > 游戏/娱乐 > >

poker-maison

授权协议 Readme
开发语言 Haskell
所属分类 游戏/娱乐
软件类型 开源软件
地区 不详
投 递 者 何烨华
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Poker Maison

A multiplayer app crafted with Haskell and React

https://news.ycombinator.com/item?id=20653278

Get everything running with Docker

Prerequisites

In order to use Docker have the following installed.

Firstly start Docker Machine

docker-machine start

Then set the correct variables in your terminal so you can connect to Docker Machine

eval $(docker-machine env)

Now build the images. This will take a while.

docker-compose up

Now go navigate to http://192.168.99.100:3000 in your browser and the app should be running.

The above ip address is the one for your docker-machine VM if you are on the default settings. By default docker-machine doesn't serve localhost but instead uses 192.168.99.100 as the host.

You can simulate multiple players in the same game on on your machine if you navigate to the above url in a few different browser tabs. Eac time you open up a new tab just remember to log out after you have signed in as the browser will cache the access_token for the last logged in user for each new tab as URL is the same.

Common Docker Problems

Docker has the wrong TLS setting

If you get the error below then Docker Compose is not using the correct TLS version.

Building web
ERROR: SSL error: HTTPSConnectionPool(host='192.168.99.100', port=2376): Max retries exceeded with url: /v1.30/build?q=False&pull=False&t=server_web&nocache=False&forcerm=False&rm=True (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:727)'),))

You can fix this by setting the following environment variable with the correct TLS version.

export COMPOSE_TLS_VERSION=TLSv1_2

Container runs out of memory

If the server docker container runs out of memory whilst building. Whis would look like this.

--  While building package Cabal-2.4.1.0 using:
      /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options ""
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)

Then set increase the memory available to the VM you are using for docker-machine.Assuming your VM is named "default", run:

docker-machine stop default
VBoxManage modifyvm default --memory 4096
docker-machine start default

Slow builds

If you want to speed up builds then replace n in the command belowwith the number of cores your machine has and run the command.The command below assumes that "default" is the name of the VM Docker Machine is using.

docker-machine stop default
VBoxManage modifyvm default --cpus n
docker-machine start default

Building locally from scratch.

The following steps are based on an Ubuntu distribution.

Back End

Firstly make sure you have ghc and stack installed in order to compile the back end written in Haskell.If you need to install the Haskell platform then run

curl -sSL https://get.haskellstack.org/ | sh

Secondly install libpq (c bindings to postgres)

sudo apt-get install libpq-dev

Next install redis.

sudo apt-get install redis

Navigate to the server/ directory.

cd server

Compile the back end poker server.

stack build

Now we need to set some config.

Ensure postgresql 10 is installed and running.

Set the env var so that the server has the postgresql connection string.Of course you will need to change the db connection parameters below to match your local database.

export dbConnStr='host=0.0.0.0 port=5432 user=tom dbname=pokerdbtest password=tom

Set env variable with the secret key for generating auth tokens.Note that this secret must be 32 characters long or it won't work.

export secret="changeme077cf4e7441c32d2d0a86b4c"

Lastly ensure redis-server is running in the background on default port

redis-server

Now run the server locally. The default user API port is 8000 and websocket port is 5000.

stack run

Front End

Install node version 10.16.3 and then install yarn globally

npm i -g yarn@1.17.3

Install a required system dependency for node-sass .

sudo apt-get install libpng-dev

Navigate to the client/ directory with

cd client

Then just run.

yarn start

Now you are ready to play poker!

Simulating a multiplayer game locally

You may want to play against yourself when you are developing locally so justrun the clients on two separate ports.

In your first terminal run

PORT=8001 yarn start

Then open another terminal and run

PORT=8002 yarn start

Now just open two tabs in your browser navigating to

localhost:8001

and

localhost:8002

Running Tests

To run the test suite on the backend which has over a hundred tests

cd server && stack test

Contributions Welcome

Have a look at the issues if you want some starting ideas on how to get involved.

Feel free to open any issues with potential enhancements or bugs you have found.

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.

  • 分享一个大牛的人工智能教程。零基础!通俗易懂!风趣幽默!希望你也加入到人工智能的队伍中来!请点击http://www.captainbed.net  /** * Created by Chimomo */ namespace PokerSort { using System.Collections.Generic; /// <summary> /// The pro

  • 声明:         本文很长,并且最终不会有完整代码,仅提供算法;         本文知识点中等偏难,但是看懂和学会之后有一定好处;         本文绝对不是最优解,并且很多步骤待封装成函数,这里逐一分析;         本文纯属个人刷题方法和总结,如有错误,欢迎指正;         如果你做的时候有些吃力,真正想学点什么,请耐心看完,看懂。 题目如下:         背景:两个人

  • 【计划扑克(Planning Poker)】 这是利用一种标有斐波那契数字的扑克牌通过游戏的方法测算难度。计划扑克的目的是为了能够在一个尽可能短的时间内,让团队成员更加多的了解需要做的工作,同时顺带得到一个可接受的估算结果,一般推荐4到8人参与估算。 所谓“计划扑克”(Planning Poker)是一种标有各种数字的扑克牌。参加游戏的 人每人各拿一叠扑克牌,牌上有不同的数字。 客户或者产品责任人

  • 题意         额,就是给你 5 张牌,让你判定这手牌的分数,纯模拟,具体的规则如下:    1、Straight flush: 1000 points five cards of the same suit in sequence, such as 76543 of hearts. Note that AKQJX is treated as a valid sequence.     2、

  • int p = 1; while (true){ System.out.println("玩家"+p+"出牌"); if (p == 1) { System.out.println("手牌:"+player1); System.out.println("请玩家1输入要出第几帐牌"); int n = new Scanner(Syste

  • 题目描述 Bessie and her friends are playing a unique version of poker involving a deck with N (1 <= N <= 100,000) different ranks, conveniently numbered 1..N (a normal deck has N = 13). In this game, ther

  • A. Berland Pokertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output The game of Berland poker is played with a deck of nn cards, mm of which are joke

  • http://www.yyycode.cn/index.php/2020/05/30/a-berland-poker/   The game of Berland poker is played with a deck of nn cards, mm of which are jokers. kk players play this game (nn is divisible by kk). At

  • In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way: High Card: Highest value card. One Pair: Two cards of the same value. Two Pairs: Two

  • 题目来源: 蔚来杯"2022牛客暑期多校训练营8   Poker Game: Decision   大致题意: 最初A2张牌 B2张牌 从A开始轮流从6个牌中挑选1张牌 拿3轮 AB都能看到所有的牌 包括初始的2张和可以选的6张 AB都会采取最优策略挑选牌 之后A5张牌 B5张牌 比较A的牌和B的牌哪个好 或者同样好 (判定好坏规则在题面中) 大致思路: DFS剪枝判定每次选牌的最终状态 边界情况

  • https://codeforces.com/problemset/problem/1359/A 思路:我们先确定最大值,显然要么是 n/k,要么是 m ,次小值同理 以下是代码实现: #include<iostream> using namespace std; void solved() { int n,m,k; cin>>n>>m>>k; int cnt1=min(

 相关资料
  • web-poker This project is an Angular/Nativescript Web/Mobile poker client and Java/Spring websocket backend. Additionally, the persistence of data is provided by mysql. I made a extensible protocol fo

  • 这是比特币 Poker Room 的源码。

  • matchem-poker-wp 是 Windows Phone 设备上的一个纸牌游戏应用程序。  

  • 这是根据 2005 年的 game-theoretic, heads-up limit Texas Hold'em poker player 理论编写的扑克游戏,大约有 6000 行 Java 代码。 操作理论 玩任何游戏的最佳策略都可以确保您至少达到该游戏的预期价值。在扑克中,假设没有佣金,则期望值为零,因此,如果您可以计算出最佳策略,则可以保证不会平均损失。 考虑剪刀石头布。该游戏的最佳策略是

相关阅读

相关文章

相关问答

相关文档