Coder Social home page Coder Social logo

addonovan / ueberkasino Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 0.0 151 KB

Networked blackjack game for CSE3310 @ UTA w/ Prof. Bud Davis

License: GNU General Public License v2.0

Makefile 2.97% C++ 96.65% Shell 0.38%
cse3310 ubercasino jimmie bud davis uta cse fundaments of software

ueberkasino's Introduction

ÜberKasino

Ein Kasino, das über die Gegener sind!!!!!

It's a "casino" that's "over" the competition!!!!!!!111one!!!

This is a group project for CSE3310 @ UTA

Building

Make sure that opensplice is installed in your home directory, such that ~/OSPL/release.com is a file.

Edit ~/OSPL/release.com and comment-out the line setting OSPL_HOME

Run ./make.sh, it should handle everything else for you

Any arguments passed to ./make.sh will be forwarded directly to make after the OpenSplice situation is taken care of.

ueberkasino's People

Contributors

addonovan avatar chrisjakins avatar elknowles avatar jojettison avatar

Watchers

 avatar  avatar  avatar  avatar

ueberkasino's Issues

Import idl file

The idl file should be included for standardized communication between group projects.

The make file should also be updated so that the files are built and can be referenced from the program.

Random player card appears

The dealer's second card (?) might display under the first player's text field instead of the dealer's position.

Steps to reproduce:

  1. Start the game
  2. Start the dealer program
  3. Let the game run on auto
  4. On the last turn, the dealer's second card may appear in the first player slot

Bets will sometimes not be returned or forfeited

The player's bet is not returned (on tie) paid out (on victory) or forfeited (on loss) when the game is over.

Steps to reproduce:

  1. Start a game
  2. Star the dealer
  3. Switch to the reckless strategy
  4. Allow game to play through
  5. When game is over the bet will not be modified

Player's cards say "Face Down" before cards are dealt

The player's card display text box displays "Face Down" before any cards are dealt (while the dealer is still waiting in fact). This should not be the case, the box should instead be empty.

Steps to reproduce:

  1. Open the table screen
  2. Start the dealer program
  3. While the game state is WaitingForStart, the player's cards will read "Face Down"

Test to_hand

The to_hand( const net::Card cards[ net::MAX_CARDS ] ) needs to be able to correctly convert an array of cards into a net::Hand type and correctly zero-out all cards which weren't valid.

Cases to cover:
1.An empty hand of random data in each slot
2. A single card in the array to a hand with a single card
3. A full array to a full hand

Each time, you must make sure that the incorrect values have been zerod-out to prevent any miscalculations in the future.

Test Player

Creating a default player the following should be true:

  1. balance() should return 200.0 (ish, this is a floating point after all)
  2. bet() should return 0
  3. game() should return nullptr
  4. hand() should return an empty hand

The following cases need to be tested:

  1. balance(float) should immediately change the player's balance
  2. bet(int) should immediately change the player's bet
  3. leave() when called when game() == nullptr should not throw or segfault or anything
  4. operator== should check this player's UID against the .uid member of whichever type is passed to it (hint: use the net::Player to() method to get the player's UID)
  5. join( net::Dealer ) should copy the game_uid parameter out of the given dealer structure
    • game() should then begin to return a game structure which is non-nullptr and has the same UID as the dealer struct passed in
  6. from( net::Game ) before a game is joined should do nothing
  7. from( net::Game ) after a game is joined should copy the cards out of the active player's cards and into the player's hand
    • hand() should then return a hand matching the given cards
  8. to() should generate a correct net::Player representing this player instance
  9. strategy( T* ) should accept anything that extends/implements the Strategy class (test all 4 supplied strategies)

Test to_string for cards and hands

the following methods need to be tested:

std::string to_string( const net::Hand& hand )
std::string to_string( net::Suit suit )
std::string to_string( net::CardKind kind )

Cases to test to_string( const net::Hand& )

  1. An empty hand (all values are invalid)
  2. A partially filled hand
  3. A full hand (where every spot is filled)
  4. First card is "invalid" (aka face down)

