[Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (setea
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8632 >
Your mcd (maximum common denominator?) function isn't good.
- I've always seen it called gcf, greatest common factor.
http://www.math.com/school/subject1/lessons/S1U3L2GL.html. But gcd
would also be okay.
- According to Euclid's Algorithm (Euclidean algorithm):
gcf(a, b) = gfc(b, a-b)
gcf(a, 0) = a.
which gives:
int gcf(int a, int b)
{
int min = MIN(a, b), max = MAX(a, b);
if (min == 0) return max;
return gcf(min, max - min);
}
Also...
INIT_TOPOLOGY_CASE shouldn't be a macro. In fact you don't need a
switch statement here at all. Make the list of default values an array
and just give something like
if (map.ratio == 100) {
set_ratio(default_ratio[map.topology_id]);
} else {
set_ratio(map.ratio);
}
Which brings me to my next point that auto_ratio and user_ratio should
be merged.
I haven't delved too deep into set_mapratio yet though.
jason
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), (continued)
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Jason Short, 2004/05/05
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/05
- [Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/05
- [Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/09
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/23
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Jason Short, 2004/05/23
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/24
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/25
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/26
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/26
- [Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (seteables if desired),
Jason Short <=
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/27
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/27
- [Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Jason Short, 2004/05/28
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/28
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Jason Short, 2004/05/28
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/28
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/28
- [Freeciv-Dev] (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Jason Short, 2004/05/28
- [Freeciv-Dev] Re: (PR#8632) Easy way to set map size with auto ratios (seteables if desired), Marcelo Burda, 2004/05/28
|
|