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.
Welcome to Ask Sage!
Thank you for your question.
To display blocks of code or error messages in Ask Sage, skip a line above and below, and do one of the following (all give the same result):
For instance, typing
produces:
Please edit your question to do that.