|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Keeping Track of Assists
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: Code:
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;
}
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. |
|
#2
|
||||
|
||||
|
Re: Keeping Track of Assists
How about this:
1) Make a list of all pairs of all robot/zone combinations 2) Make all permutations of these items that are length 3 or less 3) Remove anything that uses the same robot or the same zone more than once 4) Output the max length of anything that's left |
|
#3
|
|||
|
|||
|
Re: Keeping Track of Assists
Few questions:
1) Does the list contain only the combinations since the start of the cycle, or all possible combinations(9)? 2) Could you explain how I would then permute that list? 3) How would I use the max length to determine which robot gets the assist? Thanks for your help! |
|
#4
|
||||
|
||||
|
Re: Keeping Track of Assists
Quote:
For example, if both robot A and robot B each hold the ball but each only holds it in the white zone who should get the credit? It doesn't matter for scoring. |
|
#5
|
|||
|
|||
|
Re: Keeping Track of Assists
I know that which robot gets the assist doesn't matter, however, I am trying the simulate the alliance monitor, which does show which robot got the assist, and where.
|
|
#6
|
||||||
|
||||||
|
Re: Keeping Track of Assists
Quote:
Since FIRST doesn't release the details to make it work exactly the same as their implementation, I would try to make it the most reasonable way and not spend too much time worrying if it matches exactly. I would re-evaluate at each possession/zone change and use whichever gives the highest score at that time. If there are multiple permutations with the same score, I would use the same combination that was used in the last evaluation. |
|
#7
|
||||
|
||||
|
Re: Keeping Track of Assists
To make the method that I mentioned more concrete, here's a C++ implementation. Note that it hasn't been optimized at all and uses C++11 features.
|
|
#8
|
|||
|
|||
|
Would somebody be able to explain the permutation process?
Do I permutate each combination of robot/zone (r1red, r2white...) or each object (r1, red, r2, white...)? |
|
#9
|
||||
|
||||
|
Re: Keeping Track of Assists
Have you tried running the code? I think that if you print out the data structures as it runs it might become more clear.
|
|
#10
|
|||
|
|||
|
Re: Keeping Track of Assists
I have run the code, however I'm not exactly fluent in c++, so it is hard for me to figure out what and how to print the correct things.
|
|
#11
|
||||
|
||||
|
Re: Keeping Track of Assists
Ok, try this.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|