johanmoritz / freecol

FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
0 stars 1 forks source link

Manually calculate CCN of BuildQueuePanel::updateBuildingList #13

Closed Kappenn closed 4 years ago

Kappenn commented 4 years ago

Calculated CNN: 20 Located at: BuildQueuePanel::updateBuildingList@753-820@./src/net/sf/freecol/client/gui/panel/BuildQueuePanel.java

Kappenn commented 4 years ago

Calculated CNN 23 86463872_1737953769673718_452253901580664832_n

johanmoritz commented 4 years ago

Calculated CCN 13 (calculated it wrong in pdf)

updateBuildingListCCN.pdf

johanmoritz commented 4 years ago

Not sure why get such a different answer. Can you describe whats going on in your picture 6 nodes from the bottom? It looks to me like you have an inner for loop there, but I can't seem to find it in the code.

Kappenn commented 4 years ago

if (up != null && !current.contains(up) && (colonyBuilding == null || colonyBuilding.getType() != up)) { reasons.add(Messages.getName(up)); } I treat each && condition as a nestled if statement if(condition) if (condition) Thats probably why it looks so confusing.

johanmoritz commented 4 years ago

Oh! should we do that? I thought the we should only check every branch, not substatements

Kappenn commented 4 years ago

Ah, I see what you mean, since they are of the same branch in that case, could be that.

adbjo commented 4 years ago

Code coverage too low, replace with Monarch::initializeCaches@303-347@./src/net/sf/freecol/common/model/Monarch.java

See #35