Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Fixture List for a set number of Weeks

I have seen some examples on forums but they don't seem to cater for what I need.

I am looking at creating a randomly generated fixture list for a football league.

I have 38 gameweeks, and anywhere between 2 and 20 teams in a league (all even numbers). What I need is the logic as to how to create the list.

I want to create a list which will look like the following:

Gameweek 1

A v B
C v D
E v F


Gamweeek 2

A v C
D v E
F v B

Does anyone have any ideas on how I can go about creating this?

like image 653
JackofAll Avatar asked Nov 27 '25 16:11

JackofAll


1 Answers

This sounds like a math problem! Specifically, permutations (with some recursion). Here are some examples I found with a quick google search:

http://www.codeguru.com/vb/gen/vb_misc/algorithms/article.php/c5607/Permutations-in-Visual-Basic--Generating-All-Possible-Combinations.htm

http://www.vb-helper.com/howto_2005_permute.html

Generate all real combinations in VB .NET

This examples should get you started. The last one seems more practical to what you want to do. If you get stuck along the way, post back.

like image 111
jason Avatar answered Nov 30 '25 04:11

jason



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!