-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecies.cs
72 lines (63 loc) · 1.68 KB
/
Species.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NCAABasketball
{
class Species : IComparable
{
Operation op;
int numCorrect;
public Species(Operation operation)
{
this.op = operation;
this.numCorrect = 0;
}
public int CompareTo(Object other)
{
if (this.numCorrect == ((Species)other).numCorrect)
{
// If the same score, take smaller sized one
return((Species)other).op.size().CompareTo(this.op.size());
}
return this.numCorrect.CompareTo(((Species)other).numCorrect);
}
public void correctPrediction()
{
numCorrect++;
}
public void resetFitness()
{
numCorrect = 0;
}
public Operation getOp()
{
return op;
}
public int getNumCorrect()
{
return numCorrect;
}
public int Predict(TeamStats team1, TeamStats team2)
{
double team1Score = op.evaluate(team1, team2);
double team2Score = op.evaluate(team2, team1);
// If team1 scores higher, return 1
// If team2 scores higher, return 2
// Default to team1 if tie
if (team1Score >= team2Score)
{
return 1;
}
else
{
return 2;
}
}
public override string ToString()
{
return "CORRECT: " + numCorrect + " OPERATION: " + op.ToString();
}
}
}