Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace MafiaBoss
- {
- class MustacheGirl
- {
- 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 (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();
- }
- static void Main(string[] args)
- {
- IDictionary<int, int> results = new Dictionary<int, int>();
- rnd = new Random();
- for (int i = 0; i < 10000000; i++)
- {
- int cherries = 1;
- bool hasBubble = true;
- mode = -1;
- //Mode A
- advanceMode();
- int bossHealth = 8;
- while (bossHealth > 0 || bossTurn == 0)
- {
- currentBossAttack = PullRandomBossAttack(5);
- if (currentBossAttack <= 1 && !hasBubble)
- {
- //Create Bubble
- hasBubble = true;
- cherries++;
- }
- else if (currentBossAttack == 2)
- {
- //Teleport Slap
- if (hasBubble)
- {
- hasBubble = false;
- bossHealth -= 2;
- }
- else
- bossHealth--;
- }
- else if (currentBossAttack == 3)
- {
- //Underground
- if (hasBubble)
- {
- hasBubble = false;
- bossHealth -= 2;
- }
- else
- bossHealth--;
- }
- else if (currentBossAttack == 4)
- {
- //Big Laser
- if (hasBubble)
- {
- hasBubble = false;
- bossHealth -= 2;
- }
- else
- bossHealth--;
- }
- else if (currentBossAttack == 5)
- {
- //Shock Waves
- if (hasBubble)
- {
- hasBubble = false;
- bossHealth -= 2;
- }
- else
- bossHealth--;
- }
- }
- if (!results.ContainsKey(cherries))
- results[cherries] = 1;
- else
- results[cherries]++;
- }
- foreach (KeyValuePair<int, int> kvp in results.OrderBy(x => x.Key))
- {
- Console.WriteLine("Cherries: {0} - {1}", kvp.Key, kvp.Value);
- }
- while (true) { }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment