home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5586 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.tau.ac.il!usenet
  2. From: Avi Lev <avil@sapiens.com>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Fixture List Algorithms?!
  5. Date: Sun, 17 Mar 1996 12:46:31 +0200
  6. Organization: Sapiens Technologies
  7. Message-ID: <314BED87.BC1@sapiens.com>
  8. References: <Do7JKq.Dot@cf.ac.uk>
  9. NNTP-Posting-Host: honda.sapiens.co.il
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. M Wood wrote:
  16. > I am considering writer (yet another...) football management simulation, one of the stumbling blocks being how to generate the set of fixtures. There must be a
  17. > Say, for example, there were 8 teams in a division, first week would be:
  18. > (Home team no. v Away team no.)
  19.  
  20. well, in total you have n!/(a!*(n-a)!) possible combinations, what you can do is to build all the 
  21. different combinations possible, storing them in some array, and then for each team choose 1 of 
  22. the 20 possible fixtures at random, making sure it wasn't selected by any previous fixture. that 
  23. way, you'll get a more realistic spread of fixtures since they're based on chance and that means 
  24. that one fixture can be selected more than once, as it should be.
  25.  
  26. legend:
  27. n = total number of teams.
  28. a = number of playing teams in each match (ie 2).
  29. ! = factorial function.
  30.  
  31. Avi Lev.
  32.