Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
posh_expansion [2010/04/05 02:54]
honza Info about my plans for posh
posh_expansion [2010/05/16 23:11] (current)
Line 93: Line 93:
 ==== Engine ==== ==== Engine ====
 This idea looks appealing and simple, in reality, it is not so rosy. How exactly should it work and how well would it work in real life? I don't know...yet, but I have some ideas. This idea looks appealing and simple, in reality, it is not so rosy. How exactly should it work and how well would it work in real life? I don't know...yet, but I have some ideas.
 +
 +=== Proposition ===
 +So how does single evaluation could look like?
 +
 +**DC.fire():​**
 +  if (goal fulfilled)
 +    return Done, plan is done, bot has done its job
 +    ​
 +  for every DE according to priority:
 +    // is trigger of DE ok and is interval between this DE calls less than DE freq.
 +    if (DE.isReady()): ​
 +        DE.fire()
 +        return ElementFired;​
 +  return Fail, no elements fired
 +
 +**DE.fire():​**
 +  // call element furthest in the callstack
 +  element2fire = DE.callStack.last
 +  result = DE.callStack.fire(element2fire)
 +
 +**callstack.fire(element):​**
 +  result = element.fire()
 +  switch (result):
 +    case OK:
 +      // element was fired, but there is no change to callstack. ​
 +      // typical case is successful execution of non-last primitive in AP.
 +      do nothing
 +    case Dive:
 +      // the element has fired AP or C and it hasn't returned immediately
 +      // = it wasn't primitive. The element represented in new stack level 
 +      // will be next one in execution call.
 +      // careful, don't use same object to represent the element, there are multiple ​
 +      // callstacks in various state of execution. Joanna calls it something like
 +      // local copy of control state.
 +      callstack.add(result.getElement())
 +    case Surface:
 +      // Yay, element hasn't failed and has done its work and its goal is finished
 +      // Cases : AP has been finished without fail, C goal is fulfilled. ​
 +      callstack.remove() ​    
 +    case Fail:
 +      // element failed miserably. ​
 +      // This causes stack to call the method specified in the DE during initialization
 +      reset the callstack. ​
 +      ​
 +**primitive.fire():​**
 +  return callJavaPrimitive()  ​
  
 ===== Current state ===== ===== Current state =====
posh_expansion.txt · Last modified: 2010/05/16 23:11 (external edit)