This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is not to be confused with compression of files. | |
*/ | |
// Object in decompressed form: | |
var object = { | |
name: "Mohsin", | |
feelings: { | |
type: "happiness", | |
intensity: 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Using HTML5 Visibility State | |
* Triggers when user goes to a different tab | |
* Triggers when user minimizes browser | |
* Does not trigger when user opens another window on top of browswer | |
*/ | |
document.visibilityState; | |
setInterval(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* RESULTS WITHOUT CONTROL MEASURE | |
* 311 people were infected. | |
* Quarantined 0 people at cost of $0.00 | |
* Outbreak Length: 51.416666666666664 days. | |
* RESULTS WITH CONTROL MEASURE | |
* 81 people were infected. | |
* Quarantined 314 people at cost of $381,390.00 | |
* Outbreak Length: 27.458333333333332 days. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Initial Map | |
00 01 02 03 04 05 06 07 08 09 | |
00 ~~ ~~ ~~ ~~ [D7][D7] ~~ ~~ ~~ ~~ | |
01 ~~ ~~ ~~ [D7] ~~ ~~ [D7] ~~ ~~ ~~ | |
02 ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ | |
03 ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ | |
04 ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ | |
05 ~~ ~~ ~~ ~~ ~~ [D2] ~~ ~~ ~~ ~~ | |
06 ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ | |
07 ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example of how not to shoot your teammates | |
*/ | |
// Get all nearby ships | |
List<Ship> nearby = this.getNearbyShips(arena); | |
// Loop over all the ships | |
for (int i = 0; i < nearby.size(); i++) { | |
Ship ship = nearby.get(i); | |
// Call the getTeam() method on any ship to get its team name | |
String myTeam = this.getTeam(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void doTurn(Arena arena) { | |
//Fill in strategy here | |
this.move(arena, Direction.NORTH); | |
List<Ship> nearby = this.getNearbyShips(arena); | |
for (int i = 0; i < nearby.size(); i++) | |
{ | |
Ship unknown = nearby.get(i); | |
boolean isOnMyTeam = this.isSameTeamAs(unknown); | |
if (isOnMyTeam) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void doTurn(Arena arena) { | |
// Fill in your strategy here | |
int minHealth = 100; | |
this.move(arena, Direction.EAST); | |
Ship target = null; | |
List<Ship> nearby = this.getNearbyShips(arena); | |
for (int i = 0; i < nearby.size(); i++) { | |
Ship ship = nearby.get(i); | |
String myTeam = this.getTeam(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var container = document.querySelector('[role="main"]').children[0].children[3].children[0].children[1].children[0]; | |
var boxes = Array.from(container.children); | |
var results = []; | |
getEmailByBoxIndex({ | |
container: container, | |
results: results, | |
boxes: boxes, | |
index: 0, | |
callback: printResults | |
}); |
OlderNewer