reset password
Author Message
rmedina0531
Posts: 19
Posted 19:15 Mar 02, 2020 |

Is there any particular reason why this method is static. With this method static we cant access the object variables, i.e.accessing the rules or the rule number from the class. Either we need this method to be not static as to have access, or we need to pass in the rule number(or any other rule data set we might choose) to be able to compute the next line.

rabbott
Posts: 1649
Posted 21:40 Mar 02, 2020 |

Sorry, but I'm not following your reasoning. The only information you need to generate a line from the previous line are the switch settings.

This was given in the outline.

def generate_new_line_from_current_line(prev_line):
    # Extend the current line two to the left and right.
    # Want to be able to generate one additional value at each end in the new line.
    prev_line = '00' + prev_line + '00'
    new_line = ...
    return new_line

To compute the new line from the previous line all you need are the switch settings. They are available via SimEngine.gui_get(<switch number as string>). What's not shown is that between constructing prev_line and computing new_line, you have to generate the sequence of triples derived from the prev_line. Each triple, when represented as a string, is a switch name; each such switch gives you an element in the new line.

Last edited by rabbott at 21:41 Mar 02, 2020.