# Best Algorithm for attacking in the Risk Game

I apologize in advance for my English.I'll try to explain my problem. I am working on new version of the Risk game. I want to change the attacking algorithm to make it more similar to real life war. The sides which have more armies must have the advantage over the weaker side.

These are the original board game's rules below from Wikipedia:

Example of matching up attacking (red) and defending (white) dice; in this case the attacker has won the battle. When it's a player's turn to attack, he or she can only attack territories that are adjacent or connected by a sea-lane to his or her own territory. A battle's outcome is decided by rolling dice. The attacking player attacks with one, two, or three armies, rolling a corresponding one, two or three dice. At least one army must remain behind in the attacking territory not involved in the attack, as a territory may never be left unoccupied. Before the attacker rolls, the defender must choose to resist the attack with either one or two armies (using at most the number of armies currently occupying the defended territory[4]) by rolling one or two die. Each player's highest die are compared, as are their second-highest die (if both players roll more than one). In each comparison, the highest number wins. The defender wins in the event of a tie. With each dice comparison, the loser removes one army from his territory from the game board. Any extra dice are disregarded and do not affect the results.

I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side. I have to create the right balance between the two sides during the war.

Currently I am using the following algorithm

army1 = random.Next(1, 20 + (numberOfSolidersArmy1 / 5));
army2 = random.Next(1, 20 + (numberOfSolidersArmy2 / 5));


Then I am comparing army1 and army2 and decrease the number of soldiers by one of the smaller number's side.

What are your suggestions for a better algorithm?

• Questions here usually have a 'correct' answer, but I'm not sure if there is one here. Are you asking for how to improve your current algorithm? Or are you asking for another algorithm that better matches real life war? – Sprunth Jan 18 '12 at 1:51
• "I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side." Did you read the rules of Risk? They do have an advantage. Just not an overwhelming one. The reason being that Risk is a game, and if the attacker had even more of an advantage, then whoever won the first engagements, and thus got to build a few more troops, would quickly and easily win. Each victory would make the next that much easier. – Nicol Bolas Jan 18 '12 at 2:33
• In any case, your question as stated cannot be answered. The answer depends on what kind of play environment you want to create. Do you want an early victory to lead to steamrolling? Do you want the defenders to be able to have a chance? You say that you want to match real life more; do you intend to incorporate other factors (terrain, army composition, technology, scouting, etc), or is it just generic troops vs. generic troops? Without these details, there's no correct answer that can be suggested. – Nicol Bolas Jan 18 '12 at 2:35
• Welcome to the site! I'd like to point you at the faq, here: gamedev.stackexchange.com/faq While game design questions are completely within the scope of this site, they really need to drill down into specifics in order to try to present an objectively answerable question. As a general rule of thumb, questions asking for the "best" anything are a poor fit for our Q&A format. :) – Trevor Powell Jan 18 '12 at 2:54
• @Sprunth I am asking for another algorithm that better matches real life. – Farid Movsumov Jan 18 '12 at 13:11