6 kyu

Good vs Evil

9,982 of 27,356Frzy

Description:

Description

Middle Earth is about to go to war. The forces of good will have many battles with the forces of evil. Different races will certainly be involved. Each race has a certain worth when battling against others. On the side of good we have the following races, with their associated worth:

  • Hobbits: 1
  • Men: 2
  • Elves: 3
  • Dwarves: 3
  • Eagles: 4
  • Wizards: 10

On the side of evil we have:

  • Orcs: 1
  • Men: 2
  • Wargs: 2
  • Goblins: 2
  • Uruk Hai: 3
  • Trolls: 5
  • Wizards: 10

Although weather, location, supplies and valor play a part in any battle, if you add up the worth of the side of good and compare it with the worth of the side of evil, the side with the larger worth will tend to win.

Thus, given the count of each of the races on the side of good, followed by the count of each of the races on the side of evil, determine which side wins.

Input:

The function will be given two parameters. Each parameter will be a string of multiple integers separated by a single space. Each string will contain the count of each race on the side of good and evil.

The first parameter will contain the count of each race on the side of good in the following order:

  • Hobbits, Men, Elves, Dwarves, Eagles, Wizards.

The second parameter will contain the count of each race on the side of evil in the following order:

  • Orcs, Men, Wargs, Goblins, Uruk Hai, Trolls, Wizards.

All values are non-negative integers. The resulting sum of the worth for each side will not exceed the limit of a 32-bit integer.

Output:

Return "Battle Result: Good triumphs over Evil" if good wins, "Battle Result: Evil eradicates all trace of Good" if evil wins, or "Battle Result: No victor on this battle field" if it ends in a tie.

Algorithms

More By Author:

Check out these other kata created by Frzy

Stats:

CreatedNov 3, 2013
PublishedNov 3, 2013
Warriors Trained60331
Total Skips10915
Total Code Submissions139440
Total Times Completed27356
JavaScript Completions9982
Python Completions9123
Ruby Completions1520
C# Completions3019
Swift Completions1029
Rust Completions1312
Java Completions1662
Scala Completions36
Lua Completions26
Total Stars895
% of votes with a positive feedback rating89% of 3156
Total "Very Satisfied" Votes2564
Total "Somewhat Satisfied" Votes492
Total "Not Satisfied" Votes100
Ad
Contributors
  • Frzy Avatar
  • jhoffner Avatar
  • floum Avatar
  • m-casey Avatar
  • natan Avatar
  • TehCupcakes Avatar
  • AngusJGoldsmith Avatar
  • anter69 Avatar
  • Chrono79 Avatar
  • naithar Avatar
  • maruru Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • WestwardLand968 Avatar
  • lxixl Avatar
  • KayleighWasTaken Avatar
  • PetitLu117 Avatar
  • estem8 Avatar
  • danik00111 Avatar
Ad