How to generate a tiling (in python if possible)

  • Context: Python 
  • Thread starter Thread starter caffeinemachine
  • Start date Start date
  • Tags Tags
    Python
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 3K views
caffeinemachine
Gold Member
MHB
Messages
799
Reaction score
15
I was reading this wikiperdia article on polyminos (https://en.wikipedia.org/wiki/Polyomino).

The pictures look very nice. Example

View attachment 8921
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.
 

Attachments

  • 800px-Conway_criterion_false_negative_nonominoes.svg.png
    800px-Conway_criterion_false_negative_nonominoes.svg.png
    5.9 KB · Views: 163
Physics news on Phys.org
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?
 
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.
 
Ackbach said:
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 - - -

Klaas van Aarsen said:
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!
 
caffeinemachine said:
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.
 
Klaas van Aarsen said:
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.