/* ASBaseballBuildSchedule.cpp */

/******************************************************************************/
/******************************************************************************/

#include "CBldVCL.h"
#pragma hdrstop

#include "ASBaseballBuildSchedule.h"

namespace asbaseball
{

/******************************************************************************/

static StaticBuildScheduleGame gEightTeamStaticScheduleGameList[] =
{
	{ 0,	1 },
	{ 2,	3 },
	{ 4,	5 },
	{ 6,	7 },
	{ 1,	0 },
	{ 3,	2 },
	{ 5,	4 },
	{ 7,	6 },
	{ 0,	4 },
	{ 1,	5 },
	{ 2,	6 },
	{ 3,	7 },
	{ 0,	5 },
	{ 1,	6 },
	{ 7,	2 },
	{ 4,	3 },
	{ 1,	0 },
	{ 3,	2 },
	{ 5,	4 },
	{ 7,	6 },
	{ 1,	0 },
	{ 4,	2 },
	{ 5,	3 },
	{ 7,	6 },
	{ 0,	6 },
	{ 1,	7 },
	{ 5,	2 },
	{ 3,	4 },
	{ 0,	7 },
	{ 1,	2 },
	{ 3,	6 },
	{ 5,	4 },
	{ 6,	7 },
	{ 2,	4 },
	{ 3,	0 },
	{ 5,	1 },
	{ 4,	1 },
	{ 7,	3 },
	{ 6,	0 },
	{ 2,	5 },
	{ 6,	3 },
	{ 4,	5 },
	{ 7,	1 },
	{ 0,	2 },
	{ 3,	5 },
	{ 2,	7 },
	{ 0,	1 },
	{ 6,	4 },
	{ 6,	7 },
	{ 2,	3 },
	{ 1,	4 },
	{ 5,	0 },
	{ 5,	7 },
	{ 4,	6 },
	{ 3,	2 },
	{ 0,	1 },
	{ 2,	0 },
	{ 3,	1 },
	{ 4,	6 },
	{ 7,	5 },
	{ 5,	6 },
	{ 7,	4 },
	{ 3,	0 },
	{ 1,	2 },
	{ 2,	1 },
	{ 0,	3 },
	{ 4,	6 },
	{ 5,	7 },
	{ 3,	0 },
	{ 2,	1 },
	{ 4,	7 },
	{ 6,	5 },
	{ 6,	4 },
	{ 1,	3 },
	{ 2,	0 },
	{ 7,	5 },
	{ 6,	2 },
	{ 3,	1 },
	{ 7,	0 },
	{ 4,	5 },
	{ 5,	6 },
	{ 7,	4 },
	{ 0,	2 },
	{ 1,	3 },
	{ 1,	2 },
	{ 0,	3 },
	{ 5,	7 },
	{ 6,	4 },
	{ 4,	7 },
	{ 6,	5 },
	{ 2,	0 },
	{ 3,	1 },
	{ 1,	3 },
	{ 7,	4 },
	{ 0,	2 },
	{ 5,	6 },
	{ 4,	0 },
	{ 2,	3 },
	{ 6,	1 },
	{ 7,	5 },
	{ 0,	3 },
	{ 2,	1 },
	{ 4,	7 },
	{ 6,	5 },
};

static int gEightTeamStaticScheduleGameListCount =
	sizeof(gEightTeamStaticScheduleGameList)/sizeof(*gEightTeamStaticScheduleGameList);

/******************************************************************************/

static StaticBuildScheduleGame gTenTeamStaticScheduleGameList[] =
{
//Game: 1
	{ 2,	0 },	{ 3,	1 },	{ 8,	4 },	{ 7,	5 },	{ 9,	6 },
//Game: 2
	{ 9,	0 },	{ 8,	1 },	{ 7,	2 },	{ 4,	3 },	{ 6,	5 },
//Game: 3
	{ 0,	3 },	{ 1,	4 },	{ 2,	5 },	{ 6,	8 },	{ 7,	9 },
//Game: 4
	{ 0,	8 },	{ 5,	9 },	{ 3,	6 },	{ 1,	7 },	{ 2,	4 },
//Game: 5
	{ 6,	0 },	{ 4,	1 },	{ 9,	2 },	{ 5,	3 },	{ 8,	7 },
//Game: 6
	{ 0,	3 },	{ 1,	2 },	{ 4,	9 },	{ 5,	8 },	{ 6,	7 },
//Game: 7
	{ 4,	0 },	{ 9,	1 },	{ 8,	2 },	{ 7,	3 },	{ 6,	5 },
//Game: 8
	{ 0,	5 },	{ 1,	2 },	{ 3,	4 },	{ 6,	8 },	{ 7,	9 },
//Game: 9
	{ 7,	0 },	{ 6,	1 },	{ 4,	2 },	{ 8,	3 },	{ 9,	5 },
//Game: 10
	{ 0,	4 },	{ 1,	5 },	{ 2,	6 },	{ 3,	9 },	{ 7,	8 },
//Game: 11
	{ 2,	0 },	{ 3,	1 },	{ 7,	4 },	{ 8,	5 },	{ 9,	6 },
//Game: 12
	{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2 },
	{ 8,	3 },
	{ 9,	5 },
	{ 0,	8 },
	{ 5,	9 },
	{ 3,	6 },
	{ 1,	7 },
	{ 2,	4 },
	{ 8,	0 },
	{ 9,	5 },
	{ 6,	3 },
	{ 7,	1 },
	{ 4,	2 },
	{ 0,	9 },
	{ 1,	8 },
	{ 2,	7 },
	{ 3,	4 },
	{ 5,	6 },
	{ 9,	0 },
	{ 8,	1 },
	{ 7,	2 },
	{ 4,	3 },
	{ 6,	5 },
*/
};

static int gTenTeamStaticScheduleGameListCount =
	sizeof(gTenTeamStaticScheduleGameList)/sizeof(*gTenTeamStaticScheduleGameList);

/******************************************************************************/
/******************************************************************************/

StaticBuildScheduleGame* ASBaseballBuildSchedule::getStaticScheduleGameList(
	int numTeams,int& numGames)
{
	StaticBuildScheduleGame* gameList;

	if(numTeams == 8)
	{
		gameList = gEightTeamStaticScheduleGameList;
		numGames = gEightTeamStaticScheduleGameListCount;
	}
	else if(numTeams == 10)
	{
		gameList = gTenTeamStaticScheduleGameList;
		numGames = gTenTeamStaticScheduleGameListCount;
	}
	else
		throw ASIException("ASBaseballBuildSchedule::getStaticScheduleGameList: "
			"unsupported number of teams");

	return(gameList);
}

/******************************************************************************/

}; //asbaseball

/******************************************************************************/
/******************************************************************************/
