Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MafiaBoss
- {
- class Program
- {
- static List<int> currentBossAttacks;
- static int mode = -1;
- static int cycle = 0;
- static int bossTurn = -1;
- static int currentBossAttack = -1;
- static Random rnd;
- static bool IsBossAttackAllowed(int attackID, int indexInArray, int currentTurn)
- {
- if (mode == 0 && attackID != 0 && indexInArray == 0 && currentTurn == 0) return false;
- if (mode == 1 && attackID != 1 && indexInArray == 0 && currentTurn == 0) return false;
- if (currentBossAttack == attackID && indexInArray == 0) return false;
- return true;
- }
- static int PullRandomBossAttack(int maxAttackID)
- {
- if (currentBossAttacks.Count <= 0)
- {
- bossTurn++;
- List<int> potentialAttackIDs = new List<int>();
- for (int i = 0; i <= maxAttackID; i++)
- potentialAttackIDs.Add(i);
- while (potentialAttackIDs.Count > 0)
- {
- int i = rnd.Next(potentialAttackIDs.Count);
- if (!IsBossAttackAllowed(potentialAttackIDs[i], currentBossAttacks.Count, bossTurn)) continue;
- currentBossAttacks.Add(potentialAttackIDs[i]);
- potentialAttackIDs.RemoveAt(i);
- }
- }
- if (currentBossAttacks.Count <= 0) return -1;
- int firstAttack = currentBossAttacks[0];
- currentBossAttacks.RemoveAt(0);
- return firstAttack;
- }
- static void clearBossAttacksOnNewMode()
- {
- bossTurn = -1;
- currentBossAttack = -1;
- currentBossAttacks = new List<int>();
- }
- static void advanceMode()
- {
- mode++;
- cycle = 0;
- clearBossAttacksOnNewMode();
- }
- struct ResultIndex
- {
- public int beanbags;
- public int angeries;
- public ResultIndex(int b, int a)
- {
- beanbags = b;
- angeries = a;
- }
- }
- static void Main(string[] args)
- {
- IDictionary<ResultIndex, int> results = new Dictionary<ResultIndex, int>();
- rnd = new Random();
- for (int i = 0; i < 10000000; i++)
- {
- int beanbags = 0;
- int angeries = 0;
- mode = -1;
- //Mode A
- advanceMode();
- int bossHealth = 4;
- while (bossHealth > 0 || bossTurn == 0)
- {
- currentBossAttack = PullRandomBossAttack(3);
- if (currentBossAttack == 0)
- {
- //Spin
- bossHealth--;
- }
- else if (currentBossAttack == 1)
- {
- //Beanbags
- beanbags++;
- }
- else if (currentBossAttack == 2)
- {
- //Electric Strike
- bossHealth--;
- }
- else if (currentBossAttack == 3)
- {
- //Get Angry
- angeries++;
- }
- }
- //Mode B
- advanceMode();
- bossHealth = 2;
- while (bossHealth > 0 || bossTurn == 0)
- {
- currentBossAttack = PullRandomBossAttack(2);
- if (currentBossAttack == 0)
- {
- //Beanbags
- beanbags++;
- }
- else if (currentBossAttack == 1)
- {
- //Throw Cutters
- bossHealth--;
- }
- else if (currentBossAttack == 2)
- {
- //Get Angry
- angeries++;
- }
- }
- var resultIndex = new ResultIndex(beanbags, angeries);
- if (!results.ContainsKey(resultIndex))
- results[resultIndex] = 1;
- else
- results[resultIndex]++;
- }
- foreach (KeyValuePair<ResultIndex, int> kvp in results.OrderBy(x => x.Key.beanbags * 12 + x.Key.angeries * 3))
- {
- Console.WriteLine("Beanbags: {0}, Get Angry: {1} - {2}", kvp.Key.beanbags, kvp.Key.angeries, kvp.Value);
- }
- while (true) { }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment