private async void AddPlayerButton_Click(object sender, EventArgs e)
{
graphBox.Image = null;
await PutTaskDelayShort();
Random rand = new Random();
int edgeNrTmp = edgeNr;
edgeNrTmp += rand.Next(N - 1) + 1;
Tuple<int[,], int[,]> t = ncManager.AddPlayerGenGraph(N, edgeNr, edgeNrTmp, graph, checkMatrix);
int[,] tmpGraph = t.Item1;
int[,] tmpCheckMatrix = t.Item2;
N++;
NoPTB.Text = N + "";
edgeNr = edgeNrTmp;
checkMatrix = new int[N, N];
checkMatrix = tmpCheckMatrix;
graph = new int[edgeNr, 2];
graph = tmpGraph;
int[] tmpColors = new int[N];
for (int i = 0; i < N - 1; i++)
{
tmpColors[i] = colors[i];
}
if (rand.Next(2) == 0)
{
tmpColors[N - 1] = 3; // Defector
nrDefTB.Text = (int.Parse(nrDefTB.Text) + 1) + "";
}
else
{
tmpColors[N - 1] = 4; // Cooperator
nc++;
NrCoopTB.Text = nc + "";
}
percTB.Text = (nc * 100 / N) + "";
colors = tmpColors;
selflesness = ncManager.AddPlayerGenSelflesness(N, selflesness);
DrawGraph();
}