How to optimize a strategy for a simultaneous move game in excel - excel

Good day,
As homework ive got to create a strategy in excel, that will be put up against the strategies of others. It is applied to a game that works as follows;
Two strategies are put up against each other
You have the option to put a coin in an envelope.
If you put a coin in your score drops by 1.
If you dont put a coin in your score remains the same.
The players make their decisions simltaneously then you swap envelopes with the opponent.
If you dont get a coin in the envelope you get 0.
If there is a coin in the envelope you get 2. Meaning, if you didnt put one in and there is a coin, you get plus 2, and if you did you and you get a coin your score changes by plus 1.
If no one puts a coin in ,the score doesnt change so plus 0.
If you put one in and the opponent didn't your score decreases by 1.
The game is to be played for 10000 rounds, with the objective to
maximize your own profit and minimize the profit of the opponent.
I have added an image of my work so far, my tracked score is currently higher, than that of a randomized opponent, yet i remain curious, wether someone can beat my strategy or if anyone has any ideas for optimization.
thanks in advance
What I tried first was to cooperate in the first round, after which i decided to copy the move of the opponent in the previous round for 5 rounods. Then I started with the thought of, he gave one in the first round and the sum of his past 5 rounds where bigger than 2 , he decided to cooperate, so we give one, otherwise we dont. Then until the end i procede with:
=IF(AND(B10=1;SUM(B6:B10)>2);1;IF(AND(SUM(D9:D10)=0;SUM(B4:B8)>2);1;0))
so if he gave one in the previous round and the sum of his past 5 rounds are is bigger than two we give one, if not the we see if i did not give twice in a row because he did not give enough( for five rounds > 2) then we give one, otherwise we give 0.
Here is the code for the scoring that i used.
=IF(AND(A2=C2;SUM(A2:C2)=2);1;IF(AND(A2=0;C2=1);2;IF(AND(C2=0;A2=1);-1;0))
The tracked score consists of the sum, of the previous rounds and the current round.
I expect to profit more than the opponent, but so far the opponent has only been a random number generator , and would like some help with improving the strategy.

Related

Generate permutations

I have n players to assign to n games. 10 <= n <= 20. Each player can sign up for up to 3 games but will only get one. Different players have different score for each game they sign up for.
Example with 10 players:
It's always possible to assign players x to game x but it will not always give the highest score in total.
My goal is to get as high score as possible and I therefore want to test the different permutations. I could teoretically test all permutations and throw away the unfeasible ones but it will give me a hughe number of possibilities (n!).
Is it possible to reduce the problem with the sign up limit of max 3 games? Maybe this can be done more easily than my approach? Any thoughts?
I'm working in Excel VBA.
I hope you find this as interesting as I do ...
Sorry if you find this unclear! My question is if it's possible to generate a subset of all the permutations. More precise only the feasible ones (which are the ones without any zero score).
Well, just set this up in the solver using Linear Programming as you can see in the image. Have shown the formulae so you can build it as well, along with the solver settings.
Won't give the permutations, but does solve for the highest combination.
Edit, updated image... it now shows correct ranges for the calculations, after trying to make it fit a reasonable size...

Dynamic formula for calculating progress percentage towards a goal?

Super simple question, but I'm stumped. I'm trying to create a progress bar that shows the % towards a particular goal. This should be dynamic to show the progress even if your goal is negative.
For example, let's say your goal, as a call center manager, is to lower your call time averages to 20 minutes. The current call time average is 45 minutes.
So in this case, lower is better. If my actual values this week has been lowered to 30 minutes (from 45 minutes), so that should technically be 60% progress.
I'm using the following formulas:
for positive goals, progress = actual value / goal value
for negative goals, progress = [ABS(starting value - current value)]/(ABS(goal value - starting value)
In the example above, the formula for neg goals plugs in as follows:
ABS(45-30)/ABS(20-45) = 15/25 = 0.6 = 60%. So this makes sense to me.
But things get weird when I'm falling behind. Exmaple, my goal is to obtain 80 customers. I started with 50. However, I happened to lose a lot of them at once and now my current value is 5.
For positive goals, the formula gives progress = 5 / 80 = 0.063 = 6.3%.
But shouldn't this be negative? Like, I have dropped from my original starting value, so my progress cannot be positive. I am obviously missing something in this formula for positive goals, that is not letting me show a scenario where I have fallen really behind from my starting value.
I've scowered excel forums and other boards for someone with a similar question but I have yet to find something... any help pointing this guy in the right direction? I would super appreciate it.

Grab next same value in Excel/Google Sheets for RANK/MATCH formula

I have a list of players in Google Sheets that assigns them a rank based on wins, followed by some more match variables — standard stuff.
I then use the rank to order the players in a league table format.
However, when I have two more players with the same rank, I hit a problem. The easiest way to illustrate it is with a link to the spreadsheet. Left side is the data, right side is the outputted table:
https://docs.google.com/spreadsheets/d/1n05ETFfF01uCwp1Q88Z0Zi8XkH-dNm29Ocb6yVP84rU/edit?usp=sharing
My aim is:
To allow drawing players, and thus output:
1= Player 1
1= Player 2
3 Player 3
4 Player 4
But also to add players with a rank of 0 (already calculated) to the bottom of the list, in no particular order, but below those who have played.
May serve for ColumnM, but seems would require adjustments elsewhere:
=if(countif(I$2:I$8,I2)>1,IF((B2=0), 0, RANK(H2,$H$1:$H$531,0))&"=",IF((B2=0), 0, RANK(H2,$H$1:$H$531,0)))
You could reproduce your table (excluding the ranking) with this in N1:
=QUERY(A:G,"select * order by B desc, G desc",1)
and then in M2:
=ArrayFormula(IF(LEN(N2:N),(COUNTIF(S2:S,">"&S2:S)+1)&IF(COUNTIF(S2:S,S2:S)>1,"=",),))
Any kind of algorithm is going to hate ties. They will produce unpredictable results, logic errors.
So you might set up your ranking system to remove the ties. Possibly use the date they joined the league for tiebreaker, which would allow you to rank the players with no stats as well.
Make the rules known to all players. E.g. 3 points for a win, 1 point for a tie, 0 for a loss, tie goes to the player with highest total points scored. If still tied, it goes to player in the league longer. The likelihood of established players getting to the join-date tiebreaker should be as remote as you can make it, so your first tiebreaker should be one that produces a lot of diverse answers.
Also, I am not sure, but I think the reason your question got downvoted was because a) it's a bit vague, and b) in this day and age, you really don't want to be opening data files from unknown people. A snapshot of data from your spreadsheet might have been a better illustration than a link to it. I know I will not open your sheet...I don't know you.

1X2 formula using IF & AND nesting in Open Office Calc for football world cup?

It is FIFA world cup time and need some help with my spread sheet project.
We have betting of every game result. Every guy/grl in our betting pool gets points as followed:
1 point for guessing home score right
1 point for guessing away score right
1 point for guessinf winner (1X2) right.
Every guy/grl has his/her own tab in the spreadsheet in which their betting (scores) are inserted in rows like
1-0
1-1
2-4
3-2 ect...
There is one tab to which I enter the actual score as the games are played. These are the real score from which the "logic" checks that how player should be awarded with points.
After hours of inconclusive thinking my question is that how can I make formula that gives me one (1) point, if player guesses the winner corectly (home wins, away wins or the game is tie)?
I already have have system, where I get point for guessing score correctly (if u guess home goals = 1 point and away goals = 1 point, i use formula =IF(EXACT(D2;REALFOOTBALLSCORE.D4);1;0)), but I need one for telling me, that am I rewarded one point for guessing the winner (1X2) or not. I think that in case to do so, I need to play with IF AND nesting. So simplified: what formula tells me that did I guess the winner (1X2) correctly?
Result can also be TRUE or FALSE. The only important thing is, that I get an result of that will I get that one point for 1X2 or not. I use SUM to calculate all points together. It doesn't need to look cool. I hide all the numbers to bottom of the document, where nobody can see them.
Cheers!
I used this formula which also accounts for correctly forecasting a draw as a point:
=IF(OR(Results!F7="",Results!G7=""),"",IF(F7=Results!F7,1,0)+IF(G7=Results!G7,1,0)+IF(OR(AND(F7>G7,Results!F7>Results!G7),AND(F7<G7,Results!F7<Results!G7),AND(F7=G7,Results!F7=Results!G7)),1,0))
I actually built a version that you might find helpful as a starter:
http://we.tl/vHn90XwBTi
You'll need to figure out what you want to do for the knockout stages. If you're only focused on 90min results, just fill down for the remaining fixtures.
Enjoy the world cup!
Basil

How do you calculate the probability of getting 1 new customer out of X using Excel?

How do you calculate the probability of getting 1 new customer out of X. I am expecting to come up with 2,3,4...10. I have tried using the probability function, but it doesn't seem to like what I am using for parameters.
=BINOM.DIST(1,500,1/500,TRUE)
I don't know in what sense this "doesn't work". Excel is returning exactly what you asked for: the cumulative probability of 1 success out of 500 trials where the probability of success is 1/500 in each independent trial.
Instead of looking at the cumulative distribution, though, consider each possible number of successes separately:
If the probability of getting a customer is 1/500, then if you ask 500 people, there is a 36.8% chance that you will get zero customers. There is also a 36.8% chance that you'll get one new customer, for a cumulative probability of 73.6%. There is a 99.6% chance that you will get 4 or fewer new customers from 500 tries.
To be clear, the formula for the "Prob" column is
=BINOM.DIST(cell_with_success_number,500,1/500,0)
The correct syntax is:
BINOM.DIST(number_s,trials,probability_s,cumulative)
Number_s The number of successes in trials.
Trials The number of independent trials.
Probability_s The probability of success on each trial.
Cumulative A logical value that determines the form of the function. If cumulative is TRUE, then BINOM.DIST returns the
cumulative distribution function, which is the probability that there
are at most number_s successes; if FALSE, it returns the probability
mass function, which is the probability that there are number_s
successes.
http://office.microsoft.com/en-us/excel-help/binom-dist-function-HP010335671.aspx
It returns a probability (0< X<1), so a value between 0 and 1. Note that "Probability of success in each trial" is asking what the chances are of getting a new customer EACH time you call (one trial). By entering 1/500, it appears you are assuming a probability of 0.002 for each trial. The resulting answer of 0.736 indicates you have a 73.6% chance of getting 1 new client for each 500 calls, or "trials".
Do you have a number you can enter based on your past experience calling leads?

Resources