Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string goodWin = "Battle Result: Good triumphs over Evil";
- string evilWin = "Battle Result: Evil eradicates all trace of Good";
- string noVictory = "Battle Result: No victor on this battle field";
- int[] goodRacePow = {1, 2, 3, 3, 4, 10};
- int[] evilRacePow = {1, 2, 2, 2, 3, 5, 10};
- string[] goodSplitSpaces = good.Split(' ');
- string[] evilSplitSpaces = evil.Split(' ');
- int[] convertedGoodArr = Array.ConvertAll<string, int>(goodSplitSpaces, int.Parse);
- int[] convertedEvilArr = Array.ConvertAll<string, int>(evilSplitSpaces, int.Parse);
- int goodPower = 0;
- int evilPower = 0;
- for (int i = 0; i < convertedGoodArr.Length; i++)
- {
- goodPower += convertedGoodArr[i] * goodRacePow[i];
- }
- for (int i = 0; i < convertedEvilArr.Length; i++)
- {
- evilPower += convertedEvilArr[i] * evilRacePow[i];
- }
- if (goodPower > evilPower)
- {
- return goodWin;
- }
- else if (goodPower == evilPower)
- {
- return noVictory;
- }
- else
- {
- return evilWin;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement