Hello everyone,
I am currently working on a web app to mimic the alliance station possession and assist monitor for practice. I am having trouble thinking of a way to keep track of assists. As I have it now, most scenarios shown in this video work as they should, however some don’t.
This is my current method for keeping track:
if(robotNum == 'robot1' && zone == 'red' && !redZone && !rOneAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
redZone = true;
rOneAssist = true;
}
else if(robotNum == 'robot1' && zone == 'white' && !whiteZone && !rOneAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
whiteZone = true;
rOneAssist = true;
}
else if(robotNum == 'robot1' && zone == 'blue' && !blueZone && !rOneAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
blueZone = true;
rOneAssist = true;
}
else if(robotNum == 'robot2' && zone == 'blue' && !blueZone && !rTwoAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
blueZone = true;
rTwoAssist = true;
}
else if(robotNum == 'robot2' && zone == 'white' && !whiteZone && !rTwoAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
whiteZone = true;
rTwoAssist = true;
}
else if(robotNum == 'robot2' && zone == 'red' && !redZone && !rTwoAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
redZone = true;
rTwoAssist = true;
}
else if(robotNum == 'robot3' && zone == 'blue' && !blueZone && !rThreeAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
blueZone = true;
rThreeAssist = true;
}
else if(robotNum == 'robot3' && zone == 'white' && !whiteZone && !rThreeAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
whiteZone = true;
rThreeAssist = true;
}
else if(robotNum == 'robot3' && zone == 'red' && !redZone && !rThreeAssist) {
$('#' + robotNum).children('.' + zone).addClass('assist');
redZone = true;
rThreeAssist = true;
}
Basically, the way it works is whenever the possession of the ball changes, it checks if that zone has already had an assist, and if that robot has had an assist. The problem comes from the example at 3:10 of the video, when the awarded possession changes robots. Does anybody have a better formula for doing this?
Assists are a very confusing part of the game, which is one of the reasons why this is difficult for me to wrap my head around.