![]() |
Este artigo precisa ser traduzido! |
Some units travel faster than others overland. A mixed group of units or ships travels at the speed of the slowest member. Gyrocopters are the fastest unit.
Ships have different speeds, too. Warships are slower than Cargo Ships.
Predefinição:See also
Travel time formula[]
There is a simple formula for the travel time. Travel time, in minutes, is:
Cargo Ships[]
The speed of Cargo Ships is 60, so this simplifies to:
Examples[]
- If you're going from 30:30 to 31:30 (Straight line)
- = =
20 minutes
.
- = =
- If you're going from 30:30 to 31:31 (Diagonal)
- = = =
28.28 min ≈ 28 minutes 17 seconds
.
- = = =
Note: A distance of zero, the towns are on the same island, is treated as a distance of = 10 minutes
.
C/C++ code[]
#include <cmath>
#include <iostream>
float distance(
int speed /*Speed of unit*/,
int x1 /*Island 1 X*/,
int x2 /*Island 1 Y*/,
int y1 /*Island 2 X*/,
int y2 /*Island 2 Y*/,
int &D /*Days*/,
int &H /*Hours */,
int &M /*Minutes */,
int &S /*Seconds*/,
bool &Spy /*Spy*/)
{
float time = 0;
bool same_island = false;
if(x1 == y1 && x2 == y2) {
time=1200/speed*0.5;
same_island = true;
}
else {
time = 1200/speed*sqrt( pow((y1-x1),2)+pow((y2-x2),2));
same_island = false;
}
double fractpart, intpart;
fractpart = modf (time , &intpart);
int m = intpart;
int s = fractpart*60;
int h = 0;
int d = 0;
if(m>=60) {
h=m/60;
m=m%60;
}
if(h>=24){
d=h/24;
h=h%24;
}
D=d;
H=h;
if(m<=5 && Spy == true ) {
M=5;
S=0;
}
else {
M=m;
S=s;
}
return time;
}
int main(int argc, char **argv)
{
int d_s,h_s,m_s,s_s;
bool spy = false;
// Normal Cargo:
std::cout << "Normal Cargo:" << std::endl;
distance(60,55,45,45,55,d_s,h_s,m_s,s_s,spy);
std::cout << "Time: " << d_s << "d " << h_s << "h " << m_s << "m " << s_s << "s" << std::endl;
//Spy
spy = true;
std::cout << "Spy:" << std::endl;
distance(240,55,45,45,55,d_s,h_s,m_s,s_s,spy);
std::cout << "Time: " << d_s << "d " << h_s << "h " << m_s << "m " << s_s << "s" << std::endl;
//Paddle-Wheel-Ram, Ram-Ship, Ballista Ship, Catapult Ship
spy = false;
std::cout << "Paddle-Wheel-Ram, Ram-Ship, Ballista Ship, Catapult Ship:" << std::endl;
distance(30,55,45,45,55,d_s,h_s,m_s,s_s,spy);
std::cout << "Time: " << d_s << "d " << h_s << "h " << m_s << "m " << s_s << "s" << std::endl;
//Fire Ship, Diving Boat
std::cout << "Fire Ship, Diving Boat:" << std::endl;
distance(40,55,45,45,55,d_s,h_s,m_s,s_s,spy);
std::cout << "Time: " << d_s << "d " << h_s << "h " << m_s << "m " << s_s << "s" << std::endl;
//Mortar Ship
std::cout << "Mortar Ship:" << std::endl
distance(20,55,45,45,55,d_s,h_s,m_s,s_s,spy);
std::cout << "Time: " << d_s << "d " << h_s << "h " << m_s << "m " << s_s << "s" << std::endl;
return 0;
}
Time to reach a city on the same island[]
![]() minutes |
Unit |
---|---|
7.5 | Gyrocopter |
10 | Doctor |
Archer | |
Hoplite | |
Slinger | |
Spearman | |
Sulphur Carabineer | |
Swordsman | |
15 | Catapult |
Cook | |
Mortar | |
Ram | |
Steam Giant | |
30 | Balloon-Bombardier |
![]() minutes |
Unit |