pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin private pastebin - collaborative debugging tool What's a private pastebin?

Posted by frymaster on Fri 20th Jul 01:11
download | new post

  1. data collection
  2. ---------------
  3. create a dict of lists (authors)
  4. the key for each is the author name, the value is the list of tracks, shuffled
  5.  
  6.  
  7. Algorithmy-thing
  8. ----------------
  9.  
  10. set "previousAuthor" var to None
  11. set stillStuffToDo=True
  12. while stillStuffToDo==True:
  13.   variable mostRemainingChoices=0
  14.   for each author in the authors:
  15.     if they are NOT the previousAuthor
  16.       if len(authors[author]) > mostRemainingChoices:
  17.         mostRemainingChoices = len(authors[author])
  18.   if mostRemainingChoices = 0:                              (which can only happen if the only possible choice is the previousAuthor)
  19.     mostRemainingChoices = len(authors[previousAuthor])     (We're going to be forced to have more than one track by the same guy, but he MUST have > 50% then)
  20.   variable choices = empty list
  21.   for each author in the authors.keys():
  22.     if len(authors[author]) = mostRemainingChoices:
  23.       append author's name to choices
  24.   randomly choose an author from the list to have their track added
  25.   pop track from the author's list and add it
  26.   stillStuffToDo=False
  27.   for each author in the authors:
  28.     if len(authors[author]) > 0:              (there's still tracks to be added)
  29.       stillStuffToDo=True
  30.       break

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@


Remember my settings