Shannon V. OKeets -> RE: AI vs Rules (7/8/2010 5:57:29 PM)
|
quote:
ORIGINAL: bo quote:
ORIGINAL: Shannon V. OKeets quote:
ORIGINAL: bo Thank you Steve for the information. Boolean?[&:] Bo Boolean variables are True/False. Boolean logic is branching logic based on binary operations and branches: AND, OR, NOT, et al. Cool, errr how many Booleans have to be done yet[;)] Bo Many. But hopefully not too many more like this one (testing whether moving a stack of units into a hex is permitted within the restrictions of foreign troop commitment):
// ****************************************************************************
// C is the major power that controls the country (governed area) that
// geographically owns the destination hex. C does not necessarily = HexC.
// ****************************************************************************
C := MC.ControllingMajorCountry;
// ****************************************************************************
// Under very special circumstances, check for foreign troop commitment.
// ****************************************************************************
if (C <> nil) and // Hex has an owner.
(FirstMU.Side = C.Side) and // Moving unit & hex on same side.
((not CheckShift) or
(Game.Phase <> pNavalMovement) or
LoadedInPort or
(not (ssCtrl in Shift)) or
NotEnoughMPOrRange) and // Use MSHexList to check MPs and range.
// ****************************************************************************
// The phases pHQSupportD, pHQSupportA, pLandCombatDeclaration do not actually
// 'move' the units into an adjacent hex.
// ****************************************************************************
(not (Game.Phase in [pHQSupportD, pHQSupportA, pLandCombatDeclaration]))
and
((not (FirstMU is TLandUnit)) or
(not ((Game.Phase in LandBombardmentPhases) or
Game.RetreatSubphase))) and // CanMoveTo.
((not (FirstMU is TAirUnit)) or
(Game.Phase in [pNavalAir, pLandMovement, pAirRebase, pReturnToBaseA,
pReturnToBaseD, pConquest]) or
Game.NavalCombatAbortDigress or
((Game.Phase = pReinforcement) and
(Game.Phase_Reinforce.CurrentSubPhase[Game.LocalDeciderMP] =
RspPlaceUnits)) or
((Game.Phase in AirPhases) and
(Game.AirSubPhase in [aspReturnA, aspReturnD])) or
((Game.Phase in [pAirTransport, pParadrop]) and
(Game.AirSubPhase = aspFlyA))) and
((not (FirstMU is TNavalUnit)) or
(not (Game.Phase in ShoreBombardmentPhases))) and
(not CanMoveToCountry(MC.FTCCountry, Game.Phase = pParadrop)) then
begin // 'The foreign troop commitment limit for %s will not be satisfied.'
Result := mvForeignCommitment;
Exit;
end;
The above is ~40 lines of code. The program currently has ~360,000 lines of code.
|
|
|
|