SET start offset of first password picture |

SET start offset of first password picture |

SET |

FOR password pictures from the second password picture |

SET cued offset of password picture |

SET cued offset of password picture |

IF cued = start AND cued = start THEN |

//Special scenario |

SET target = cued |

SET target = cued |

ELSE |

//Subtract and are intermediate values to get the |

//direction and values (−1, 0, 1) |

//Difference and are used to determine whether the |

//cued picture is on the imaginary line (Scenario 2) |

SET subtract = cued − start |

SET subtract = cued − start |

SET difference = |

SET difference = |

SET direction = 0 |

SET direction = 0 |

SET magnitude = 1 |

SET magnitude = 1 |

IF difference != 0 THEN |

SET direction = subtract/difference |

END IF |

IF difference != 0 THEN |

SET direction = subtract/difference |

END IF |

IF difference = 0 OR difference = 0 OR |

difference = difference THEN |

//Scenario 2, distance from edge as magnitude |

IF direction THEN |

SET magnitude = start |

ELSE IF |

SET magnitude = maximumOffset − start |

END IF |

IF direction THEN |

SET magnitude = start |

ELSE IF |

SET magnitude = maximumOffset − start |

END IF |

//Prevents the target picture from being outside of grid |

//when the direction is diagonal |

IF difference = difference THEN |

IF magnitude > magnitude THEN |

SET magnitude = magnitude |

ELSE |

SET magnitude = magnitude |

END IF |

END IF |

END IF |

SET target = start + (direction * magnitude) |

SET target = start + (direction * magnitude) |

IF target = cued AND target = cued THEN |

//Scenario's 2 exception |

SET target = target − direction |

SET target = target − direction |

END IF |

END IF |

SET start = target |

SET start = target |

INCREMENT |

END FOR |