-
Notifications
You must be signed in to change notification settings - Fork 104
The framework uses an abstract syntax tree (AST) to represent the scripts and follows the DSL presented in the SynPros. This representation allows some advantages to the framework. Above there is a textual representation of the script:
if(!HaveQtdEnemiesbyType(Ranged,5)) then(train(Worker,8,Right) moveToUnit(Light,Ally,mostHealthy) build(Barrack,1,Down)) else(moveToUnit(Worker,Enemy,closest) harvest(2)) for(u) (if(HaveQtdUnitsHarversting(5)) then(attack(Worker,farthest,u) attack(Light,farthest,u)) attack(Heavy,farthest,u) train(Worker,1,Up) (e))
.
This script is represented by our AST as:
S1
│ ├──S2 - if(!HaveQtdEnemiesbyType(Ranged,5))
│ │ ├──C
│ │ │ ├──C
│ │ │ │ ├──C
│ │ │ │ │ └──c->build(Barrack,1,Down)
│ │ │ │ └──c->moveToUnit(Light,Ally,mostHealthy)
│ │ │ └──c->train(Worker,8,Right)
│ │ └──C
│ │ │ ├──C
│ │ │ │ └──c->harvest(2)
│ │ │ └──c->moveToUnit(Worker,Enemy,closest)
│ └──S1
│ │ └──S3 - for
│ │ │ └──S4
│ │ │ │ ├──S2 - if(HaveQtdUnitsHarversting(5))
│ │ │ │ │ └──C
│ │ │ │ │ │ ├──C
│ │ │ │ │ │ │ └──c->attack(Light,farthest,u)
│ │ │ │ │ │ └──c->attack(Worker,farthest,u)
│ │ │ │ └──S4
│ │ │ │ │ └──C
│ │ │ │ │ │ ├──C
│ │ │ │ │ │ │ ├──C
│ │ │ │ │ │ │ │ └──empty
│ │ │ │ │ │ │ └──c->train(Worker,1,Up)
│ │ │ │ │ │ └──c->attack(Heavy,farthest,u)