Shannon V. OKeets
Posts: 22095
Joined: 5/19/2005 From: Honolulu, Hawaii Status: offline
|
You mentioned stacking limits. Okay, ... The program currently checks stacking during: land movement, rail movement, naval movement, undoing moves, conquest, surrender, carpet bombing, and air transport. The other major occasion is when it determines whether units are selectable, which gets called innumerable times during game play. Overstacked conditions are processed on a hex by hex basis as a digression which is in a do while loop (destroying units until the hex is no longer overstacked). The actual test for whether a hex is overstacked depends on the hex terrain, presence of cities, ports, whether the hex is a coastal hex, weather, which country controls the hex, the units in the hex, which countries the units belong to, the major powers that control the units, and the relationships between all those various countries. Relationships between countries are quite varied. It includes such things as conquered countries where there can be units belonging to the original country that are still fighting against the conqueror, partisans which are fighting against the conqueror, territorial units which are fighting on the side of the conqueror, and other odds ducks like notional units, the AOI unit, warlords, captured naval units, and lend leased air units. For instance, having a partisan and a territorial belonging to a conquered minor country in the same hex means the hex is overstacked. There are also the rules about the two Chinese minor countries and that the USSR is the controlling major power for the Communist Chinese but that minor country isn't aligned to the USSR. Oh, and invading units (from the air or the sea) are not overstacked in a hex while they are invading, even though their presence means that units from both sides are in the hex. Of course air units flying missions in a hex are not subject to stacking limits, so whether the air unit is flying or sitting on the ground matters too. Therefore, phase and subphase of the game need to be considered. This list of things the unit test for stacking limits would need to cover is off the top of my head. I see I left out damaged ports and whether the city is a capital (for oil and build points). The program does an examination of all hexes on the map when it checks for stacking limits, so the unit test could do that in several passes, loading different saved games for optional rules, having the weather conditions variable across all the terrain types, including coastal hexes, and which countries control which hexes. It would also need to have all the different relationships between countries covered, both major powers and minor countries. For instance, when there are German units in Finland while the USSR and Finland are at war but the USSR and Germany are not. Then someone would need to set up all the different overstacked conditions using the debug Place tool (which is sensitive to permitting overstacking, so that code would need to be modified). To be thorough, (and that's our goal with the unit test isn't it?), all the possible combinations and permutations of overstacking would need to be present in the saved game, just to make sure the unit test identifies all overstacked hexes while simultaneously giving a passing grade on weird combinations of units in a hex which do not violate stacking. That shouldn't be too difficult to do. Someone who knows what they are doing and understands all the WIF rules well could probably set up those saved games in a month or two. So, one unit test knocked off the to-do list. What other unit tests should be created? How about one of the types of combat? --- My point is that creating Units Tests for MWIF would be another project unto itself, of comparable size to writing and debugging the code for MWIF.
_____________________________
Steve Perfection is an elusive goal.
|