Jump to content
  • Advertisement
Sign in to follow this  

help with casino API

This topic is 3983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im writing this casino API for a project Im working on and Im kind of stuck. My original layout was nice, but because each table can be either a tournament or a cash game, and because Java doesnt allow multiple inheritance, I had to add all these classes and am now pretty confused. Here is a brief overview of my classes:
class Card
	Represents a basic playing card.  Is immutable and has a suit and value.

class CardList
	Represents a list of cards.  Has several functions represents different actions.  i.e. shuffle, draw.

class Deck extends CardList
	Represents a deck of cards.  Throws an exception if you try to look into a deck.  Keeps track of dealt cards also.  You can return all dealt cards to the deck.

class Random
	Random class for the casino.  Currently is just a wrapper for java.util.Random.

class Member
	Represents a member of the casino.  Keeps track of the total amount of money the player has, and what tables he is at.

abstract class Table
	Represents a casino game table.  Has an abstract run function which plays whatever game the table is for.  Has a set number of seats.

class Table.Seat
	Represents a table seat (obviously).  Stores the player sitting down (null for no player).  Also stores whether the player is sitting in or not, and is a node in two linked lists.  One is for players sitting down, the other is for players sitting in.

interface GameFactory
	Contains two functions for creating a new Player and a new Table.
abstract class Game
	Represents a casino game (e.g. tournament, cash game).  Members join games using the Game.join(Member) function.  The game handles table, seat, and stack assignment.

abstract class Game.Seat
	No clear representation.  Players can sit in/sit out/leave through the abstract functions in this class.  This class also keeps track of a players chipstack.

abstract class Player
	Represents a casino game player.  A new player is created whenever a member joins a game.
Originally GameFactory, Game, and Game.Seat didnt exist. I had to add them though to allow for tournaments. Im having a lot of trouble describing what exactly the problem is, and I cant figure out how to fix it... Does anyone have any comments on this? Im sure I did awful job of explaining my problem, so all the code is available here: http://www.kruskal.net/casino/casino.zip

Share this post

Link to post
Share on other sites
To be honest, I don't know how anyone can help you since you haven't asked a question or even hinted at what trouble you are having. "Here's what I have. I'm confused." isn't very revealing.

Share this post

Link to post
Share on other sites
yea my bad. I just need some help creating a qualitative outline for the API (i.e. the classes needed). Theres something wrong with my approach, Im just not sure exactly what it is or how to fix it..

Share this post

Link to post
Share on other sites
Well, there's nothing obviously wrong with what you've posted, as far as it goes. The real questions are:

Does it work for you?
Are there things about it that you are having to work around?

If you are having specific problems, then we can probably help you. If it's just a "what do you guys think of this" question, then I'd have to say see my first question above.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!