Skip to content

Commit 37fc379

Browse files
authored
Merge pull request #535 from Decatur-Robotics/Rebuilt
2 parents f785980 + 876070f commit 37fc379

File tree

4 files changed

+145
-108
lines changed

4 files changed

+145
-108
lines changed

lib/Enums.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export namespace ReefscapeEnums {
111111
}
112112

113113
export namespace RebuiltEnums {
114-
export enum ClimbingAbilities {
114+
export enum ClimbingCapabilities {
115115
No = "No",
116116
FirstLevel = "FirstLevel",
117117
SecondLevel = "SecondLevel",
@@ -136,14 +136,6 @@ export namespace RebuiltEnums {
136136
Second = "Second",
137137
Third = "Third",
138138
}
139-
140-
export enum AutoAbilities {
141-
NoAuto = "No Auto",
142-
MovePastStart = "Move Past Start",
143-
ClimbLevelOne = "Climb Level One",
144-
ScoreOneOrMoreFuel = "Score One Or More Fuel",
145-
ScoreFuelAndClimb = "Score Fuel And Climb",
146-
}
147139
}
148140

149141
export namespace DecodeEnums {

lib/Layout.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ export function keyToType(
219219
ReefscapeEnums.Climbing,
220220
ReefscapeEnums.DriveThroughDeepCage,
221221
ReefscapeEnums.EndgameClimbStatus,
222-
RebuiltEnums.AutoAbilities,
223-
RebuiltEnums.ClimbingAbilities,
222+
//RebuiltEnums.AutoAbilities,
223+
RebuiltEnums.ClimbingCapabilities,
224224
RebuiltEnums.DriveOverBump,
225225
RebuiltEnums.DriveUnderTrench,
226226
RebuiltEnums.LevelClimbed,
@@ -240,8 +240,8 @@ export function keyToType(
240240
if (key == "DriveThroughDeepCage") return ReefscapeEnums.DriveThroughDeepCage;
241241
if (key == "EndgameClimbStatus") return ReefscapeEnums.EndgameClimbStatus;
242242

243-
if (key == "AutoAbilities") return RebuiltEnums.AutoAbilities;
244-
if (key == "ClimbingAbilities") return RebuiltEnums.ClimbingAbilities;
243+
//if (key == "AutoAbilities") return RebuiltEnums.AutoAbilities;
244+
if (key == "ClimbingCapabilities") return RebuiltEnums.ClimbingCapabilities;
245245
if (key == "DriveOverBump") return RebuiltEnums.DriveOverBump;
246246
if (key == "DiveUnderTrench") return RebuiltEnums.DriveUnderTrench;
247247
if (key == "LevelClimbed") return RebuiltEnums.LevelClimbed;

lib/games.ts

Lines changed: 100 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,10 @@ namespace Reefscape {
18981898

18991899
export namespace Rebuilt {
19001900
export class QuantitativeData extends QuantData {
1901+
AutoFuelPointsOne: number = 0;
1902+
AutoFuelPointsFive: number = 0;
1903+
AutoFuelPointsTen: number = 0;
1904+
19011905
FuelPointsOne: number = 0;
19021906
FuelPointsFive: number = 0;
19031907
FuelPointsTen: number = 0;
@@ -1908,25 +1912,23 @@ export namespace Rebuilt {
19081912
LevelClimbed: RebuiltEnums.LevelClimbed = RebuiltEnums.LevelClimbed.No;
19091913
}
19101914
export class PitData extends PitReportData {
1911-
GroundIntake: boolean = false;
19121915
CanDriveOverBump: boolean = false;
19131916
CanDriveUnderTrench: boolean = false;
19141917
CanDeClimb: boolean = false;
1915-
CanScoreFuel: boolean = false;
19161918
HopperVolume: number = 0;
1917-
AutoAbilities: RebuiltEnums.AutoAbilities =
1918-
RebuiltEnums.AutoAbilities.NoAuto;
1919-
ClimbingAbilities: RebuiltEnums.ClimbingAbilities =
1920-
RebuiltEnums.ClimbingAbilities.No;
1919+
RobotWeight: number = 0;
1920+
RobotWidth: number = 0;
1921+
RobotLength: number = 0;
1922+
AutoAbilities: string = "";
1923+
ClimbingCapabilities: RebuiltEnums.ClimbingCapabilities =
1924+
RebuiltEnums.ClimbingCapabilities.No;
19211925
}
19221926
const pitReportLayout: FormLayoutProps<PitData> = {
19231927
Capabilities: [
1924-
{ key: "GroundIntake", label: "Has Ground Intake?" },
19251928
{ key: "CanDriveOverBump", label: "Can Drive Over Bump?" },
19261929
{ key: "CanDriveUnderTrench", label: "Can Drive Under Trench?" },
19271930
{ key: "CanDeClimb", label: "Can De-Climb?" },
1928-
{ key: "CanScoreFuel", label: "Can Score Fuel?" },
1929-
{ key: "ClimbingAbilites", label: "Climbing?" },
1931+
{ key: "ClimbingCapabilities", label: "Climbing?" },
19301932
{ key: "HopperVolume", label: "Hopper Volume?" },
19311933
],
19321934
Auto: [{ key: "AutoAbilities", label: "Auto Capabilities?" }],
@@ -1937,20 +1939,20 @@ export namespace Rebuilt {
19371939
[
19381940
[
19391941
{
1940-
key: "FuelPointsOne",
1941-
label: "One point",
1942+
key: "AutoFuelPointsOne",
1943+
label: "Auto One point",
19421944
},
19431945
],
19441946
[
19451947
{
1946-
key: "FuelPointsFive",
1947-
label: "Five points",
1948+
key: "AutoFuelPointsFive",
1949+
label: "Auto Five points",
19481950
},
19491951
],
19501952
[
19511953
{
1952-
key: "FuelPointsTen",
1953-
label: "Ten points",
1954+
key: "AutoFuelPointsTen",
1955+
label: "Auto Ten points",
19541956
},
19551957
],
19561958
],
@@ -1960,29 +1962,60 @@ export namespace Rebuilt {
19601962
[
19611963
{
19621964
key: "FuelPointsOne",
1963-
label: "One point",
1965+
label: "Teleop One point",
19641966
},
19651967
],
19661968
[
19671969
{
19681970
key: "FuelPointsFive",
1969-
label: "Five points",
1971+
label: "Teleop Five points",
19701972
},
19711973
],
19721974
[
19731975
{
19741976
key: "FuelPointsTen",
1975-
label: "Ten points",
1977+
label: "TeleopTen points",
19761978
},
19771979
],
19781980
],
19791981
],
1980-
"Post Match": ["LevelClimbed", "Defense"],
1982+
"Post Match": ["LevelClimbed", "EngameDefenseStatus"],
19811983
};
19821984

19831985
const statsLayout: StatsLayout<PitData, QuantitativeData> = {
19841986
sections: {
1985-
Auto: [],
1987+
Auto: [
1988+
{
1989+
label: "Total Auto Fuel Points Scored By Alliance",
1990+
get(pitData, quantitativeReports) {
1991+
return (
1992+
NumericalTotal("AutoFuelPointsOne", quantitativeReports!) +
1993+
NumericalTotal("AutoFuelPointsFive", quantitativeReports!) * 5 +
1994+
NumericalTotal("AutoFuelPointsTen", quantitativeReports!) * 10
1995+
);
1996+
},
1997+
},
1998+
{
1999+
label: "< Min Auto Fuel Points Scored By Alliance",
2000+
get(pitData, quantitativeReports) {
2001+
return (
2002+
GetMinimum(quantitativeReports!, "AutoFuelPointsOne") +
2003+
GetMinimum(quantitativeReports!, "AutoFuelPointsFive") * 5 +
2004+
GetMinimum(quantitativeReports!, "AutoFuelPointsTen") * 10
2005+
);
2006+
},
2007+
},
2008+
{
2009+
label: "< Max Auto Fuel Points Scored By Alliance",
2010+
get(pitData, quantitativeReports) {
2011+
return (
2012+
GetMaximum(quantitativeReports!, "AutoFuelPointsOne") +
2013+
GetMaximum(quantitativeReports!, "AutoFuelPointsFive") * 5 +
2014+
GetMaximum(quantitativeReports!, "AutoFuelPointsTen") * 10
2015+
);
2016+
},
2017+
},
2018+
],
19862019
Teleop: [
19872020
{
19882021
label: "Total Fuel Points Scored By Alliance",
@@ -2025,21 +2058,53 @@ export namespace Rebuilt {
20252058
};
20262059

20272060
const pitStatsLayout: PitStatsLayout<PitData, QuantitativeData> = {
2028-
overallSlideStats: [],
2061+
overallSlideStats: [
2062+
{
2063+
label: "Estamate Hopper Volume",
2064+
key: "HopperVolume",
2065+
},
2066+
{
2067+
label: "RobotWeight",
2068+
key: "RobotWeight",
2069+
},
2070+
{
2071+
label: "Robot Width",
2072+
key: "RobotWidth",
2073+
},
2074+
{
2075+
label: "Robot Length",
2076+
key: "RobotLength",
2077+
},
2078+
],
20292079
individualSlideStats: [
20302080
{
2031-
label: "Average Points",
2081+
label: "Average Auto Points",
20322082
get: (
20332083
pitReport: Pitreport<PitData> | undefined,
20342084
quantitativeReports: Report<QuantitativeData>[] | undefined,
20352085
) => {
20362086
if (!quantitativeReports) return 0;
20372087

2038-
const TotalAllianceFuelPoints =
2088+
const TotalAutoAllianceFuelPoints =
2089+
NumericalTotal("AutoFuelPointsOne", quantitativeReports) +
2090+
NumericalTotal("AutoFuelPointsFive", quantitativeReports) * 5 +
2091+
NumericalTotal("AutoFuelPointsTen", quantitativeReports) * 10;
2092+
return TotalAutoAllianceFuelPoints / quantitativeReports.length;
2093+
},
2094+
},
2095+
{
2096+
label: "Average Teleop Points",
2097+
get: (
2098+
pitReport: Pitreport<PitData> | undefined,
2099+
quantitativeReports: Report<QuantitativeData>[] | undefined,
2100+
) => {
2101+
if (!quantitativeReports) return 0;
2102+
2103+
const TotalTeleopAllianceFuelPoints =
20392104
NumericalTotal("FuelPointsOne", quantitativeReports) +
20402105
NumericalTotal("FuelPointsFive", quantitativeReports) * 5 +
20412106
NumericalTotal("FuelPointsTen", quantitativeReports) * 10;
2042-
return TotalAllianceFuelPoints / quantitativeReports.length;
2107+
return TotalTeleopAllianceFuelPoints / quantitativeReports.length;
20432108
},
20442109
},
20452110
{
@@ -2056,12 +2121,10 @@ export namespace Rebuilt {
20562121
},
20572122
],
20582123
robotCapabilities: [
2059-
{ key: "GroundIntake", label: "Has Ground Intake?" },
20602124
{ key: "CanDriveOverBump", label: "Can Drive Over Bump?" },
20612125
{ key: "CanDriveUnderTrench", label: "Can Drive Under Trench?" },
20622126
{ key: "CanDeClimb", label: "Can De-Climb?" },
2063-
{ key: "CanScoreFuel", label: "Can Score Fuel?" },
2064-
{ key: "ClimbingAbilities", label: "Climbing?" },
2127+
{ key: "ClimbingCapabilities", label: "Climbing?" },
20652128
],
20662129
graphStat: {
20672130
label: "Average Fuel Scored In Hopper",
@@ -2076,30 +2139,26 @@ export namespace Rebuilt {
20762139
) {
20772140
const badges: Badge[] = getBaseBadges(pitReport, quantitativeReports);
20782141

2079-
if (pitReport?.data?.GroundIntake)
2080-
badges.push({ text: "Can Use Ground Intake", color: "primary" });
20812142
if (pitReport?.data?.CanDriveOverBump)
20822143
badges.push({ text: "Can Drive Over Bump", color: "accent" });
20832144
if (pitReport?.data?.CanDriveUnderTrench)
20842145
badges.push({ text: "Can Drive Under Trench", color: "accent" });
20852146
if (pitReport?.data?.CanDeClimb)
20862147
badges.push({ text: "Can Declimb", color: "accent" });
2087-
if (!pitReport?.data?.CanScoreFuel)
2088-
badges.push({ text: "Can't Score Fuel", color: "warning" });
20892148

20902149
if (
2091-
pitReport?.data?.ClimbingAbilities ===
2092-
RebuiltEnums.ClimbingAbilities.FirstLevel
2150+
pitReport?.data?.ClimbingCapabilities ===
2151+
RebuiltEnums.ClimbingCapabilities.FirstLevel
20932152
)
20942153
badges.push({ text: "Can Climb First Level", color: "accent" });
20952154
else if (
2096-
pitReport?.data?.ClimbingAbilities ===
2097-
RebuiltEnums.ClimbingAbilities.SecondLevel
2155+
pitReport?.data?.ClimbingCapabilities ===
2156+
RebuiltEnums.ClimbingCapabilities.SecondLevel
20982157
)
20992158
badges.push({ text: "Can Climb Second Level", color: "accent" });
21002159
else if (
2101-
pitReport?.data?.ClimbingAbilities ===
2102-
RebuiltEnums.ClimbingAbilities.ThirdLevel
2160+
pitReport?.data?.ClimbingCapabilities ===
2161+
RebuiltEnums.ClimbingCapabilities.ThirdLevel
21032162
)
21042163
badges.push({ text: "Can Climb Third Level", color: "accent" });
21052164

@@ -2126,9 +2185,9 @@ export namespace Rebuilt {
21262185
break;
21272186
}
21282187
totalPoints +=
2129-
Number(report.FuelPointsOne) +
2130-
Number(report.FuelPointsFive) * 5 +
2131-
Number(report.FuelPointsTen) * 10;
2188+
Number(report.FuelPointsOne + report.AutoFuelPointsOne) +
2189+
Number(report.FuelPointsFive + report.AutoFuelPointsOne) * 5 +
2190+
Number(report.FuelPointsTen + report.AutoFuelPointsOne) * 10;
21322191
}
21332192
return totalPoints / Math.max(reports.length, 1);
21342193
}
@@ -2195,7 +2254,7 @@ export namespace Decode {
21952254

21962255
const quantitativeReportLayout: FormLayoutProps<QuantitativeData> = {
21972256
Auto: [
2198-
{ key: "AutoMovedPastStart", label: "Moved Past Starting line" },
2257+
{ key: "AutoMovedPastStartingLine", label: "Moved Past Starting line" },
21992258
[
22002259
[
22012260
{

0 commit comments

Comments
 (0)