Welcome to our community

Be a part of something great, join today!

How to generate a tiling (in python if possible)

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
I was reading this wikiperdia article on polyminos (https://en.wikipedia.org/wiki/Polyomino).

The pictures look very nice. Example

800px-Conway_criterion_false_negative_nonominoes.svg.png
I want to learn how to generate these figures myself in an interactive way.

Basically I want to start with a polymino and then I want to be able to translate (by unit distance up-down or left-right) this polymino by pressing arrow keys and place it at the desired location. Then I want to pick another copy of the same polymino and place it at another desired location and so on.

Can somebody please help me get started as to where can I learn this?

Can I implement this is python?

Thank you.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,193
Well, you're going to need some serious GUI programming, unless you want to do it all in ASCII art, in which case it won't look like what you've got there. Python GUI dev is not as advanced as, say, LabVIEW or C++, but I have heard of a sort of WYSIWYG editor: Qt Designer, though that locks you into Qt as your GUI framework. I have a bit more experience with tkinter, but as far as I know, it doesn't have a WYSIWYG editor. Most people don't do heavy GUI development in Python (a major area for future growth, in my opinion: the Python folks need to get this aspect of Python out there and competing): they turn to C++ or Java, where the tools are undeniably more mature (though I have to say, GUI development in LabVIEW has spoiled me for anything else; I don't know of any GUI development that is as fast as LabVIEW).

My current impression is that tkinter is a little faster development initially, but not as full-featured. Qt is a steeper learning curve, but has more features, plus you might be able to leverage Qt Designer to help out.

Does that answer your question?
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,780
Do you want a nice user interface with mouse and/or keyboard?
Or just a nice graphical presentation?
Or ability to run algorithms that 'solve' it?

Python is not particularly good at a mouse and/or keyboard interface.
It has some reasonable libraries for graphical presentations.
And it can run algorithms just fine, although for high complexity algorithms a lower level language may be desired.

Personally I like Qt with C++ that can do all of it, but as Ackbach already said, it has a steep learning curve.
So you may prefer python to get some results pretty quick.
A java development environment may be a good fit.
Unfortunately I do not have much experience with GUI programming in java, so I cannot recommend the best tool for it.
 

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
Well, you're going to need some serious GUI programming, unless you want to do it all in ASCII art, in which case it won't look like what you've got there. Python GUI dev is not as advanced as, say, LabVIEW or C++, but I have heard of a sort of WYSIWYG editor: Qt Designer, though that locks you into Qt as your GUI framework. I have a bit more experience with tkinter, but as far as I know, it doesn't have a WYSIWYG editor. Most people don't do heavy GUI development in Python (a major area for future growth, in my opinion: the Python folks need to get this aspect of Python out there and competing): they turn to C++ or Java, where the tools are undeniably more mature (though I have to say, GUI development in LabVIEW has spoiled me for anything else; I don't know of any GUI development that is as fast as LabVIEW).

My current impression is that tkinter is a little faster development initially, but not as full-featured. Qt is a steeper learning curve, but has more features, plus you might be able to leverage Qt Designer to help out.

Does that answer your question?
Thanks for the response. I have never done GUI programming before and all I can muster is a nervous laughter in response to the myriad of languages you are familiar with. I will try to see if I can use LabVIEW.

Thanks.

- - - Updated - - -

Do you want a nice user interface with mouse and/or keyboard?
Or just a nice graphical presentation?
Or ability to run algorithms that 'solve' it?

Python is not particularly good at a mouse and/or keyboard interface.
It has some reasonable libraries for graphical presentations.
And it can run algorithms just fine, although for high complexity algorithms a lower level language may be desired.

Personally I like Qt with C++ that can do all of it, but as Ackbach already said, it has a steep learning curve.
So you may prefer python to get some results pretty quick.
A java development environment may be a good fit.
Unfortunately I do not have much experience with GUI programming in java, so I cannot recommend the best tool for it.
Thanks for replying.

I want to be able to control the tiles (polyminos) using the keyboard. I do not an algorithm which solves the tiling problem, though that would be awesome.

I just got hold of a tetris programme in python written by someone who has freely distributed it on github. I am trying to tinker with the code to switch gravity off and have fun with translations!
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,780
I want to be able to control the tiles (polyminos) using the keyboard. I do not an algorithm which solves the tiling problem, though that would be awesome.

I just got hold of a tetris programme in python written by someone who has freely distributed it on github. I am trying to tinker with the code to switch gravity off and have fun with translations!
That sounds as if you already have what you are looking for.
 

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
That sounds as if you already have what you are looking for.
Yeah think so. However, the code is arcane (to me) and it will take some time before I can figure out what needs to be changed in the code to adapt to my purpose.