[Freeciv-Dev] [patch #4378] Minimize the gold clause when exchanging technologies

2014-05-12 Thread Marko Lindqvist
Update of patch #4378 (project freeciv):

 Assigned to:   cazfi = None   


___

Reply to this item at:

  http://gna.org/patch/?4378

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4378] Minimize the gold clause when exchanging technologies

2014-01-10 Thread Marko Lindqvist
Update of patch #4378 (project freeciv):

  Status:  Ready For Test = In Progress

___

Follow-up Comment #3:

../../../../src.patched/ai/default/advdiplomacy.c: In function 'dai_share':
../../../../src.patched/ai/default/advdiplomacy.c:1118:26: error: 'tech_p2'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
 dai_diplomacy_suggest(player1, player2, CLAUSE_ADVANCE, tech_p2);
  ^
../../../../src.patched/ai/default/advdiplomacy.c:1056:34: note: 'tech_p2' was
declared here
   Tech_type_id tech_p1 = A_NONE, tech_p2;
  ^
../../../../src.patched/ai/default/advdiplomacy.c:1112:40: error: 'best_diff'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
 if (tech_p1 != A_NONE  best_diff == 0) {
^
../../../../src.patched/ai/default/advdiplomacy.c:1055:7: note: 'best_diff'
was declared here
   int best_diff;
   ^


___

Reply to this item at:

  http://gna.org/patch/?4378

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4378] Minimize the gold clause when exchanging technologies

2014-01-02 Thread Marko Lindqvist
Follow-up Comment #1, patch #4378 (project freeciv):

Where is best_diff initialized before used first time in abs(diff) 
abs(best_diff) condition?

___

Reply to this item at:

  http://gna.org/patch/?4378

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4378] Minimize the gold clause when exchanging technologies

2014-01-02 Thread Guillaume Melquiond
Follow-up Comment #2, patch #4378 (project freeciv):

Good catch. It wasn't initialized on purpose (no sane default, except perhaps
the largest integer), but it was meant to be protected by a check on tech_p1,
which is initialized. The check somehow got lost when removing all the
debugging cruft to prepare the final version of the patch. Here is a corrected
version.

(file #19632)
___

Additional Item Attachment:

File name: tech_exchange.patchSize:2 KB


___

Reply to this item at:

  http://gna.org/patch/?4378

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4378] Minimize the gold clause when exchanging technologies

2013-12-31 Thread Guillaume Melquiond
URL:
  http://gna.org/patch/?4378

 Summary: Minimize the gold clause when exchanging
technologies
 Project: Freeciv
Submitted by: silene
Submitted on: Tue 31 Dec 2013 03:20:26 PM CET
Category: ai
Priority: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

In ai/default/advdiplomacy.c:suggest_tech_exchange, the AI computes how much
the technologies of both players are worth. It then suggests the first two
technologies such that the difference of their worth, once converted to gold,
can be paid by the players. Notice I just said first.

As a consequence, the AI sometimes suggests really dumb treaties. (No, I won't
pay 300 gold and one of my technologies, for some technology I can research in
just two turns! [1]) This patch alleviates the issue by not stopping at the
first two technologies. Instead, it suggests the technology exchange that
minimizes the gold clause.

That way, the subjectivity of how much a technology is worth as gold no longer
matters: the treaties seem much more sensible when the AI asks for tens of
gold only rather than hundreds.

And just so that there is no misunderstanding, I do not change the way
technologies are evaluated, just the way they are selected. For instance, if
only one treaty was possible before the patch, this is the treaty that will be
suggested after the patch.

[1] This may indicate a bug in the function used to evaluate how much the
technologies are worth. Still, I think the patch is relevant, even if this
hypothetical bug were to be fixed.



___

File Attachments:


---
Date: Tue 31 Dec 2013 03:20:26 PM CET  Name: tech_exchange.patch  Size: 2kB  
By: silene

http://gna.org/patch/download.php?file_id=19585

___

Reply to this item at:

  http://gna.org/patch/?4378

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev