How to conver code to an algorithm?

Discussion in 'Computer Games and General Discussion' started by kevan, Mar 4, 2012.

  1. kevan

    kevan Imagination rules the world

    Dec 4, 2009
    This is the code I have and I'm curious on how I would convert it back to an Algorithm? Also the question I have there in the quote. Any help with that please! :)
  2. kirlac

    kirlac Member

    May 17, 2009
    New Zealand
    Since an algorithm is just the step by step of what needs to happen you just read the code and write what each part is doing eg.
    In a loop
    Take in input to determine user is not a bot
    Check if input is less than 5

    As for the question, perhaps use some while loops eg.
    create variable repeating set to true
    while repeating
    enter login
    ask question
    while answer is not yes or no
    ask question again
    if answer is yes
    do yes scenario
    set repeating to false
    else set repeating to true
    end loop
    end loop

    EDIT: Forgot to create repeating variable (initialized as true) and set it to false when doing the yes sceneario to prevent infinite loop.