Skip to main content
added 2 characters in body
Source Link
Maarten Fabré
  • 9.1k
  • 1
  • 15
  • 27

All in all this looks good to me. I would make 2 changes

bracket_map

The code to assemble this map can be more clear in it's own function.

+ and -

v = data[data_index] - 1
if v < 0:
    v = 255
data[data_index] = v

+ and -

can be easily replaced by

data[data_index] = (data[data_index] - 1) % 256

Same goes for the + operation

All in all this looks good to me. I would make 2 changes

bracket_map

The code to assemble this map can be more clear in it's own function.

v = data[data_index] - 1
if v < 0:
    v = 255
data[data_index] = v

+ and -

can be easily replaced by

data[data_index] = (data[data_index] - 1) % 256

Same goes for the + operation

All in all this looks good to me. I would make 2 changes

bracket_map

The code to assemble this map can be more clear in it's own function.

+ and -

v = data[data_index] - 1
if v < 0:
    v = 255
data[data_index] = v

can be easily replaced by

data[data_index] = (data[data_index] - 1) % 256

Same goes for the + operation

Source Link
Maarten Fabré
  • 9.1k
  • 1
  • 15
  • 27

All in all this looks good to me. I would make 2 changes

bracket_map

The code to assemble this map can be more clear in it's own function.

v = data[data_index] - 1
if v < 0:
    v = 255
data[data_index] = v

+ and -

can be easily replaced by

data[data_index] = (data[data_index] - 1) % 256

Same goes for the + operation