[Freeciv-Dev] Re: AI
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Sep 16, 2001 at 06:52:18PM -0700, Raahul Kumar wrote:
>
> --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > On Sun, Sep 16, 2001 at 04:21:47AM -0700, Raahul
> > Kumar wrote:
> >
> > > I noticed this. I sent some patches a long while
> > back to Thue trying
> > > to fix the movement code, because so much of the
> > code has majic
> > > numbers in it.
> >
> > Do you still want this? Do you have updated patched?
>
> The code was accepted some time ago. I haven't sent
> any new patches because I was beaten by the magic
> number problem. I'll probably return to it some day.
This would be nice. Note that we are currently two small steps from
the goal of a remove-all-magic-direction-numbers crusade.
> Incidentally I noticed a small mistake in the code. In
> the function below
>
> +static unsigned int cache2_hash_val_fn(const void
> *key,
> + unsigned int num_buckets)
> +{
> + const struct cache2_key *pkey = (const struct
> cache2_key *) key;
> + unsigned int result = 0;
> + int x, y;
> +
> + for (x = 0; x < CITY_MAP_SIZE; x++) {
> + for (y = 0; y < CITY_MAP_SIZE; y++) {
> + result |= (pkey->worker_positions_used[x][y] !=
> 0);
> + result = result << 1;
>
> you're still using for (x = 0; x < CITY_MAP_SIZE; x++)
> {
> + for (y = 0; y < CITY_MAP_SIZE; y++) {
> where everywhere else you seem to use city_map_iterate
Thanks for spotting this. Yes the code is a bit old and I was young
when I wrote this ;)
> > My current code is attached. It may no be properly
> > documented (but at
> > least I use longer variable names) and may also not
> > be apply cleanly
> > to a current cvs version. I hope to get this and
> > some futher agents
> > into the code. Any feedback is welcome. The citizen
> > management agent
> > (CMA) is the most debugged and documented piece of
> > code.
>
> Actually I wanted to congratulate you. Most of the AI code is
> impossible to follow, but I understood more of your AI code in 5
> mins of looking at it then I have of the freeciv AI code and I've
> spent at least a few weeks trying to understand it.
Thanks.
> Still, put more comments in please.
I plan to add a general overview. Please tell me what other places
needs clarification.
> > > I wanted to know if there are any existing ideas
> > about how to
> > > implement a better AI. With the diplomacy system
> > in place, we can
> > > finally have a competitive AI player. With the AI
> > trading techs and
> > > making alliances the human player will finally
> > have some difficulty
> > > beating the AI. With someone else hopefully
> > fixing the AI problems
> > > with handling planes and ships a competitive late
> > game AI could be
> > > here.
> >
> > I think that a ai which is good at diplomacy is much
> > more difficult
> > that an ai which handle the basic game mechanics
> > (tech tree
> > management, city management,..) right.
>
> I'm planning to start off small handling just trading
> techs with players not currently at war with you.
So you first have to teach the AI to not go at war with each player. I
think this task is not easy.
> I'm planning to have the AI by default share world maps.
Does this benefit the AI?
> I'm also going to solve the tribute problem, if you're much bigger
> than the AI it will offer up tribute.
>
> Incidentally, should I care about the civilisations perfectionist
> etc tags at all. It's not used anywhere in freeciv as far as I can
> tell.
What kind of tags are you talking about?
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Are you saying that you actually used the Classpath Java AWT classes in
addition to the GTK peers and got them to display something?
Wow. That's way better than I did and I wrote the code!"
-- Aaron M. Renn in the classpath mailing list
|
|