Code Monkey home page Code Monkey logo

304's Introduction

Game logic for 304

To run the program

  1. Setup deckofcards api
# Pull and run deckofcards image from dockerhub
make setup
  1. Run the Go program
# go run main.go
make run

304's People

Contributors

dumberdore avatar

Watchers

 avatar

304's Issues

I end up assigning last card to all the players

I want to simulate dealing a card to each player until I deal 16 cards among 4 players. The code ends up assigning last card to each player (i.e. overwriting other cards for all players!)

https://github.com/nought2B/304/blob/96fa38fd16a720b5eec9eb7376e47aa6e326d2ee/game/dealer.go#L13

❯ make setup
docker run -p 8080:8080 -d pkya/304:deckofcards
39c0f30b65ec27eaa7ff196ebfe6e1e74bcb148221b9a8ed232ff3accc9a52d8

❯ make run
go run main.go
Creating 4 Players with P1 as Default
Welcome to My 304 Server!
Creating Deck
Dealing 4 cards to each player
Current Game Cards :
Give Card 8S to player index Alpha
Give Card KS to player index Bravo
Give Card 8D to player index Charlie
Give Card KH to player index Delta
Give Card AS to player index Alpha
Give Card JC to player index Bravo
Give Card 8C to player index Charlie
Give Card 9S to player index Delta
Give Card 9D to player index Alpha
Give Card 0D to player index Bravo
Give Card 0C to player index Charlie
Give Card QH to player index Delta
Give Card 7D to player index Alpha
Give Card KD to player index Bravo
Give Card 9H to player index Charlie
Give Card JD to player index Delta

[Alpha] : JD JD JD JD
[Bravo] : JD JD JD JD
[Charlie] : JD JD JD JD
[Delta] : JD JD JD JD
After Dealing Round 2, players are as follow-

Name : AlphaCards : [0x1400011d290 0x1400011d290 0x1400011d290 0x1400011d290]--------------------------------

Name : BravoCards : [0x1400011d290 0x1400011d290 0x1400011d290 0x1400011d290]--------------------------------

Name : CharlieCards : [0x1400011d290 0x1400011d290 0x1400011d290 0x1400011d290]--------------------------------

Name : DeltaCards : [0x1400011d290 0x1400011d290 0x1400011d290 0x1400011d290]--------------------------------
GameCards :  [{8 SPADES 8S} {KING SPADES KS} {8 DIAMONDS 8D} {KING HEARTS KH} {ACE SPADES AS} {JACK CLUBS JC} {8 CLUBS 8C} {9 SPADES 9S} {9 DIAMONDS 9D} {10 DIAMONDS 0D} {10 CLUBS 0C} {QUEEN HEARTS QH} {7 DIAMONDS 7D} {KING DIAMONDS KD} {9 HEARTS 9H} {JACK DIAMONDS JD} {10 SPADES 0S} {QUEEN DIAMONDS QD} {JACK SPADES JS} {JACK HEARTS JH} {QUEEN SPADES QS} {ACE CLUBS AC} {7 SPADES 7S} {7 HEARTS 7H} {10 HEARTS 0H} {ACE HEARTS AH} {9 CLUBS 9C} {KING CLUBS KC} {QUEEN CLUBS QC} {7 CLUBS 7C} {8 HEARTS 8H} {ACE DIAMONDS AD}]
That's all for now!!
❯

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.