-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
173 lines (137 loc) · 6.76 KB
/
game.py
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# game.py: define the form for the scout page
# Below is an example from Charged Up 2023.
import wtforms
from flask_wtf import FlaskForm
from wtforms import IntegerField, RadioField, TextAreaField, BooleanField, SelectField, StringField, FormField
from wtforms.validators import *
class ScoutForm(FlaskForm):
def fields(self):
return [key for key in self.__dict__.keys() if not key.startswith('_')]
class ChargedUpScoutForm(ScoutForm):
name = "Charged Up 2023"
matchNum = IntegerField('matchNumber', validators=[DataRequired()])
teamNum = IntegerField('teamNumber', validators=[DataRequired()])
autoHighCones = IntegerField('autoHighCones', validators=[DataRequired()], default=0)
autoHighCubes = IntegerField('autoHighCubes', validators=[DataRequired()], default=0)
autoMidCones = IntegerField('autoMidCones', validators=[DataRequired()], default=0)
autoMidCubes = IntegerField('autoMidCubes', validators=[DataRequired()], default=0)
autoLowCones = IntegerField('autoLowCones', validators=[DataRequired()], default=0)
autoLowCubes = IntegerField('autoLowCubes', validators=[DataRequired()], default=0)
teleopHighCones = IntegerField('teleopHighCones', validators=[DataRequired()], default=0)
teleopHighCubes = IntegerField('teleopHighCubes', validators=[DataRequired()], default=0)
teleopMidCones = IntegerField('teleopMidCones', validators=[DataRequired()], default=0)
teleopMidCubes = IntegerField('teleopMidCubes', validators=[DataRequired()], default=0)
teleopLowCones = IntegerField('teleopLowCones', validators=[DataRequired()], default=0)
teleopLowCubes = IntegerField('teleopLowCubes', validators=[DataRequired()], default=0)
defense = RadioField('defense', validators=[DataRequired()], choices=[
('none', 'Did not play defense'),
('poor', 'Poor defense'),
('average', 'Average defense'),
('excellent', 'Excellent defense!')
])
sub = RadioField('sub', validators=[DataRequired()], choices=[
('single', 'Single substation'),
('double', 'Double substation'),
('both', 'Used both substations'),
])
droppedPieces = IntegerField('Dropped Pieces', validators=[DataRequired()])
info = TextAreaField('info', validators=[DataRequired()])
class UltimateAscentScoutForm(ScoutForm):
name = "Ultimate Ascent 2013"
matchNum = IntegerField('matchNumber', validators=[DataRequired()])
teamNum = IntegerField('teamNumber', validators=[DataRequired()])
discsScored = IntegerField('discsScored', validators=[DataRequired()])
discsMissed = IntegerField('discsMissed', validators=[DataRequired()])
climb = RadioField('climb', validators=[DataRequired()], choices=[
(0, 'No climb'),
(1, 'First level'),
(2, 'Second level'),
(3, 'Third level'),
])
info = TextAreaField('info', validators=[DataRequired()])
class CrescendoForm(FlaskForm):
name = "Crescendo 2024"
# Basic match and team information
matchNum = IntegerField('matchNumber', validators=[DataRequired()])
teamNum = IntegerField('teamNumber', validators=[DataRequired()])
scoutID = StringField('scoutID', validators=[DataRequired()])
# Autonomous (15 seconds)
autoMobility = BooleanField('autoMobility', default=False)
autoAmp = IntegerField('autoAmp', validators=[DataRequired()], default=0)
autoSpeaker = IntegerField('autoSpeaker', validators=[DataRequired()], default=0)
# Teleoperated (135 seconds)
teleopAmp = IntegerField('teleopAmp', validators=[DataRequired()], default=0)
teleopSpeaker = IntegerField('teleopSpeaker', validators=[DataRequired()], default=0)
teleopAmplified = IntegerField('teleopAmplified', validators=[DataRequired()], default=0)
# Endgame
trap = IntegerField('trap', validators=[DataRequired()], default=0)
climb = SelectField('climb', validators=[DataRequired()], choices=[
('none', 'None'),
('park', 'Park'),
('single', 'Single'),
('double', 'Double'),
('triple', 'Triple'),
])
spotlight = BooleanField('spotlight', default=False)
droppedPieces = IntegerField('Dropped Pieces / Missed Shots', validators=[DataRequired()], default=0)
passedNotes = IntegerField('Passed notes', validators=[DataRequired()], default=0)
# Other info
intake = RadioField('intake', validators=[DataRequired()], choices=[
('none', 'Intake failed/was not used'),
('human', 'Human Player Only'),
('ground', 'Ground Only'),
('both', 'Both'),
])
# defense = RadioField('defense', validators=[DataRequired()], choices=[
# #('null', 'Unsure'),
# ('none', 'Did not play defense'),
# ('poor', 'Poor defense'),
# ('average', 'Average defense'),
# ('excellent', 'Excellent defense')
# ])
# driving = RadioField('driving', validators=[DataRequired()], choices=[
# #('null', 'Unsure'),
# ('none', 'Immobile'),
# ('poor', 'Clunky/Awkward'),
# ('average', 'Average'),
# ('excellent', 'Smooth/Skilled')
# ])
fouls = RadioField('fouls (list in notes)', validators=[DataRequired()], choices=[
('none', 'No fouls'),
('some', '1-2 fouls'),
('many', '3+ fouls')
])
freeze = RadioField('Did the robot freeze/disconnect at any time?', validators=[DataRequired()], choices=[
(False, 'No'),
(True, 'Yes')
])
# info = TextAreaField('info', validators=[DataRequired(), Length(min=10)])
class SubjectiveRobotData(FlaskForm):
role = RadioField('role', validators=[DataRequired()], choices=[
('offense', 'Offense'),
('defense', 'Defense'),
('passing', 'Passing')
])
defense = RadioField('defense', validators=[DataRequired()], choices=[
('none', 'Did not play defense'),
('poor', 'Poor defense'),
('average', 'Average defense'),
('excellent', 'Excellent defense')
])
driving = RadioField('driving', validators=[DataRequired()], choices=[
('none', 'Immobile'),
('poor', 'Clunky/Awkward'),
('average', 'Average'),
('excellent', 'Smooth/Skilled')
])
info = TextAreaField('info', validators=[DataRequired(), Length(min=10)])
class CrescendoSuperScoutForm(FlaskForm):
# Basic match and team information
matchNum = IntegerField('matchNumber', validators=[DataRequired()])
teamNum = IntegerField('teamNumber', validators=[DataRequired()])
scoutID = StringField('scoutID', validators=[DataRequired()])
robot1 = FormField(SubjectiveRobotData)
robot2 = FormField(SubjectiveRobotData)
robot3 = FormField(SubjectiveRobotData)
redAmps = IntegerField('redAmps', validators=[DataRequired()], default=0)
blueAmps = IntegerField('blueAmps', validators=[DataRequired()], default=0)