2021-10-28 05:27:58 +0100 | received badge | ● Notable Question (source) |
2021-10-28 05:27:58 +0100 | received badge | ● Popular Question (source) |
2020-12-02 22:07:58 +0100 | received badge | ● Student (source) |
2020-12-02 14:57:23 +0100 | asked a question | Drawing polyominoes How can I write a function which takes a list of coordinates and draws the corresponding polyomino? To draw something like a rectangle I wrote the following: def drawRectangle(A,B): return polygon([(A[0], A[1]), (A[0], B[1]), (B[0], B[1]), (B[0], A[1])]) But imagine if we have a bigger figure, how can I do this without using polygon? So how can I write a function which takes a list of coordinates and draws its polyomino? For example [(0,0), (0,1), (1,1), (1,2)] is equivalent with a tetromino. |