boardgamers / gaia-engine

Javascript engine for project gaia
MIT License
13 stars 6 forks source link

Brainstone subphase doesn't work if in IncomePhase #112

Closed rzulian closed 6 years ago

rzulian commented 6 years ago

If the player needs to solve brainstone in the income phase, it doesn't work

init 3 9876
p1 faction terrans
p2 faction gleens
p3 faction taklons
terrans build m -4x1
gleens build m -5x0
taklons build m -5x3
taklons build m -1x3
gleens build m 1x5
terrans build m 0x2
taklons booster booster5
gleens booster booster4
terrans booster booster2
rzulian commented 6 years ago

@coyotte508 I'm working on this. Stay tuned!

rzulian commented 6 years ago

problems with the current implementation are:

  1. it's assuming full heuristic in one step (e.g 2b/0/0, gain 4pw. You can end up to 0/1b/1 or 0/2/b)
  2. it's not managing brainstone in the income phase (e.g you have Taklons and you have a round booster +2pw)
coyotte508 commented 6 years ago

Uh, I'll definitely take a look for the first one.

rzulian commented 6 years ago

I'm still trying to solve this bug, but I'm not able :( I'm thinking to convert the Round.Income into a regular round, similar to the leeching phase, but still we have to managed mixed possible behaviours e.g 2b/0/0 and +4pw and +1pw possible actions: 4pw -> 0/2/b or 0/1b/1 possible actions: 1pw -> 2/b/0 or 1b/1/0 SO I was thing to change the charge power comand to a list of charge commands with the possibile alternatives and remove the emit('brainstone'). Something like charge 4pw (0/2/b) for 3vp,charge 4pw (0/1b/1) and so on. What do you think?

coyotte508 commented 6 years ago

I think the command should be income 4pw. brainstone area3.

There shouldn't be many lines of code involved.

I'll take a look and confirm everything.

coyotte508 commented 6 years ago

It's solved! https://github.com/donkeytech/gaia-engine/commit/e7bf93ccdf98c5bfd42b1a9c9a494a5c506f4412

I fixed a bit the mechanism to handle moves. Now, after processing the moves of a player (terrans here), we can directly request the move from another player (taklons here).

coyotte508 commented 6 years ago

I also tested with the more complicated version:

  init 2 randomSeed
  p1 faction terrans
  p2 faction taklons
  terrans build m -4x-1
  taklons build m -3x-2
  taklons build m -6x3
  terrans build m -4x2
  taklons booster booster3
  terrans booster booster4
  terrans build ts -4x2.
  taklons charge 1pw. brainstone area2
  taklons build ts -6x3.
  terrans charge 2pw
  terrans build PI -4x2.
  taklons charge 2pw
  taklons build PI -6x3.
  terrans charge 3pw
  terrans special step. build m -5x0.
  taklons charge 1pw,1t. brainstone area3
  taklons burn 3. action power2. build m -7x3.
  terrans up gaia.
  taklons up terra.
  terrans build gf -3x1.
  taklons build ts -3x-2.
  terrans charge 1pw
  terrans burn 1. spend 3pw for 1o. spend 1q for 1o. build ts -5x0.
  taklons charge 2pw,1t. brainstone area2
  taklons burn 1. action power3.
  terrans pass booster8
  taklons pass booster5
  terrans income 4pw
  taklons income 2pw. brainstone area1. income 4pw. brainstone area3
  terrans spend 4tg for 1q. spend 1tg for 1c. spend 1tg for 1c
  terrans build m -3x1.

No problems!

rzulian commented 6 years ago

Great!