Cases to test to_string( net::Suit suit )

  1. A valid suit (covered by net::Hand tests)
  2. An invalid suit must throw an exception

Cases to test to_string( net::CardKind kind )

  1. A valid kind/value (covered by net::Hand tests)
  2. An invalid kind/value must throw an exception

Network manager callbacks

The NetworkManager class should provide a way to subscribe for the following events:

  • connected to a game (on_game_connect)
  • disconnected from a game (on_game_disconnect)
  • received a card (on_card_received)
  • found a game on the network (on_game_discovered)
  • a hand ended (on_hand_over)

Each of these subscription methods should have an unsubscription counterpart in the form of unsub_##action_name (e.g. unsub_on_game_connect)

GameDiscoveredEvent

Passed to a game discovered listener, contains the following data:

  • std::string table_name the name of the game
  • int table_id the id for the table
  • int open_seats the number of open seats in the game
  • Shoe shoe_type the type of shoe being played

GameConnectedEvent

Passed to a game connected listener.

  • int table_id the id for the connected table

GameDisconnectEvent

Passed to a game disconnected listener.

  • std::string reason The reason (if any) for being kicked

CardReceivedEvent

Passed to a card received listener.

  • int player_id the id for the player who was dealt the card
  • Card card the card that was dealt

HandOverEvent

Passed to a hand over listener.

  • std::string reason the reason the hand was ended

Face down card doesn't print

When the first card is face down, to_string( net::Hand ) should have "Face Down" as the first line in the output, but it does not.

Steps to reproduce:

  1. Open the table screen
  2. Start the dealer
  3. Wait for the game to connect
  4. When the game begins, the dealer's first card will not be displayed at all, it will be entirely skipped.

Timeouts may be too quick

Sometimes the timeout seems to be firing too quickly.

Might be due to the way that the timeout calculation is done.

Player can segfault when joining a game

This only happens in testing for some reason...

the actual stack frame that's being a problem is:
player.cpp:149 copy.count = value_of( hand )
player.cpp:113 net::Player packet = to();

Outbound network events

Classes must be created for the following outbound network events:

GameEvent

  • PlayType type the type of play (i.e. hit, stand, etc.)

BetChangeEvent

  • int new_bet the new bet

ConnectEvent

  • int table_id the id of the table to join

DisconnectEvent

Test value_of

The unsigned int value_of( const net::Hand& hand) function takes a hand and creates the highest count it can from the hand without busting (if possible).

Cases to cover:

  1. Empty hand should have value of zero
  2. Value of a single Ace should be 11
  3. Value of two Aces should be 12
  4. Value of two random other cards should be correct

Player must stay in game until the dealer stops

The player should stay in the game and not leave after a hand is over. The only way to leave a game should be the window closing (and thus destroying the Game instance entirely, so not our problem) or the game timing out because the dealer program terminated.

Proposed changes:

  1. HandOver should transition to WaitingForTurn
  2. HandOver should not clean up or leave the game

This would make us compliant with requirement UITS-16

Test Strategies

The strategies each need to be tested with some basic tests, as some are not very difficult at all.

You should test each strategy with a single set of net::Game instances to try to provoke the correct reactions from all of them (i.e. have an array of net::Games which you will feed to each strategy, and then test each strategy against all of them).

ManualStrategy

Every game instance should receive a net::Action::idle

RecklessStrategy

Every game instance should receive a net::Action::hit in return

ConservativeStrategy

Only when a game state might bust should you receive a net::Action::stand in return; otherwise, you should always expect a net::Action::hit

BasicStrategy

You should try to provoke all of the behaviours via the game states, but this will most certainly be the hardest one to test.

Create Network Manager

The network manager should manage all of the inbound events and fire off their corresponding callbacks (#3), as well as queue up outbound events (#4) for sending.

There should be a separate thread which will send the queued data over the opensplice network.

The queue data should be wrapped behind a mutex which will prevent the two threads from screwing with the list at the same time

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.