[Freeciv-Dev] [patch #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-12 Thread Marko Lindqvist
Update of patch #3346 (project freeciv):

  Status:  Ready For Test = Done   
 Open/Closed:Open = Closed 


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-10 Thread Davide Baldini
Follow-up Comment #16, patch #3346 (project freeciv):

I'm so used to these server notifications that I haven't been able to pay much
attention to them and notice the incoherence.

The problem is solely the message text itself stating the game results in a
draw, as the ranklog is supposed to almost always set a winner. (The exception
is if game ends for /endgame or turn limit AND all players have the same
score, in which case there is no winner)

Fix attached.




(file #16683)
___

Additional Item Attachment:

File name: RankingFixes-3.patch   Size:8 KB


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-09 Thread Marko Lindqvist
Follow-up Comment #15, patch #3346 (project freeciv):

When I /endgame, client popup still says that game ended in draw. Ranklog file
has been written with me as winner.


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-07 Thread Marko Lindqvist
Follow-up Comment #13, patch #3346 (project freeciv):

- Removed math.h include from srv_main.c. Changes made to that file could no
way require it. Maybe it was leftover from some earlier experiment you did?

(file #16668)
___

Additional Item Attachment:

File name: RankingFixes-2.patch   Size:6 KB


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-05 Thread Marko Lindqvist
Update of patch #3346 (project freeciv):

 Planned Release:   2.5.0 = 2.4.0, 2.5.0   

___

Follow-up Comment #12:

Well, maybe being in right team is enough even if you die. After all, players
are not in teams by default, but they actually set up team setup so they would
win or lose together. This also allows one to sacrifice self for the team
(if that ever makes sense) and still to win as part of the team.

In attached patch just coding style corrections.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-10-05 Thread Marko Lindqvist
Additional Item Attachment, patch #3346 (project freeciv):

File name: RankingFixes.patch Size:7 KB


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-08-02 Thread David Lowe
Follow-up Comment #11, patch #3346 (project freeciv):

Oops, i hadn't considered that.  I guess things should stay as in comment #8.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-08-01 Thread Marko Lindqvist
Follow-up Comment #8, patch #3346 (project freeciv):

+  if (game.info.turn  game.server.end_turn)
+   /* endturn was reached - rank users based on team scores */
+   rank_users(TRUE);
+  else 
+   /* game ended for victory conditions - rank users based on survival */
+   rank_users(FALSE);
+} else if ((check_for_game_over()  game.info.turn 
game.server.end_turn)
+  || S_S_OVER == server_state()) {
+  /* game terminated by /endgame command - calculate team scores */
+  rank_users(TRUE);


CodingStyle: Even single lines after if require block:
if () {
...
} else {
...
}


It's not new with behavior with this patch, but I wonder if dead players
should be losers in all cases. Now they are marked as losers in first pass,
but later passes have no aliveness check before the turn players to winners.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-08-01 Thread David Lowe
Follow-up Comment #9, patch #3346 (project freeciv):

It's not new with behavior with this patch, but I wonder if dead players
should be losers in all cases. Now they are marked as losers in first pass,
but later passes have no aliveness check before the turn players to winners.

Right now, i can't think of an example of a dead player who might reasonably
have a higher score than the players who defeated it.  In that case, skipping
over dead players sounds like a good optimization.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-08-01 Thread Marko Lindqvist
Follow-up Comment #10, patch #3346 (project freeciv):

 Right now, i can't think of an example of a dead player who
 might reasonably have a higher score than the players who
 defeated it.

It's team score that's used here, not that of individual player - all members
of the winning team are declared winners.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-07-02 Thread Marko Lindqvist
Update of patch #3346 (project freeciv):

Category:None = general
Priority: 3 - Low = 5 - Normal 
  Status:None = Ready For Test 
 Assigned to:None = cazfi  
 Planned Release: = 2.5.0  


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-28 Thread Davide Baldini
Follow-up Comment #7, patch #3346 (project freeciv):

I revised the patch and made some improvements;

With the old scorelog file format, it was impossible to parse the scores by
simple means without a small probability to fail, since the log grouped
elements inside parenthesis, but parenthesis are also allowed to be used
inside playernames and usernames.
Instead, I group element by commas, which are forbidden in names.
Also, I fixed a glitch.

I tested this patch under any endgame condition: it produces correct output
for a regular game-over by conquest or spacerace, by reaching endturn , and by
/endgame.

The reference file is now score_system.rev1.diff.

(file #15919)
___

Additional Item Attachment:

File name: score_system.rev1.diff Size:6 KB


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Davide Baldini
URL:
  http://gna.org/patch/?3346

 Summary: Ranklog: add player's score to log -- rank even if
game ends for /endturn
 Project: Freeciv
Submitted by: davide_at_debian
Submitted on: Wed 27 Jun 2012 11:56:45 AM GMT
Category: None
Priority: 3 - Low
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

This patch adds the player's score to the ranklog file.
The current format of this file is:

  turns: n
  winners: rank_username (player_name,username),
  losers: rank_username (player_name,username),

with this patch it becomes:

  turns: n
  winners: rank_username (player_name,username,score),
  losers: rank_username (player_name,username,score),

Also, with this patch, the ranklog file is created even if the game ends
because of endturn is reached; in fact, this is the most common way to end a
game, in my multiplayer experience.
The command-line option --ranklog is still honoured: if it is not present, no
ranklog file is produced.




___

File Attachments:


---
Date: Wed 27 Jun 2012 11:56:45 AM GMT  Name: score.c.diff  Size: 2kB   By:
davide_at_debian

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

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Marko Lindqvist
Follow-up Comment #1, patch #3346 (project freeciv):

 Also, with this patch, the ranklog file is created even if the
 game ends because of endturn is reached

According to rules, player with highest score is the winner in that case. Your
patch does not seem to address that at all - it doesn't touch the code that
considers all alive players winners except in case of spacerace victory.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Davide Baldini
Follow-up Comment #2, patch #3346 (project freeciv):

When the game reaches the endturn limit, no ranklog file would be produced at
all. This patch is meant to always provide a score log when the game ends if
the --ranklog option is passed by the command-line. And, to ease post-game
parsing by script, it add the players' scores.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Marko Lindqvist
Follow-up Comment #3, patch #3346 (project freeciv):

Yes, but I think current version of your patch does not to produce *correct*
(in respect to winners/losers) ranklog in case of endturn.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Davide Baldini
Follow-up Comment #4, patch #3346 (project freeciv):

Thank you for pointing it out. I was solely concerned about logging the
scores, not the winners/losers classification. I just realized that in case of
/endturn all players would be considered winners, except for space victory.

___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Davide Baldini
Follow-up Comment #5, patch #3346 (project freeciv):

I redesigned the rank_users() function. Any ranking is now correct, after
_endturn_, too.
The attached patch to consider is now score_system.diff.

In the function, now I distinguish two conditions:
1) rank_users() is called the traditional way, when a game is over for space
race or conquest. I call this a victory condition;
2) the functions is called with a flag set, to identify that the game has been
interrupted some way, and no victory condition should be analyzed to rank
players (alive / space). This happens when endturn is reached, when /endgame
is issued, and, potentially, when just the parameter flag is set.

In case 2), victory and winners/losers sorting are determined as:
 
  For each team is calculated the sum of the scores of any
  belonging member which is alive and has not surrendered;
  all the players in the team with the highest sum of scores win.


To specify the first or the second method of calculation the prototype of the
function now is:
  void rank_users(bool interrupt);
* interrupt == FALSE: game ended because of explicit victory, use the
traditional calculation algorithm;
* interrupt == TRUE: game interrupted, calculate teams scores.

The only call to rank_users() in the whole server is done by
/server/srv_main.c::srv_running(). Here I adjusted the _interrupt_ flag.

Touched files are:
* server/score.h
* server/score.c
* server/srv_main.c

(file #15908)
___

Additional Item Attachment:

File name: score_system.diff  Size:6 KB


___

Reply to this item at:

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

___
  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 #3346] Ranklog: add player's score to log -- rank even if game ends for /endturn

2012-06-27 Thread Jacob Nevins
Follow-up Comment #6, patch #3346 (project freeciv):

 According to rules, player with highest score is the winner in 
 that case. Your patch does not seem to address that at all - it 
 doesn't touch the code that considers all alive players winners 
 except in case of spacerace victory.
Bug #18084 also complains of this.

___

Reply to this item at:

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

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


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