This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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, |
NewerOlder