[Freeciv-Dev] [bug #18346] Start position allocation not deterministic

2011-08-21 Thread Jacob Nevins

Update of bug #18346 (project freeciv):

  Status:  Ready For Test => Duplicate  
 Open/Closed:Open => Closed 


___

Reply to this item at:

  

___
  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] [bug #18346] Start position allocation not deterministic

2011-08-19 Thread Jacob Nevins

Update of bug #18346 (project freeciv):

  Status:None => Ready For Test 
 Assigned to:None => jtn

___

Follow-up Comment #3:

Attached an S2_3 based version of the trunk patch (there was a minor conflict
but it was trivial to resolve).
I intend to commit this soon (if you don't get there first).

(file #13933)
___

Additional Item Attachment:

File name: S2_3-TileHashKey.diff  Size:2 KB


___

Reply to this item at:

  

___
  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] [bug #18346] Start position allocation not deterministic

2011-07-14 Thread Jacob Nevins

Follow-up Comment #2, bug #18346 (project freeciv):

Ah, yes. Bug #13679. Thought this sounded familiar...

___

Reply to this item at:

  

___
  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] [bug #18346] Start position allocation not deterministic

2011-07-13 Thread Marko Lindqvist

Update of bug #18346 (project freeciv):

 Planned Release: => 2.3.1  


___

Reply to this item at:

  

___
  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] [bug #18346] Start position allocation not deterministic

2011-07-13 Thread Marko Lindqvist

Follow-up Comment #1, bug #18346 (project freeciv):

It seems I fixed this only after S2_3 was branched and this was fixed in
trunk only, not in "stable" branch. See tile_hash_key() in trunk.

If it was fixed in trunk only, maybe we can consider backporting it to S2_3
*now* that it has been in trunk for a long time without causing any problems?

___

Reply to this item at:

  

___
  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] [bug #18346] Start position allocation not deterministic

2011-07-13 Thread Jacob Nevins

URL:
  

 Summary: Start position allocation not deterministic
 Project: Freeciv
Submitted by: jtn
Submitted on: Thu Jul 14 00:41:04 2011
Category: general
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_3 r19940
 Discussion Lock: Any
Operating System: None
 Planned Release: 

___

Details:

Discovered during autogame testing of bug #17962:

For autogames that should have been identical, I was seeing the assignment of
nations to start positions differ. The set of nations and leaders was the
same, as was the set of start positions on the map, it was just the assignment
of one to the other that was perturbed (which went on to change the whole
course of the game).

I think the problem lies in init_new_game(). This pulls start positions out
of a hash (map.startpos_table) into several lists
(flexible_list/targeted_list), which are then shuffled to get the mappings.

The shuffling is deterministic, as you'd expect from fc_rand(). However, I
don't think the order in which map positions are pulled out of the hash is.
The hash is a genhash which I think uses genhash_ptr_val_func() as its
comparison function, which uses pointer comparisons. This relies on things
like heap allocation being deterministic, which I don't think we can rely on.

However, in practice, on my system, the ordering seems _quite_ deterministic,
not completely random.

Iterating the hash in some deterministic order, or sorting the lists before
shuffling, would solve this, I think.

(Wonder how many other dependencies on pointer order we have...)




___

Reply to this item at:

  

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


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