[Freeciv-Dev] Re: [Patch] CMA 1.0
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sat, Sep 22, 2001 at 05:17:13AM -0700, Raahul Kumar wrote:
> I've been reviewing your patches, both sma6.diff and
> cma1_0 diff. The cma1_0 diff is clearly
> missing a lot that was in your earlier patch.
Yes it is only the citizen managment agent.
> When is the rest of code going to be submitted?
If the CMA is in the code AND the other agents (goto and settler
management) have been updated and extended. For example the goto agent
will have to handle all unit types (air units with refilling,
trireme,...) and the settler management need a GUI interface.
> There is clearly a lot of server and client side
> duplication of code. So are both going to be
> kept or is the AI finally going to migrate only to the
> client side?
In the long term the server should contain no AI code. There are two
large problems with this:
- the client side ai code has to be at least as good as the server ai
code
- there has to be a mechanism on the server side which
spawns/activates a helper (gui-less) client
> After reading the below function:
>
> static int can_use_specialist(struct city *pcity,
> enum specialist_type specialist_type)
> {
> if (specialist_type == SP_ELVIS)
> return 1;
> if (pcity->size >= 5)
> return 1;
> return 0;
> }
>
> and optimize_people
>
> if (!can_use_specialist(pcity, SP_ELVIS)
> && extra_entertainers > 0)
>
> Shouldn't it just be (if extra_entertainers > 0)
> because it will always return one
> if the specialist is an elvis.
Mhh we have generality vs performance and clarity problem here.
> The problem with the below function
>
> apply_result_on_server
>
> is the pointless conversion of the entire population to entertainers
> before you can convert them to what is needed. Why was this
> necessary?
Else you will need much more complicated code. I haven't tried to code
it, it may turn out not very complicated. It may also reduce the
network usage.
> There is a lack of examples of how to code agents. An example with
> comments would be helpful.
The CMA is the example ;) As I wrote there isn't a hard interface. You
don't have to use client/agents/agents. But from writting the three
agents I come to some common code patterns.
> Ten is far too few for max agents.
This will be increased if we hit the limit.
> The function try_to_find_primary has the comment that calculation of
> upkeeps is not exact. Can you please explain, in great detail,
> exactly how you are calculating upkeep?
We were given a set of minimal surpluses we have to reach. We use
optimize_worker which takes a set of minimal production. We now have
to calculate the required minimal production from the minimal
surpluse. So we need some kind of measurement of the base production
which won't be available as surplus. These are the food and shield
upkeeps and the corruption. Since these values depend on the actual
production (which is unknown at this time) we have to estimate these
based on the current differnce between production and surplus.
ms - minimal surplus
mp - minimal production
u - upkeep or other factors which decrease the production, depends on the base
production
s - surplus
p - actual production
s = p - u(p)
-> mp = ms + u(mp)
Problem: we don't know mp yet
This is no real problem because we will just do a full calculation of
the city (in fill_out_result) and test afterwards if we got the
required surplus.
> Where is the code to handle diplomacy? Are you planning to add this
> at all or do you want contributions?
I don't will do anything related to diplomacy in next time.
> I am sorry for all the criticism. Now let me praise the code. It's
> very well written. Above all it has clarity. This is one small step
> for freeciv, but a gigantic leap for the AI code.
Thanks.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
(On the statement print "42 monkeys"+"1 snake"): BTW, both perl and Python
get this wrong. Perl gives 43 and Python gives "42 monkeys1 snake", when
the answer is clearly "41 monkeys and 1 fat snake".
-- Jim Fulton, 10 Aug 1999
- [Freeciv-Dev] [Patch] CMA 1.0, Raimar Falke, 2001/09/20
- [Freeciv-Dev] Re: [Patch] CMA 1.0, Andreas Kemnade, 2001/09/21
- [Freeciv-Dev] Re: [Patch] CMA 1.0, Gregory Berkolaiko, 2001/09/21
- [Freeciv-Dev] Re: [Patch] CMA 1.0, Raahul Kumar, 2001/09/22
- [Freeciv-Dev] Re: [Patch] CMA 1.0,
Raimar Falke <=
- [Freeciv-Dev] The AI Strikes Back: CMA 1.0, Raahul Kumar, 2001/09/22
- [Freeciv-Dev] Re: The AI Strikes Back: CMA 1.0, Raimar Falke, 2001/09/23
- [Freeciv-Dev] Re: The AI Strikes Back: CMA 1.0, Raahul Kumar, 2001/09/23
- [Freeciv-Dev] Re: The AI Strikes Back: CMA 1.0, Raahul Kumar, 2001/09/23
- [Freeciv-Dev] Re: The AI Strikes Back: CMA 1.0, Raimar Falke, 2001/09/23
[Freeciv-Dev] Re: [Patch] CMA 1.0, Raahul Kumar, 2001/09/22
|
|