Event Sourcing Poker Reducers

  • Tình trạng: Closed
  • Giải thưởng: $470
  • Các bài thi đã nhận: 5
  • Người chiến thắng: CryptoChris

Tóm tắt cuộc thi

Create software to reduce the state of a Poker game by events

The software to create will reduce/compute the state of a Texas Hold Em Game. Reducers are pure functions that specify how the application's state changes in response to events. Events are simply objects that have a required type and an optional payload.


REQUIREMENTS:
-Javascript/NodeJS (Typescript strongly preferred)


The architecture of the software is event based; in other words, the inputs will be events and the software should create snapshots of state (to a file) after each event is processed.

Feel free to redesign the input events and/or state to improve the system, the only requirement is that your software will have to process the events.

It is sufficient for your program to process the input events from a JSON file, and to output state snapshots to another file.


Here might be the initial state of the game:


export const INIT_DEALER: IDealerState = {
'communityCards': [],
'options': {
'smallBlind': 5,
'bigBlind': 10,
'gameType': GameType.NLH,
},
'seed': {
'buttonPosition': 0,
'players': null,
'playersWhoStartedTheGame': [],
'deck': []
},
'players': null,
'pot': 0,
'temporaryPot': 0,
'playersInPlay': [],
'bettingQueue': [],
'timeout': null,
'status': PokerRound.PREDEAL,
'winner': null,
'wagerToCall': 0,
'timeAddRequested': false,
'rabbitRequested': false,
'roundComplete': false,
'gameStarted': false,
'gameOver': false
};


These are the different event types that your software must respond to:

export enum DealerEvents {
LOAD_GAME = 'LOAD_GAME',
CHECK= 'CHECK',
CALL = 'CALL',
FOLD = 'FOLD',
BET = 'BET',
RAISE = 'RAISE',
ALL_IN = 'ALL_IN',
HUNT_RABBIT = 'HUNT_RABBIT',
ADD_TIME= 'ADD_TIME',
TIMEOUT= 'TIMEOUT',
ADVANCE_ROUND= 'ADVANCE_ROUND'
}

Here might be an example input JSON file with example events (remember you can redesign the events/state as you need):

type: 'REGISTERED', payload: {'options': {'gameType': 'NoLimitHoldEm',
'smallBlind': 5,
'bigBlind': 10}
, 'seed':{
'players': {
'123': initPlayer('123', 1000), // A player object with id ‘123’ and chip stack 1000
'abc': initPlayer('abc', 1000),
},
'playerIdsWhoStartedTheGame': ['abc', '123'],
'deck': ['As', 'Kh', 'Ah', 'Kd', 'Ad', '2d', '3d', '7c', '8c', ...], /*CardIds are strings that are made of 2 characters, the RANK (A = ace, K= king, J= king, T=10, 9 = 9…. , followed by a lowercase suit*/
'buttonPosition': 0

}}; // Load game with options and seeds
{ type: DealerEvents.CALL, payload: {playerId: '123'} }
{ type: DealerEvents.CHECK, payload: {playerId: 'abc'} }
{ type: DealerEvents.ADVANCE_ROUND, payload: {} }// To flop
{ type: DealerEvents.CHECK, payload: {playerId: '123'} }
{ type: DealerEvents.CHECK, payload: {playerId: 'abc'} }
{ type: DealerEvents.ADVANCE_ROUND, payload: {} }// To turn
{ type: DealerEvents.CHECK, payload: {playerId: '123'} }
{ type: DealerEvents.CHECK, payload: {playerId: 'abc'} }
{ type: DealerEvents.ADVANCE_ROUND, payload: {} }// To river
{ type: DealerEvents.CHECK, payload: {playerId: '123'} }
{ type: DealerEvents.CHECK, payload: {playerId: 'abc'} }
{ type: DealerEvents.ADVANCE_ROUND, payload: {} } // To showdown




Remember, after each event, record the snapshot of the current state to a json file. (So if there are 10 events, you should have 10 snapshots)

Các kĩ năng yêu cầu

Phản hồi của người thuê

“Exceeded expectations”

Hình ảnh hồ sơ jordansuarez0, United States.

Những bài dự thi tốt nhất dự cuộc thi này

Xem thêm bài dự thi

Bảng thông báo công khai

  • sanjibkoley
    sanjibkoley
    • cách đây 5 năm

    after an event say CALL_BACK, payload{} what should be the change in state

    • cách đây 5 năm
  • rmparisi
    rmparisi
    • cách đây 5 năm

    Hello,
    I just submitted an entry for your other contest. I wanted to say that I'd like to submit an entry for this one as well but unfortunately will not have time this weekend to work on a solution. If the contest closes prior to my submission and you would like for me to build/send you a solution please message me and let me know. I'd be happy to work the project.
    Thanks,
    Ryan P.

    • cách đây 5 năm
  • marlolo
    marlolo
    • cách đây 5 năm

    Hello,

    I just found your contest, but there are some details that are not clear.
    I understand that you want an event sourced software that should keep the state of a Texas Holdem Game, but should it view the entire game state or just what is seen by the dealer?

    In other words, should the program keep a list(["Kd", "Ad"]) of all the players cards at all moments? Even while he has not shown the cards.

    • cách đây 5 năm
    1. jordansuarez0
      Chủ cuộc thi
      • cách đây 5 năm

      yes. you are keeping track of all of the players cards

      • cách đây 5 năm
    2. jordansuarez0
      Chủ cuộc thi
      • cách đây 5 năm

      it is in charge of keeping track of the entire game... i just called it the dealer for lack of a better name

      • cách đây 5 năm
  • dev681999
    dev681999
    • cách đây 5 năm

    Actually, I have never played a poker game so finding very hard to imagine the examples u sent?

    • cách đây 5 năm
  • dev681999
    dev681999
    • cách đây 5 năm

    Well if there is no UI then how do u want the result to be shown?

    • cách đây 5 năm
  • dev681999
    dev681999
    • cách đây 5 năm

    Hi, could you give a basic example of the system should work? And can I use Golang instead of NodeJS? Reply ASAP

    • cách đây 5 năm
    1. jordansuarez0
      Chủ cuộc thi
      • cách đây 5 năm

      I gave examples in the descriptions. Create a poker software that deduces the state from a series of events. The state object and the event object must be a JSON, but it can have any properties you see fit.

      • cách đây 5 năm
  • al2018
    al2018
    • cách đây 5 năm

    Hi, I can help you. If you are interested in me please contact me.

    • cách đây 5 năm

Xem thêm bình luận

Làm thế nào để bắt đầu với cuộc thi

  • Đăng cuộc thi của bạn

    Đăng cuộc thi của bạn Nhanh chóng và dễ dàng

  • Nhận được vô số bài dự thi

    Nhận được vô số Bài dự thi Từ khắp nơi trên thế giới

  • Trao giải cho bài thi xuất sắc nhất

    Trao giải cho bài thi xuất sắc nhất Download File - Đơn giản!

Đăng cuộc thi ngay hoặc tham gia với chúng tôi ngay hôm nay!