Author Topic: Quick Secret Santa Thing  (Read 750 times)

Othko97

  • SotK Beta
  • Patrikios
    Voting Member
  • Posts: 3172
  • Karma: 9
    • View Profile
    • Awards
Quick Secret Santa Thing
« 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.
« Last Edit: November 23, 2015, 08:20:35 PM by Othko97 »
Alcohol and Calculus don't mix. Never Drink and Derive.

I am Othko, the master of the 23 techniques of death, murder of the 8 popes, victor of the never ending war, he who fell from the highest of places, second of his cloning, most noble swords-bearer, Ninety-Seventh of His Name, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them! Apparently, at any rate.

comrade_general

  • Eternal Despot of RTW
  • Posts: 17511
  • Karma: 86
  • 100% Prime Angus Beef
  • Awards Awarded for oustanding services to Exilian!
    • View Profile
    • Exilian
    • Awards
Re: Quick Secret Santa Thing
« Reply #1 on: November 23, 2015, 07:55:30 PM »
I thought you meant we were going to do an Exilian secret Santa. :'(

Jubal

  • Megadux
    Executive Officer
  • Posts: 22679
  • Karma: 104
  • Awards Awarded for oustanding services to Exilian!
    • View Profile
    • Awards
Re: Quick Secret Santa Thing
« Reply #2 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!
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

Othko97

  • SotK Beta
  • Patrikios
    Voting Member
  • Posts: 3172
  • Karma: 9
    • View Profile
    • Awards
Re: Quick Secret Santa Thing
« Reply #3 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...
Alcohol and Calculus don't mix. Never Drink and Derive.

I am Othko, the master of the 23 techniques of death, murder of the 8 popes, victor of the never ending war, he who fell from the highest of places, second of his cloning, most noble swords-bearer, Ninety-Seventh of His Name, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them! Apparently, at any rate.

comrade_general

  • Eternal Despot of RTW
  • Posts: 17511
  • Karma: 86
  • 100% Prime Angus Beef
  • Awards Awarded for oustanding services to Exilian!
    • View Profile
    • Exilian
    • Awards
Re: Quick Secret Santa Thing
« Reply #4 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.

Othko97

  • SotK Beta
  • Patrikios
    Voting Member
  • Posts: 3172
  • Karma: 9
    • View Profile
    • Awards
Re: Quick Secret Santa Thing
« Reply #5 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
Alcohol and Calculus don't mix. Never Drink and Derive.

I am Othko, the master of the 23 techniques of death, murder of the 8 popes, victor of the never ending war, he who fell from the highest of places, second of his cloning, most noble swords-bearer, Ninety-Seventh of His Name, Lord of That Bit Between High Places and Low Places Through Which One Falls In Transit Between them! Apparently, at any rate.

comrade_general

  • Eternal Despot of RTW
  • Posts: 17511
  • Karma: 86
  • 100% Prime Angus Beef
  • Awards Awarded for oustanding services to Exilian!
    • View Profile
    • Exilian
    • Awards
Re: Quick Secret Santa Thing
« Reply #6 on: November 23, 2015, 08:53:23 PM »
That too.