Jump to content
  • Advertisement
Sign in to follow this  
Timtimtim

Combinations and permuations

This topic is 2833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!
I am making a castle defense style game, where are 2 castles. Player castle and enemy castle. There are 3 different units to hire:
Swordsman, archer, horserider.

The units have points:
Swordsman(1), archer(2.5), horserider(3).


Player has made archer and swordsman. Total 3.5 points.
The AI have to understand the serious of the threat. The higher the points the bigger is the threat.

Now the AI have to make some soldiers to defend itself. So it have to hire soldiers whose total points are little bit higher than player points. It have to make the table and watch witch combination gives result where the points are a little bit higher than player's soldier points amount.

Here's the table that helps to understand:

http://img34.imageshack.us/img34/9097/picyk.jpg


The problem is that player can make up to 5 soldiers whose maximum points can be 15.

This means that AI have to also make a decision where it's points are the same this means that the table can be like this:

005
050
500

400 4 swordsmen
040 4 archers
004 4 horses
104 1 swordsmen, 4 horses
014 1 archer, 4 horses
401 4 swordsmen, 1 horse
410 4 swordsmen, 1 archer

the combinations can also be:
212
302
221
113
etc etc


How to make this kind of tables?

Share this post


Link to post
Share on other sites
Advertisement
Why are you making a table in the first place? Why can't you just use the values of the units, the total value of the army and use that value to make decisions?

You're making this harder that it should be.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!