Implementing Betting for a Poker Game [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am currently writing a Texas Hold'Em style Poker game that I would like both humans and computers alike to be able to play. However, I am hung up on how to implement the betting rounds. Currently I have a PokerGame class which consists of the community cards, the size of the pot, a List of PokerPlayers and a few other things. How would I implement a method that "asks" each player (I can't take input because it might just be a computer) whether they want to call, raise, etc? Originally I though I might just implement a server or possibly multithreading, but that seems way to complex. Currently my only though is setting up some sort of input stream between the game and each player in the game.

Write subclasses HumanPokerPlayer and ComputerPokerPlayer. Have PokerPlayer provide an abstract method placeBet() and override it appropriately for the human and the computer class.

Related

How can I know which days are occupied in my hotel management system? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 15 hours ago.
Improve this question
I'm a rookie and I've been tasked with creating a hotel manager for a course I'm doing. Nothing too fancy, just some application which is handled by a receptionist and is never used by the customer. It goes like this. Some customer calls the hotel and asks the receptionist: "Hey, is there any single room available from Friday 12th to Thursday 18th?" And the receptionist checks it and makes the reservations if everything is ok.
This other question (Enter an array of objects into an Arraylist of objects and change attribute) is alike, but I'd wish for that variable "Occupied" or another Boolean variable called "Reserved" to be present every day it's reserved. Thank you in advance.

Is it better to reuse the same instance of awt.Graphics than to create copies with Graphics.create()? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I got involved with some folks making a new 2D game engine in Java, and I got curious when I learned they avoided using any variation of Graphics.create in their engine's code.
When asked, they said they feared making copies of Graphics for every graphical component seemed like "(...)quite some amount of overhead."
But they could not provide any proof of the claim. Instead of making use of the clipRect and translation properties of Graphics, they instead provide their own support API for drawing in the right place.
I'm not a part of their team, but I do use their unfinished engine in my own project, so I want to find out.
Looking for an answer myself resulted only in a brick wall. The Graphics class is abstract, and I have so far not found any implementation code. So I can't find the answer.
And so I end up asking here.
What performance/memory cost if any, is there for using the Graphics.create() function?

I'm new at programming. I'm not sure how much to use methods [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So, I just finished my first program, but I haven't use any methods in it, since I'm just beginning to learn how to use them. Here's the original code : http://codepad.org/JiBfJI8Q I started to fractionate it but realised that it would be a method inside another all the way down. Is that actually the way to do it, or did I get the idea wrong?
without having looked at your code:
The general idea of methods is to separate small
portions of code which might be used at multiple other places in your code.
so yes, calling methods from within other methods is a good thing to do.
ideally your so called "composed methods" read out like a little story:
public void transaction(){
openDatabaseConnection();
addRecordsToDatabase();
closeDataseConnection();
}

Teaching the computer to play texas Hold'em poker [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a beginner in Java and programming but I'm already creating a Texas Hold'em Poker game as a "practice and learn" project.
I know the rules of the game, but I'm not sure how to include bots or computer player that can decide when to go in and when to quit, how much to bet (including All-in bet),and if possible even to bluff from time to time.
At this point my question is:
Should I take an effort to "explain with if's and then's, when to do that or is there an algorithm that allows the bot player to do that?
If it exists, would that algorithm be specific for poker or is possible to reuse it to any game to allow the computer to "learn" the rules described in the programming, for different rules or even different games (so it applies to chess or monopoly, etc)?
The complexity and state space of the Poker is not large. Therefore it is possible to just exhaustively search all the combinations. In fact you can even calculate the probability of getting each cards with some arithmetic. I would recommend you to read Poker Theory and Analytics by Kevin Desmond on MIT Open Courseware to understand more.
Your idea is exactly what decision trees or random forests are. They are machine learning techniques that can build human-understandable rules with a tree of if-s.
On the other hand, there are also non-human-understandable machine learning. Neural network is a kind of that. The models are non-intuitive to human. They are mainly used for the problems that are hard to formulate or with extremely large state space, for example, playing Go (just like AlphaGo), identifying all the objects in an image, or how to win Starcraft.

How to approach probability type of programming challenge? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
You're dealt 17 cards from a 52-card deck. On average, what is the longest straight flush you will have in your hand?
A straight flush is a set of cards that are consecutive, and also of the same suit. 2 is low, Ace is high, and you cannot wrap around. Do not solve this mathematically — create a program that approximates this.
I'm not able to think about the correct approach for this type of question. Is there any type of algorithm I have to apply?
This is an example of what's called a "Monte Carlo" program, after the casino resort. The idea is to just try a random process a whole bunch of times and look at the statistics.
Basically, you should write a program that deals 17 cards from the deck and counts the longest straight flush. Then you call that a lot of times (maybe 10,000 or 100,000) and take the average.

Categories