1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
###############################################################################
#
# C O N Q R U L E S
#
# Copyright (C)1985-1986 by Jef Poskanzer and Craig Leres
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that this copyright notice appear in all copies and in all
# supporting documentation. Jef Poskanzer and Craig Leres make no
# representations about the suitability of this software for any
# purpose. It is provided "as is" without express or implied warranty.
#
#
###############################################################################
#
# Unix/C specific porting and supporting code Copyright (C)1994-1996
# by Jon Trulson <jon@radscan.com> under the same terms and
# conditions of the original copyright by Jef Poskanzer and Craig
# Leres.
#
###############################################################################
#
# $Id: conqrule,v 1.3 1997/12/28 23:28:46 jon Exp $
#
###############################################################################
#
# compile with 'conqstrat <conqrule >conqdata.h' , then re-compile conquest
# to install as the new standard strategy table.
# OR
# compile with 'conqstrat -U <conqrule' to update the common block directly.
#
###############################################################################
#
# A maximum of 32 rules are allowed.
#
# Rule syntax: <condition> & <condition> & ... ; ACTION
# All comments (starting with '#') and whitespace are ignored.
#
# Operators:
#
# < <= > >= = == != <> ! &
#
# Variables:
# random dne damage incoming
# fuel numtorps shields etemp
# wtemp phaserdam torpdam warp
# shup walloc orbiting repairing
# enemycloaked enemydamage canread
#
# All variables are scaled to values between 0-9 inclusive.
#
# Actions:
#
# ROB_NOOP ROB_GOHOME ROB_GOREPAIR ROB_ALLOCATE
# ROB_DETONATE ROB_MYDETONATE ROB_PHASER ROB_TORPEDO
# ROB_BURST ROB_SHIELD ROB_UNTRACTOR ROB_WARP_0
# ROB_WARP_2 ROB_WARP_5 ROB_WARP_8 ROB_TRACK
# ROB_SLIENT ROB_MESSAGE ROB_TAKEDRUGS ROB_REPAIR
# ROB_READMSG ROB_INSULT ROB_GOFUEL ROB_RUNAWAY
#
# Distance Scaling factors:
#
# dist value
# 0 0
# 100 1
# 600 1
# 700 2
# 1300 2
# 1400 3
# 2000 3
# 2100 4
# 2800 4
# 2900 5
# 3600 5
# 3700 6
# 4500 6
# 4600 7
# 5500 7
# 5600 8
# 6700 8
# 6800 9
################################################################################
# Toggle shields if an enemy has gotten close or if there are enemy torps.
dne <= 3 & shields >= 2 & ! shup ; ROB_SHIELD
incoming > 0 & shields >= 2 & ! shup ; ROB_SHIELD
# Allocate to weapons if an enemy has gotten close.
dne <= 3 & ! walloc ; ROB_ALLOCATE
# Weapon rules. Avoid phasers if we can't aim them.
dne <= 3 & fuel > 0 & phaserdam > 3 & ! enemycloaked ; ROB_PHASER
dne <= 3 & fuel > 1 & torpdam > 0 & numtorps >= 3 ; ROB_BURST
dne <= 3 & fuel > 0 & torpdam > 0 & numtorps > 0 ; ROB_TORPEDO
# Detonate rules.
fuel > 0 & incoming > 0 & damage < 8 ; ROB_DETONATE
dne < 3 & numtorps < 3 & wtemp < 8 ; ROB_MYDETONATE
# 12/24/96
# raise shields if damage, and the threat can't be an enemy.
# this should reduce the number of sun-deaths for robots a bit
dne > 3 & incoming == 0 & ! shup & damage > 0 & etemp < 4 &
! repairing ; ROB_SHIELD
# Lower shields when it's safe.
dne > 3 & incoming == 0 & shup & ! damage; ROB_SHIELD
# Deallocate weapons if we're not going to use them.
dne > 3 & walloc ; ROB_ALLOCATE
# Movement rules. Don't set warp if we are orbiting. (But notice that
# if we decide to lock on to a new planet, we're no longer orbiting
# and can set warp. Be careful to avoid continuous speed changes.
! orbiting & fuel == 0 & warp != 0 ; ROB_WARP_0
! orbiting & etemp >= 9 & warp != 0 ; ROB_WARP_0
! orbiting & fuel > 0 & warp != 2 & damage < 9 &
etemp > 7 & etemp < 9 ; ROB_WARP_2
! orbiting & fuel > 0 & warp != 5 & damage < 7 &
etemp > 4 & etemp < 7 ; ROB_WARP_5
! orbiting & fuel >= 3 & warp != 8 & damage < 5 &
etemp < 4 ; ROB_WARP_8
# Course rules.
dne < 9 & fuel >= 5 & damage < 2 ; ROB_TRACK
# 12/21/97
# this rule added to mitigate a logic 'hole' with fuel ranges between
# 150-350 that caused NOOP's at inoppertune times. This flaw became
# apparent when the fuel scaling bug in buildai() was fixed, as robots
# no longer think they always have maximum fuel.
dne <= 5 & fuel >= 3 & fuel < 5 & damage < 3; ROB_TRACK
! orbiting & dne <= 3 & damage <= 6 & fuel >= 4 & enemydamage >= 8 ; ROB_TRACK
! orbiting & dne <= 3 & damage >= 5 & damage < 9 & fuel > 0 ; ROB_RUNAWAY
# 12/21/97
# relating to the fuel scaling bug above, the fuel comparison was changed
# to be a bit more conservative. (was fuel < 2)
fuel <= 2 & warp != 0 & damage < 4 ; ROB_GOFUEL
! orbiting & warp != 0 & damage >= 4 ; ROB_GOREPAIR
# Repair rules. If we're damaged and in orbit, repair. If we're damaged and
# can't move (i.e. warp is zero), repair.
dne > 3 & incoming == 0 & damage > 0 & ! repairing & orbiting ; ROB_REPAIR
dne > 3 & incoming == 0 & damage > 0 & ! repairing & ! orbiting &
warp == 0 ; ROB_REPAIR
# This rule is probably covered by the previous one.
## dne > 3 & incoming == 0 & damage >= 9 & ! repairing ; ROB_REPAIR
# Send our enemy some insults when he's approaching.
random == 3 & dne >= 7 & dne <= 8 ; ROB_INSULT
# Read a message if we can.
canread ; ROB_READMSG
# If nothing happens for awhile, go home.
random == 7 & dne > 8 & ! orbiting ; ROB_GOHOME
|