Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/casern_workersqueue into lp:widelands

2016-11-09 Thread GunChleoc
Sorry, overlooked your comment -  think now that the UI change should go in 
before the merge, because the code changes for that will be rather big, and we 
should get a superclass for wares and workers queues.

For the documentation, see

https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/doc/sphinx/README

Best generate as HTML, so you won't need the website project to view.
-- 
https://code.launchpad.net/~widelands-dev/widelands/casern_workersqueue/+merge/309763
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/casern_workersqueue into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread toptopple
toptopple has proposed merging lp:~7010622-q/widelands/topple-seafaring-1 into 
lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436

Expedition strategy is quite weak at present, but I could improve it by 
providing a higher-quality random source (game().logic_rand()) and setting up 
for a more rational decision making when confronted with island-hit and 
port-spaces. The repetition of island-crusing (circle) has been minimized as AI 
can't afford the time. An additional criterion for ship-building is introduced: 
number of ships shall be at least the number of available ports of the player.

-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2016-11-03 07:20:57 +
+++ src/ai/defaultai.cc	2016-11-09 14:22:35 +
@@ -3556,10 +3556,13 @@
 	if (shipyards_count == 0 || !idle_shipyard_stocked || ports_count == 0) {
 		enough_ships = FleetStatus::kDoNothing;
 	} else if (allships.size() - expeditions_in_progress == 0) {
-		// We always need at least one ship in transport mode
+		// we always need at least one ship in transport mode
+		enough_ships = FleetStatus::kNeedShip;
+	} else if (int(allships.size()) - ports_count < 0) {
+		// we want at least as many ships as we have ports
 		enough_ships = FleetStatus::kNeedShip;
 	} else if (persistent_data->ships_utilization > 5000) {
-		// If ships utilization is too high
+		// if ships utilization is too high
 		enough_ships = FleetStatus::kNeedShip;
 	} else {
 		enough_ships = FleetStatus::kEnoughShips;
@@ -4689,7 +4692,7 @@
 
 	allships.push_back(ShipObserver());
 	allships.back().ship = &ship;
-	if (game().get_gametime() % 2 == 0) {
+	if (game().logic_rand() % 20 < 10) {
 		allships.back().island_circ_direction = IslandExploreDirection::kClockwise;
 	} else {
 		allships.back().island_circ_direction = IslandExploreDirection::kCounterClockwise;
@@ -4930,17 +4933,19 @@
 	return score;
 }
 
+
 // this is called whenever ship received a notification that requires
 // navigation decisions (these notifiation are processes not in 'real time')
 void DefaultAI::expedition_management(ShipObserver& so) {
 
-	Map& map = game().map();
+Map& map = game().map();
 	const int32_t gametime = game().get_gametime();
+	// probability for island exploration repetition
+	const int repeat_island_prob = 0;
 
 	// second we put current spot into visited_spots
-	bool first_time_here = false;
-	if (so.visited_spots.count(so.ship->get_position().hash()) == 0) {
-		first_time_here = true;
+	bool first_time_here = so.visited_spots.count(so.ship->get_position().hash()) == 0;
+	if (first_time_here) {
 		so.visited_spots.insert(so.ship->get_position().hash());
 	}
 
@@ -4948,10 +4953,10 @@
 	// 1. Build a port there
 	if (!so.ship->exp_port_spaces().empty()) {  // making sure we have possible portspaces
 
-		// we score the place
-		const uint8_t spot_score = spot_scoring(so.ship->exp_port_spaces().front());
+		// we score the place (value max == 8)
+		const uint8_t spot_score = spot_scoring(so.ship->exp_port_spaces().front()) *2;
 
-		if ((gametime / 10) % 8 < spot_score) {  // we build a port here
+		if (game().logic_rand() % 8 < spot_score) {  // we build a port here
 			game().send_player_ship_construct_port(*so.ship, so.ship->exp_port_spaces().front());
 			so.last_command_time = gametime;
 			so.waiting_for_command_ = false;
@@ -4960,7 +4965,7 @@
 			// TODO(TiborB): how long it takes to build a port?
 			// I used 5 minutes
 			MapRegion> mr(
-			   game().map(), Area(map.get_fcoords(so.ship->exp_port_spaces().front()), 8));
+			   map, Area(map.get_fcoords(so.ship->exp_port_spaces().front()), 8));
 			do {
 blocked_fields.add(mr.location(), game().get_gametime() + 5 * 60 * 1000);
 			} while (mr.advance(map));
@@ -4971,21 +4976,22 @@
 
 	// 2. Go on with expedition
 
+// we were not here before
 	if (first_time_here) {
 		game().send_player_ship_explore_island(*so.ship, so.island_circ_direction);
 		so.last_command_time = gametime;
 		so.waiting_for_command_ = false;
 
-		// we was here but to add randomnes we might continue with expedition
-	} else if (gametime % 2 == 0) {
+	// we were here before but we might randomly repeat island exploration
+	} else if (game().logic_rand() % 100 < repeat_island_prob) {
 		game().send_player_ship_explore_island(*so.ship, so.island_circ_direction);
 		so.last_command_time = gametime;
 		so.waiting_for_command_ = false;
+
 	} else {
-		// get swimmable directions
+		// determine swimmable directions
 		std::vector possible_directions;
 		for (Direction dir = FIRST_DIRECTION; dir <= LAST_DIRECTION; ++dir) {
-
 			// testing distance of 8 fields
 			// this would say there is an 'open sea' there
 			Widelands::FCoords tmp_fcoords = map.get_fcoords(so.ship->get_p

Re: [Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread TiborB
in regard to repeat_island_prob - so once the ship is on a coast of he will 
circle around it forever and never leave it to search for other lands/islands?
-- 
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/scrollbar_beautification into lp:widelands

2016-11-09 Thread bunnybot
Bunnybot encountered an error while working on this merge proposal:

('The read operation timed out',)
-- 
https://code.launchpad.net/~widelands-dev/widelands/scrollbar_beautification/+merge/309635
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/scrollbar_beautification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/scrollbar_beautification into lp:widelands

2016-11-09 Thread bunnybot
Continuous integration builds have changed state:

Travis build 1569. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/172860675.
Appveyor build 1408. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_scrollbar_beautification-1408.
-- 
https://code.launchpad.net/~widelands-dev/widelands/scrollbar_beautification/+merge/309635
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/scrollbar_beautification.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread toptopple
repeat_island_prob is a repetition probability polled when a ship hits an 
island at a spot which was encountered before. So it is quaranteed that an 
island is at least circled once (when being found).

repeat_island_prob is not a cessation probability, which it would have to be to 
justify your concerns. ;) As for my observations, cessation happens flawlessly 
after one circle. Then the ship heads for open sea again. (This holds for hit 
islands, it is not tested at this point for the "motherland" from where 
exploration started. Assertions there are subject to further investigation.)

-- 
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread bunnybot
Continuous integration builds have changed state:

Travis build 1587. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/174511687.
Appveyor build 1425. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_7010622_q_widelands_topple_seafaring_1-1425.
-- 
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread TiborB
and yes, current expedition logic is really very primitive
-- 
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands

2016-11-09 Thread TiborB
Well, current logic was that if known portspace is found, the ship with 
probability of 50% search for open sea and if found it sails this direction. 
Otherwise it sail (keep on sailing) around the current land.

I was afraid that ship can end up in a kind of ping-pong between two ports - 
but this is of low probability.

But if proposed behavior is OK for you on map with multiple islands - I will be 
fine with it.


-- 
https://code.launchpad.net/~7010622-q/widelands/topple-seafaring-1/+merge/310436
Your team Widelands Developers is requested to review the proposed merge of 
lp:~7010622-q/widelands/topple-seafaring-1 into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/casern_workersqueue into lp:widelands

2016-11-09 Thread Notabilis
Nooo, not the beer! I liked the beer! :(

But thanks for the review. The small stuff (renaming, etc.) is done, what is 
left are the bigger changes. Open problems in no particular order:

1) Making WorkersQueue more similar to WaresQueue and replacing the user 
interface should be no problem. I will try to share as much code as possible 
between the queues respectively the interfaces.

2) The problem with higher-ranking workers seems to be a bug (or inconsistency) 
in the code. While warehouses check for an exact match to fulfill the request, 
the IdleWorkerSupply uses can_act_as(). This explains the strange behavior I 
encountered. For normal (worker-)workers I would prefer the can_act_as() 
approach while barracks should match exactly. What do you think about a flag in 
the request which describes whether the worker has to match exactly? Or maybe 
expand the "Requirements" for requests (new RequireExactWorker class or so)?

3) In production_program.cc:220 you requested a for-each loop. I first thought 
this would be a problem with the if() inside the loop which checks the 
iterator. But now I am wondering: Can this if() ever be fulfilled? When I am 
not missing anything the loop should always end earlier. So remove the 
if()-part and use a for-each loop?

4) What does "NOCOM" mean? I just can't figure it out. And what is the 
difference to "TODO"?

5) You increased the packet version for the serialization functions and they 
are now checking for a range. What is the idea behind it? Increase the number 
on every modification of the file but accept older versions until the method 
itself changes?

So much for now.
Thanks for the link to the documentation. I tried the parameter singlehtml 
before, seems that this does not include the code documentation. A full html 
worked fine.
-- 
https://code.launchpad.net/~widelands-dev/widelands/casern_workersqueue/+merge/309763
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/casern_workersqueue into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/b19-appid into lp:widelands/build19

2016-11-09 Thread Tino
@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/b19-appid/+merge/310135
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/b19-appid into lp:widelands/build19.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp