Exilian

Game Design and Project Resources: The Workshops Quarter => Computer Game Development - The Indie Alley => Non-game Programs - The Tinkers' Workshop => Topic started by: Othko97 on November 23, 2015, 07:24:28 PM

Title: Quick Secret Santa Thing
Post by: Othko97 on November 23, 2015, 07:24:28 PM
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.
Title: Re: Quick Secret Santa Thing
Post by: comrade_general on November 23, 2015, 07:55:30 PM
I thought you meant we were going to do an Exilian secret Santa. :'(
Title: Re: Quick Secret Santa Thing
Post by: Jubal on November 23, 2015, 08:02:13 PM
We could do one, would anyone be up for it? Would provide a test drive for this software too!
Title: Re: Quick Secret Santa Thing
Post by: Othko97 on November 23, 2015, 08:11:33 PM
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...
Title: Re: Quick Secret Santa Thing
Post by: comrade_general on November 23, 2015, 08:17:55 PM
I would, hence the crying. Except I don't even know what to get the other people I need to get gifts for.
Title: Re: Quick Secret Santa Thing
Post by: Othko97 on November 23, 2015, 08:19:40 PM
I don't even know what I want for myself, let alone what to get other people. :P
Title: Re: Quick Secret Santa Thing
Post by: comrade_general on November 23, 2015, 08:53:23 PM
That too.