ns mask
is0xffff_0000_0000
magic
is0x4e96_0000_0000
mask
is0x0000_ff00_0000
data mask
is0x0000_00ff_ffff
class mask
is0x0000_f000_0000
kClassDefault
is0x0000_0000_0000
kClassSupply
is0x0000_1000_0000
kClassDemand
is0x0000_2000_0000
kIdleEmpty
is0x0000_0100_0000
kIdleFull
is0x0000_0200_0000
kSupplyFromCore
is0x0000_1100_0000
kSupplyFromBlock
is0x0000_1200_0000
kSupplyToPoint
is0x0000_2000_0000
encodePoint(x, y)
is(x << 12) | (y << 0)
- each proc assumes a role,
:producer
or:consumer
, based on build --target - If consumer
- for unit in $transferUnitOfChoice
- if
unit not controlled
||unit flag & ns mask = magic
- if
unit flag
&mask
!=magic
- set flag to
kIdleEmpty
- set flag to
- if
unit flag
=kIdleEmpty
- set flag to
kSupplyFromCore
- goto core
- set flag to
- if
unit flag
&class mask
=kClassSupply
andunit near core
- take stuff from core
- set flag to
kSupplyToPoint | current cap
- goto
@this
- if
unit flag
&mask
=kSupplyToPoint
andunit flag
&datamask
<current cap
- set flag to
kSupplyToPoint | current cap
- goto
@this
- set flag to
- if
unit near @this
andunit flag
&mask
=kSupplyToPoint
- take this goods if
unit flag
&datamask
<10
orcurrent cap
> 10
- take this goods if
- if
unit empty
- set flag to
kIdleEmpty
- set flag to
- if
unit flag
=kIdleFull
- set flag to
kSupplyToPoint | current cap
- goto
@this
- set flag to
- if
- if
- for unit in $transferUnitOfChoice
- If producer
- for unit in $transferUnitOfChoice
- if
unit not controlled
||unit flag & ns mask magic
- if
unit flag
&mask
!=magic
- set flag to
kIdleEmpty
- set flag to
- if
unit flag
&mask
=kSupplyFromCore
- if
dist(unit, core)
>=dist(unit, @this)
- set flag to
kSupplyFromBlock | encodePoint(@thisx, @thisy)
- goto
@this
- set flag to
- if
- if
unit flag
&mask
=kSupplyFromBlock
- Let p be
decodePoint(unit flag & data mask)
- if
dist(unit, p)
<dist(unit, @this)
- set flag to
kSupplyFromBlock | encodePoint(@thisx, @thisy)
- goto
@this
- set flag to
- Let p be
- if
unit flag
&class mask
=kClassSupply
andunit near @this
- put shit into the unit
- set flag to
kIdleFull
- if
- if
- for unit in $transferUnitOfChoice