Quick Secret Santa Thing

Started by Othko97, November 23, 2015, 07:24:28 PM

Previous topic - Next topic

Othko97

With festivities approaching I made a thing which allocates a thing in a set of things to another thing in that same set of things. This is suitable for generating a Secret Santa Mapping, which was its original purpose, but it is also suitable for generating games of Assassin, or possibly unsolvable versions of those 15-puzzle things made of slidey squares, or basically just any bijective function f from a finite set X into itself such that for all x in X, x =/= f(x). Requires Python3 because cx_freeze is too much effort right now (and I will probably edit the thing if I ever get the motivation), and it generates a .txt file for each name containing the mapping for that name, plus one containing the full map, all contained within a folder. This is overwritten any time you run, so watch out for that. This is so that the mapping can be secret to everyone if you want it to be.


This works by selecting two elements at random and transposing them, then repeating this until no element maps to itself. Not exactly the most elegant solution, or the quickest, but meh, it works.


Have fun. Note there is also no guarantee the program will halt, it is entirely possible (but unlikely) that it will run for an inordinate amount of time. File name stands for SecretSantaScript, thought it was a fun little contraction.
I am Othko, He who fell from the highest of places, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them!


comrade_general

I thought you meant we were going to do an Exilian secret Santa. :'(

Jubal

We could do one, would anyone be up for it? Would provide a test drive for this software too!
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

Othko97

We could, we'd have to be pretty quick about it though seeing as we'll probably have to post stuff all over the place :P


EDIT: I also thought about making this able to work with email too, so it just emails a person who they're buying for, but email is miles over my head...
I am Othko, He who fell from the highest of places, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them!


comrade_general

I would, hence the crying. Except I don't even know what to get the other people I need to get gifts for.

Othko97

I don't even know what I want for myself, let alone what to get other people. :P
I am Othko, He who fell from the highest of places, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them!


comrade_general