pappde / bmai

AI to play Button Men, originally developed to interface with the (now deprecated) unofficial online Button Men website.
MIT License
2 stars 1 forks source link

support morphing twin die #41

Open danlangford opened 1 year ago

danlangford commented 1 year ago

A button Gluttony has a morphing twin die

image

however the codebase doesn't allow for it

bmai.cpp:708

  // MORPHING shouldn't be paired with TWIN
  BM_ERROR( (m_properties & (BME_PROPERTY_MORPHING|BME_PROPERTY_TWIN)) != (BME_PROPERTY_MORPHING|BME_PROPERTY_TWIN) );
pappde commented 1 year ago

Don't recall the issue - probably it just wasn't clear what the behavior should be. However, most likely an m(1,5) capturing a 6 would become m(6,6). But what happens if an m(1,5) captures a (2,4)?

Depending on that special case, it seems like this shouldn't be hard to support. In BMC_Die::OnApplyAttackPlayer() there is this code:

    if (HasProperty(BME_PROPERTY_MORPHING))
    {
...
        m_sides_max = m_sides[0] = target->GetDie(_move.m_target)->GetSidesMax();
...
    }

In which case it would look like:

   m_sides_max = 0;
   for (int i=0; i<Dice(); i++)  
      m_sides_max += m_sides[i] = target->GetDie(...)

Also, at least one BM_ASSERT and BM_ERROR to remove.

SECONDARY ISSUE I see a couple of other Morphing combination restrictions (Turbo, Speed) that may need to be allowed.

jl8e commented 1 year ago

IIRC, a morphing twin die doesn't behave any differently from a non-twin morphing die: the morphing die twins and un-twins as needed.

danlangford commented 1 year ago

@jl8e so m(1,5) capturing a 6 would become m(6). m(1,5) captures a (2,4) and becomes m(2,4)

Is that right ?

jl8e commented 1 year ago

yes

danlangford commented 2 weeks ago

other areas this is discussed. specifically interested in the Turbo aspect https://www.buttonweavers.com/ui/forum.html#!threadId=991 https://github.com/buttonmen-dev/buttonmen/issues/2676