Can we use Expectiminimax for the card game with 2 teams? - algorithm

I am going to implement Rang Card Game. it is played between 4 players with 2 on each team? The game will be played between 1 human and 3 ai agents. I want to ask is it possible to implement this game using Expectiminimax, if yes then are we going to put two players as max and the other two as min?

Related

how to create schedule of championship?

My english is not very well, but i try to explain.
I must create a schedule for championship. We have 8 players. They play in one league. THeir will be 7 tournaments played in cup system. So, every player will be play with every player, and it's not problem:
schedule
I want to every player when he goes to semifinals play with every player two times (assuming they get promoted to semifinals). So player number one must play ones in quaterfinal with player 2, and two times when he get promoted to semifinals.

Deconflict constrained N team schedule

I am writing a perl program to schedule N number of teams to play each other team once as home team and once as visitor. We use two fields and two time periods. So up to eight teams play in a day. No team can play at the same time on both fields or play twice in the same day. Any team not playing for the day is put on the BYE list.
I have written the code to define all the required games. But when I try to schedule each game and remove it from the array of games to be played, I arrive at conditions where there are no games left that can satisfy the rules for field or time periods in a day. This is most pronounced if I do not shuffle the array of games to be played. Even with 8 teams, I get these conflicts near the end.
What is the logic to deconflict the schedule sequence?
Do not simply create a list of all games and select from that at random: you need an algorithm to create the rounds - the circular method being the "standard" one (see for instance the link in the comment by #David Eisenstat).
Once you created the rounds you still have to define a calendar that will respect the limitation of 4 games per day (and no team playing more than once per day). This is straightforward: if one round fills exactly one or more days, i.e. if you have 8, 16, 24, ... teams, then you simply split each round in the requested number of days. But even if N is not a multiple of 8, there are no problems.
Lets' keep things simple, and consider the case of N = 12, so each round requires one day and a half: on day 1 you select (randomly) 4 of the 6 games of round 1; on day 2 you select the 2 missing games of round 1, and 2 games of round 2, taking care to avoid that the same team plays twice in a day; finally on day 3 you complete round 2, and so on. Can we be sure that we will always able to assign day 2 avoiding the duplication of a team? Yes, we can: when you assign the last two games from round 1, you have 4 teams affected; even if in round 2 there are no games between those 4, you only exclude 4 games from day 2, so you still have 2 games available for placement on that day.
Final notes: as you can see there's no need for a bye list. The only situation to deal with is when N is odd, and it is usually handled by adding a dummy team.
Regarding home vs visitors, you will need to repeat the full calendar a second time. Just note that it is not possible to have every team alternating between home and visitors at each round. For instance with 4 teams you may have TeamA (h) vs TeamB and TeamC (h) vs TeamD; at the second round you may still do TeamD (h) vs TeamA and TeamB (h) vs TeamC; but at the third round TeamA and TeamC must play each other, and both come from a visitor round. And the same hold for TeamB and TeamD, who both come from a home round.

Probability of getting a particular card in Poker

Suppose, I am playing a poker match. I have a pair of 5 in hand and see that the there is no 5 in the first 3 drawn cards. What is the probability that there will be at least one 5 in the next two cards.
My solution:
{P(5 in the fourth card and a different card in the fifth) = 2/47*45/46}+ {P(different card in fourth and 5 in the fifth)=45/47*2/46}+ {P(5 in both cards)=2/47*1/46}= 0.084
Is it correct? Does it depend on the number of opponents playing?

Complex pairing algorithm - team tournament

I would like to ask for help with an algorithm I’ve been working on for quite some time. I actually programmed it a few years ago using greedy pairing mostly but I’m not satisfied. Any help would be greatly appreciated!
So getting down to business. I have an application for tournament play (beachvolleyball to be precise, but should work for any pair-sport played in tournament format). The players show up on tournament day and gets randomly-ish put together with other participants and against other random teams. Top focus is to play as much as possible, however the number of players aren’t always divisible by the number of simultaneous playing spots. Therefor there will always be a number of players resting, standing the round out that is, and I’m trying to make sure this is as fair as possible by using 2 variables:
Rests (total number of rests during the day)
Rests in a row (Resting several games in a row, obviously)
The original concept of the tournament was mixing the teams with 1 male(m) and 1 female(f) in each team, playing against another team of m/f. However, the resting part is more important and there is often a lot more players of one sex than the other (i.e. 20 f and 7 m). Instead of letting the males play every single round, the program should make teams of f/f playing against f/f. Same-sex vs f/m should be avoided though.
Players should get new partners every round and play against new teams every round. Preferably you should play with all players of the opposite sex before playing with someone again. Players are allowed to come and leave as they like, and also take a break at any time (voluntary rest).
I’ve looked into the unstable marriage problem and the roommate problem, but my problem seems to be a mix of the two. Normally there will be two lists of players (m/f) and pairing, but under certain premises there should be teams made from just one list as described. Let me give you an example:
EXAMPLE:
43 players show up for a tournament with 6 courts.
17 Females (f) and 26 Males (m).
The 6 courts fit 12 teams with a total of 24 players per round.
Round 1
*12 m - 12 f*
*19 resting (5f, 14m)*
Round 2
5f and 14m have 1 rest and should play.
The best solution would be:
*4 f - 4 m*
*1f - 1m*
*4m - 4m*
*1f - 1m* (these players played last round as well).
In this example there will normally not be more than 1 rests in a row, if there woud’ve been 49 players from the start on the other hand..
In future updates, I’m also planning on letting the user choose number of players per team, and also to skip the m/f requisite.
Any thoughts?

Modified Blackjack so computer wins more than loses [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to create some sort of algorithm to make a computer win more than it loses at a modified game of blackjack.
Red cards will be negative, black cards were positive.
I will write it in pseudo code I want sure about the probability part in making the computer win more games (last line).
Here is my attempt:
//Hand out 2 random cards for each person selection of 2,3,4,5,6,7,8,9,J,Q,K,A.
//Store these in an array with their equivalent value.
Card =[2,3,4,5,6,7,8,9,J,Q,K,A]
Also, colour of card is random red or black.
Value_AI=0
Value_Human=0
Bust_Human=0
Bust_ AI=0
All of the below is in a big loop that loops each time a player is bust
Do this for both players, until Value_AI or Value_Human>21
If colour==red then
Value=value – card
Else
Value=value+card
If Value_AI >21 then
Bust_ AI+=1
Print “Computer has bust”
Break
If Value_Human >21
Bust_ human+=1
Print “You have bust”
Break
Else
Hand out another card for both
If Bust_ AI> Bust_ human then
**//Increase the probability of getting an ace and a card with a value of 10 for the computer**
You can make the human go before the computer. Then when they both would have busted, it will be a computer win by default because the computer won't need to go. That should change a fair game into one favoring the computer.
Right now, your pseudocode doesn't seem to include an option for either player to choose to stop receiving cards, which is the central choice to be made in Blackjack. After the newest card is received, you need to have the AI make a choice as to whether it wants another. This is probably the best point in the algorithm at which to build actual intelligence into your AI, so you can increase its probability of winning without just hard-coding wins like you suggest in your pseudocode. The simplest option is to have your AI calculate the probability that the next card will send its value over 21. Here's some pseudocode for that (it doesn't look like you remove cards from the deck after you draw them, so I'm not taking that into account):
highest_safe = 21 - value_AI
n_safe_cards = highest_safe - 1 + 13 //the second 13 is for all of the red cards and the - 1 is because 1 is not a card
prob_safe = n_safe_cards/26 //since there are 28 possible cards (I'm assuming you didn't mean to leave 10 off your list)
if prob_safe < .5:
stop taking cards
This should result in your AI winning more often than not, as it will result in it playing optimally. If you want it to be a little easier to beat, you can add some noise to the threshold at which it decides to stop taking cards.

Resources