All Downloads are FREE. Search and download functionalities are using the official Maven repository.

APT.Arithmetic-smem.arithmetic.process-column.compute-result.subtract-via-counting.count.soar Maven / Gradle / Ivy

## Given that we always pre-generate all digits to generate the problem
##   all digits are always there so there will be no impasse.
###   Substate included in case problem is generated without all digits generated.

sp {subtract-via-counting*propose*count
   (state  ^name subtract-via-counting
              ^counter 
              ^subtrahend <> )
-->
   ( ^operator  + =)
   ( ^name count)
}

sp {subtract-via-counting*apply*count
   (state  ^name subtract-via-counting
              ^operator 
              ^base-number 
              ^counter )
   ( ^next )
   ( -^previous-borrow true
            ^previous )
   ( ^name count)
-->
   ( ^counter  - 
        ^base-number  - )
}

sp {subtract-via-counting*apply*count*borrow
   (state  ^name subtract-via-counting
              ^operator 
              ^base-number 
              ^counter )
   ( ^next )
   ( ^previous-borrow true
           ^previous )
   ( ^name count)
-->
   ( ^counter  - 
        ^base-number  - 
        ^borrow false -
                true)
}