Programming a simple calulation program

Stildawn

New Member
Hi All

I have no skills lol. Im just wondering if anyone here knows... How hard it would be to make a simple small program... That lets you insert some values and then calculate a result?

Im after something that could be used as a battle calculator (sorta like what all the Civilization games use for there combat)

So for example, you would have two sides on the conflict... On each side you would have some fields for different types of units etc (archers, infantry etc etc) and then when you press calculate... It would take those values... And using a random dice roll calculate the results of the combat... Giving the victor and deaths etc...

Any idea how hard this would be? Could it possibly be made in excel even? Is there a random number generator in excel?

Thanks
 

Feuerfrei.x

New Member
Hi All

I have no skills lol. Im just wondering if anyone here knows... How hard it would be to make a simple small program... That lets you insert some values and then calculate a result?

Im after something that could be used as a battle calculator (sorta like what all the Civilization games use for there combat)

So for example, you would have two sides on the conflict... On each side you would have some fields for different types of units etc (archers, infantry etc etc) and then when you press calculate... It would take those values... And using a random dice roll calculate the results of the combat... Giving the victor and deaths etc...


Any idea how hard this would be? Could it possibly be made in excel even? Is there a random number generator in excel?

Thanks

i know there is a random number generator in excel somewhere i just dont know the code xD

im confused of what you are asking in all the bits i made bold do you mean like a calculator? if so then yes - that is easy - u can create that on c# very easily (you probably will be able on other languages - but i know NOTHING about them xD)
 

Dropkickmurphys

New Member
So you would give all of the units values? I too am a bit confused as to how you want to go about doing this.

If you have no programming experience you can probably do it in excel.

In excel you can use =RAND() to create a random number between 0 and 1, or =RAND()*100 will give you a higher range, or =RANDBETWEEN([no],[no]) will create a random number between 2 numbers.

=RANDBETWEEN(1,6) would simulate a dice roll.
 

Stildawn

New Member
Ok heres my idea in detail...

Something like:

Side 1:
Infantry: 5 strength, 5 defence [put numbers here]
Archers: 6 strength, 2 defence [put numbers here]
Cavalry: 8 strength, 3 defence [put numbers here]

Side 2:
Infantry: 5 strength, 5 defence [put numbers here]
Archers: 6 strength, 2 defence [put numbers here]
Cavalry: 8 strength, 3 defence [put numbers here]

And when you press calculate... It would work out the total strength and defence etc then give each side a random number that will modify their results... Which will then give a battle result etc... Something like this... I havent fully thought it out yet just wondering if its that hard to do?
 

ErikAlbert

New Member
This might be possible with MS Excel.
You don't need to press calculate, MS Excel calculates immediately after each number you entered.
It's a matter of finding the right formulas you need to do this. Excel has lots of formulas for numbers, text, dates, times, etc.
If I knew exactly what you want, I would give it a try.
 
Last edited:

Stildawn

New Member
Yeah I think with the random formula I should be able to work out something..

Just one more question... Any ideas on how I could incorporate the ranged ability of archers? But make them useless once engaged in melee?
 

ErikAlbert

New Member
Yeah I think with the random formula I should be able to work out something..

Just one more question... Any ideas on how I could incorporate the ranged ability of archers? But make them useless once engaged in melee?
I have no clue what you are talking about. Can't you work with examples ?

A ranged archer ?
Several archers in a row, shooting simultaneously

Is this a archer ?
Somebody who fights with bow and arrows, sort of mix of Rambo and Robin Hood

Is this a melee ?
http://en.wikipedia.org/wiki/Melee
A disorganized group of archers, fighting together with none-archers against the enemy.
 
Last edited:

Stildawn

New Member
Yeah archer fires arrows over the armies head... (yes like robin hood lol)

Melee is attacking with swords n stuff.. Close quarters hand to hand fighting etc.

One more excel question...

Anyone know a command to do this:
If result is a negative display a word (e.g fail) if a result is positive display a word (eg pass)

Etc.

Cheers
 

ErikAlbert

New Member
Yeah archer fires arrows over the armies head... (yes like robin hood lol)
If result is a negative display a word (e.g fail) if a result is positive display a word (eg pass)
Cheers
Yes that is possible Excel has a formula for this, but I need some time to look it up.

Cell A1 contains a negative number (-5) or a positive number (7), you have typed in cell A1

Cell B1 contains this formula: =IF(A1<0;"fail";"pass") type this formula in cell B1

The formula must be entered exactly as I typed.
If it doesn't work, it means your Excel uses a comma as formula-separator, in that case replace ; by ,
Let me know if you used ; or , as formula-separator, so I can write valid formulas for you next time.
 
Last edited:

ErikAlbert

New Member
Any idea how hard this would be? Could it possibly be made in excel even? Is there a random number generator in excel?
Thanks
Yes there is random-formula in Excel

=RAND() ---> calculates a random number between 0 and 1
=RAND()*100 ---> calculates a random number between 0 and 100
=RAND()*(1000-1)+1 ---> calculates a real number between 1 and 1000
this explains a real number pffft : http://en.wikipedia.org/wiki/Real_number

Use always the key F9 to calculate a random number
Keep in mind that you can build very complex formulas, by combining different basic-formulas, it's like algebra.

If you still have any questions feel free to ask, maybe I'm able to answer it or not ;)
 
Last edited:
Top