Advertisement
Guest User

Matches Sample Code

a guest
Feb 28th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.84 KB | None | 0 0
  1. public static void main(String[] args) {
  2.         // Setup our API id
  3.         TBA.setID("Test", "Test description", "V1");
  4.         // Make sure these settings are set to true
  5.         Settings.GET_EVENT_MATCHES = true;
  6.         Settings.GET_EVENT_ALLIANCES = true;
  7.         // Get the event (in this case, we're using an event key, put you could also pull from a list of events with .getEvents(year))
  8.         Event event = new TBA().getEvent("2016casd");
  9.         Match[] matches = event.matches;
  10.         for(int i = 0; i < matches.length; i++) {
  11.              // The comp level variable should include an indentifier for whether it's practice, qualifying, or playoff, let me know if you need more help on this
  12.             // Just print some general information, you can add more variables if you want, just use matches[i].var
  13.             System.out.println("Match name: "+matches[i].comp_level + " Set number: "+matches[i].set_number+" Time (in ms): "+matches[i].time);
  14.         }
  15.         // Print out a list of item names + the red team's score for each of them. This just prints out the scores for one matches
  16.         for(int j = 0; j < matches[0].redValues.length; j++) {
  17.             System.out.println("Item: "+matches[0].scorableItems[j] + " Value: "+matches[0].redValues[j]);
  18.         }
  19.         // Print out alliance picks and declines
  20.         for(int i = 0; i < event.alliances.length; i++) {
  21.             System.out.println("Alliance name: "+event.alliances[i].name);
  22.             System.out.println("Picks: "+event.alliances[i].picks[0]+","+event.alliances[i].picks[1]+","+event.alliances[i].picks[1]);
  23.         }
  24.     }
  25.  
  26. Console output:
  27. Match name: f Set number: 1 Time (in ms): 1457222940
  28. Match name: f Set number: 1 Time (in ms): 1457223720
  29. Match name: f Set number: 1 Time (in ms): 1457224500
  30. Match name: qf Set number: 1 Time (in ms): 1457213400
  31. Match name: qf Set number: 1 Time (in ms): 1457215260
  32. Match name: qf Set number: 2 Time (in ms): 1457213820
  33. Match name: qf Set number: 2 Time (in ms): 1457215680
  34. Match name: qf Set number: 2 Time (in ms): 1457217720
  35. Match name: qf Set number: 3 Time (in ms): 1457214240
  36. Match name: qf Set number: 3 Time (in ms): 1457216100
  37. ...
  38. ... (and more matches)
  39. ...
  40. Item: foulCount Value: 0
  41. Item: position4crossings Value: 2
  42. Item: position1crossings Value: 2
  43. Item: capturePoints Value: 25
  44. Item: teleopChallengePoints Value: 15
  45. Item: teleopCrossingPoints Value: 30
  46. Item: autoBoulderPoints Value: 0
  47. Item: position3crossings Value: 2
  48. Item: towerEndStrength Value: 5
  49. Item: robot3Auto Value: Crossed
  50. Item: autoBouldersLow Value: 0
  51. Item: techFoulCount Value: 0
  52. Item: autoCrossingPoints Value: 20
  53. Item: foulPoints Value: 0
  54. Item: position2 Value: B_Ramparts
  55. Item: position3 Value: C_SallyPort
  56. Item: position4 Value: D_RockWall
  57. Item: teleopPoints Value: 120
  58. Item: position5 Value: A_ChevalDeFrise
  59. Item: robot2Auto Value: Reached
  60. Item: teleopDefensesBreached Value: true
  61. Item: teleopTowerCaptured Value: true
  62. Item: adjustPoints Value: 0
  63. Item: autoPoints Value: 22
  64. Item: teleopBouldersLow Value: 5
  65. Item: teleopBouldersHigh Value: 4
  66. Item: position5crossings Value: 0
  67. Item: towerFaceC Value: Challenged
  68. Item: totalPoints Value: 142
  69. Item: teleopBoulderPoints Value: 30
  70. Item: towerFaceB Value: Challenged
  71. Item: breachPoints Value: 20
  72. Item: position2crossings Value: 2
  73. Item: autoReachPoints Value: 2
  74. Item: autoBouldersHigh Value: 0
  75. Item: teleopScalePoints Value: 0
  76. Item: robot1Auto Value: Crossed
  77. Item: towerFaceA Value: Challenged
  78. Alliance name: Alliance 1
  79. Picks: frc5805,frc3882,frc3882
  80. Alliance name: Alliance 2
  81. Picks: frc3255,frc2485,frc2485
  82. Alliance name: Alliance 3
  83. Picks: frc4486,frc4984,frc4984
  84. Alliance name: Alliance 4
  85. Picks: frc5209,frc3128,frc3128
  86. Alliance name: Alliance 5
  87. Picks: frc3021,frc2102,frc2102
  88. Alliance name: Alliance 6
  89. Picks: frc2637,frc2443,frc2443
  90. Alliance name: Alliance 7
  91. Picks: frc5199,frc399,frc399
  92. Alliance name: Alliance 8
  93. Picks: frc1159,frc5137,frc5137
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement