Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- def main():
- with open("test.txt", 'r') as f:
- lines = f.readlines()
- for line in lines:
- line = line.strip("\n") # remove the newline character
- program = line.split(',')
- print ("input %s" % program)
- position = 0
- # loop through the program
- while position < len(program):
- # get the current opcode
- opcode = program[position]
- print ("position %s" % position)
- print ("opcode %s" % opcode)
- # perform action for opcode here
- # skip to the next opcode
- position = position + 4;
- print ("output %s" % program)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement