2013-10-22 The group decided to change seats once a week. It's always diffi- cult to find a new distribution that satisfies all wishes. To provide an alternative approach, I wrote a small programm to gen- erate random distributions. This way, the decision, who sits where and next to whom, would be transferred to the neutral com- puter. The complication was, that some people wanted to keep their seat, for some reasons. Hence, only a subset of us needed to be distributed to a subset of the seats. First, I solved the problem by shuffling (`sort -R') the list of people who want to move and then putting them, one after the oth- er, onto the empty seats (with awk). This was a quick hack, written in a few minutes. [0] Then two of the group told me, that they would also like to move to other seats but not to all of them, just to a subset of the available seats. I thought, that was a pretty fair wish and thus my program should support it. In consequence, however, the naive approach wasn't sufficient anymore. I started over again. [1] I decided to stick to awk to solve the problem. The new script reads in a list of names and the seats they would accept. (Those who don't want to move have only one seat mentioned. Those who don't care have `*' as a shortcut for the full list.) The script reads this data. It tries to fill the names into a list of avail- able seats. Those who accept only one seat are put there at once. The others are randomly distributed afterwards. First those who accept the least number of seats, later those who are more flexi- ble. The random distribution is dumb. The program just tries to put them somewhere, assuming, that this approach will succeed. No backtracking is done, because I thought it wasn't worth the costs. I consider this decision appropriate as the distribution will succeed almost always. If not I'd just re-run the script. This will waste less time than writing the backtracking stuff (correctly!). The script generates pic(1)-output, which is then rendered with troff(1) to PostScript and then converted to PDF. The textual representation is done with `pdftotext -layout' because that pro- vided better results than generating text right away with nroff(1). [0] http://marmaro.de/prog/various/seating-plan/version1/ [1] http://marmaro.de/prog/various/seating-plan/version2/ http://marmaro.de/lue/ markus schnalke