Mar-20-2020, 08:01 AM
So basically what I have to do, is in a 6x7 grid, from a randomly generated list of instructions such as ['a',1] or ['b',4] draw an object in the grid
('a' or 'b' being the row and 1-4 being which object to draw)
This is the code I have to draw in just one of the tiles in the grid, which so far works for what I want it to do, and obviously if I did this manually for every row I'd end up with thousands of lines of code.
('a' or 'b' being the row and 1-4 being which object to draw)
This is the code I have to draw in just one of the tiles in the grid, which so far works for what I want it to do, and obviously if I did this manually for every row I'd end up with thousands of lines of code.
def play_game(moves): if moves[0] == ['a',1] or ['a',2] or ['a',3] or ['a',4]: goto (-300,row_a_y_cord[0]) del row_a_y_cord[0] if moves[0] == ['a',1]: dot(10, "red") elif moves[0] == ['a',2]: dot(10, "blue") elif moves[0] == ['a',3]: dot(10, "yellow") elif moves[0] ==['a',4]: dot(10, "green")So I was wondering if there was any way I could set this up better, or loop this for the 40 instructions, or am I just on the wrong track with the way I have coded this?