Mathematical and algorithmic operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Mathematical and algorithmic operations >

Mathematical and algorithmic operations

IFC. / NFC. - If-Fuzzy-Compare

Previous Top Next


MiniRobotLanguage (MRL)

 

IFC. Conditional Statement

If Fuzzy Compare

 

 

Intention

 

Conditional Statement.

Test if a specified string evaluates true with a given other String. having regard to one of two alternative fuzzy logic algorithm.

 

IFC. in Mode 1 uses a percentage from 0 to 100.

IFC. in Mode 2 (use P4, "m"-Flag) uses a maximum error number starting from 0.

 

In both modes, you will find the internally calculated "Match-value" on TOS.

 

' Example that will NOT match

' change the percentaqe value so that it will match.

'

$$TXB=ABCDEFGHIJK

$$TXA=ABCDEFGH

 

IFC.$$TXA|$$TXB|90

 DBV.Yes, we match.

ELS.

 DBP. This matches only to $$000 percent.

EIF.

ENR.

 

In Mode 2 we deal with "typing errors". Take this example:

 

$$TXB=ABCDEFGHIJK

$$TXA=ABCEFGHK

 

IFC.$$TXA|$$TXB|2|m

 DBV.Yes, we match.

ELS.

 DBP. This matches only to $$000 errors.

EIF.

ENR.

 

Note that a missing or deleted char is always one typing error.

Using algo 2, you will always find the internally calculated number of typing errors on the TOS.

 

NWC. is the negative Form of this statement.

 

 

 

Syntax

 

 

IFC.P1|P2|P3 … ELS. … EIF.

 

 

Parameter Explanation

 

P1 - Variable A to compare

 

P2 - Variable B to compare

 

P3 - numerical argument, depends on used algorithm.

 

P4 - (optional) can be omitted or can be "m". In that case

    another algorithm is used to compare P1 and P2.

 

In detail the difference is:

 

- Algorithm 1 (no "m"-Flag):

P3 is a percentage number from 0% to 100%.

 If Algorithm 1 is chosen, then

 P1 must match P2 for the given percentage.

 

- Algorithm 2 ("m"-Flag, P4 is used):

P3 is a maximum error number, similar to wrong letter,

 or missing letter.

 If Algorithm 2 is chosen, then

 P1 must match P2 taking into account the given

 maximum number of "typing errors".

 

 

IFC.'s can be nested to unlimited Depth, and they can also enclose Sub-Programm Calls or  FEX. (Enumerations) to unlimited Depth.

 

 

 

 

Example

 

'***********************************

' IWC.-Test, Algo 1

'***********************************

$$TXB=ABCDEFGHIJK

$$TXA=ABCDEFGH

 

IFC.$$TXA|$$TXB|90

 DBV.Yes, we match.

ELS.

 DBP. This matches only to $$000 percent.

EIF.

ENR.

 

'***********************************

' IWC.-Test, Algo 1

'***********************************

' Will match to 90%

$$TXB=ABCDEFGHIJK

$$TXA=ABCDEFGHI

 

IFC.$$TXA|$$TXB|90

 DBV.Yes, we match.

EIF.

 

 

'***********************************

' IWC.-Test, Algo 2

'***********************************

'

' This will NOT match

$$TXB=ABCDEFGHIJK

$$TXA=ABCEFGHK

 

IFC.$$TXA|$$TXB|2|m

 DBV.Yes, we match.

ELS.

 DBP. This matches only to $$000 errors.

EIF.

ENR.

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    1.6.1. Program Flow Control

    1.5. Features and Hints

    FZC. - Fuzzy Compare

    IVP./ NVP. - If-Variable-Pattern

    IVC. / NVC. - If-Variable-Contains

    ELS. - ELSE

    EIF. - END IF

    CAL. - mathematical CALculation

    IVV. / NVV. - If Variable Value