Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update other.js #189

Open
wants to merge 3,663 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3663 commits
Select commit Hold shift + click to select a range
198428b
Merge pull request #1 from Zorn192/gh-pages
Quiaaaa Oct 10, 2022
f5b68bb
Bonfires, Embers, and Worshippers
Quiaaaa Oct 10, 2022
804322e
Hide Challenge-Specific graphs when they are not in saved data
Quiaaaa Oct 10, 2022
6e9c972
Graphing: better coord graph, hide more unused graphs
Quiaaaa Oct 11, 2022
ac00400
Graphing: Wonders, refactoring
Quiaaaa Oct 11, 2022
ab39ec5
Graphing: Empower, Nurture
Quiaaaa Oct 11, 2022
aaecff9
Merge pull request #170 from finalcontent/patch
Zorn192 Oct 11, 2022
d578968
Merge pull request #171 from ebuchmann/fix-championism-exprate
Zorn192 Oct 11, 2022
2011736
Merge pull request #172 from Quiaaaa/gh-pages
Zorn192 Oct 11, 2022
03f644e
Update Graphs.js
Zorn192 Oct 11, 2022
d11e4f9
Update Graphs.js
Zorn192 Oct 11, 2022
e7fa29c
Update Graphs.js
Zorn192 Oct 11, 2022
e7b05e6
Update Graphs.js
Zorn192 Oct 11, 2022
da6cd8f
Update Graphs.js
Zorn192 Oct 11, 2022
8249e86
Update GraphsOnly.js
Zorn192 Oct 11, 2022
f240de3
Turn GraphsOnly into a loader for Graphs
Quiaaaa Oct 12, 2022
b3a75d6
Merge pull request #173 from Quiaaaa/gh-pages
Zorn192 Oct 12, 2022
91980e0
Delete GraphsU1.js
Zorn192 Oct 12, 2022
1bb6972
Delete GraphsU1.user.js
Zorn192 Oct 12, 2022
865c2c7
Delete GraphsU2.js
Zorn192 Oct 12, 2022
2fb7458
Delete GraphsU2.user.js
Zorn192 Oct 12, 2022
c3287c3
Delete future
Zorn192 Oct 12, 2022
f79269b
Update calc.js
Zorn192 Oct 13, 2022
43374e6
Update SettingsGUI.js
Zorn192 Oct 13, 2022
3881547
Update SettingsGUI.js
Zorn192 Oct 13, 2022
0855c12
Update buildings.js
Zorn192 Oct 13, 2022
b4d31a6
Update SettingsGUI.js
Zorn192 Oct 13, 2022
894531f
Update upgrades.js
Zorn192 Oct 13, 2022
7c0b967
Update SettingsGUI.js
Zorn192 Oct 16, 2022
f0156e3
Update other.js
Zorn192 Oct 16, 2022
45c395b
Update buildings.js
Zorn192 Oct 16, 2022
2b2d1af
Update buildings.js
Zorn192 Oct 17, 2022
7318c53
Update SettingsGUI.js
Zorn192 Oct 17, 2022
005872c
Update SettingsGUI.js
Zorn192 Oct 17, 2022
3f9166c
Fix: Add research caches to mapping options
Oct 17, 2022
5673c35
Merge pull request #174 from ebuchmann/fix-map-special-research
Zorn192 Oct 19, 2022
e166a49
Update buildings.js
Zorn192 Oct 22, 2022
8785881
Update SettingsGUI.js
Zorn192 Oct 22, 2022
238fb68
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
026d54f
Update SettingsGUI.js
Zorn192 Oct 28, 2022
36cb7d9
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
c9d7d9c
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
83b6a52
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
cb92f22
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
86e7f3c
Update SettingsGUI.js
Zorn192 Oct 28, 2022
1f16e00
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
e6fa97c
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
fe13528
Update AutoTrimps2.js
Zorn192 Oct 28, 2022
198f423
Update SettingsGUI.js
Zorn192 Oct 28, 2022
a5829cc
Fix Observation with respec
Oct 30, 2022
aff2a2f
Merge pull request #176 from ebuchmann/patch-1
Zorn192 Oct 30, 2022
daa686e
Update gather.js
Zorn192 Oct 30, 2022
46a6f19
Update calc.js
Zorn192 Oct 30, 2022
8d19331
Update maps.js
Zorn192 Oct 30, 2022
5b3739d
Update maps.js
Zorn192 Oct 30, 2022
06c8c09
Update maps.js
Zorn192 Oct 30, 2022
65b89c1
Update maps.js
Zorn192 Oct 30, 2022
74ac052
Update maps.js
Zorn192 Oct 30, 2022
3d102ef
Update SettingsGUI.js
Zorn192 Oct 30, 2022
cb5a933
Update maps.js
Zorn192 Oct 30, 2022
34ac272
Update maps.js
Zorn192 Oct 30, 2022
ec14558
Update maps.js
Zorn192 Oct 30, 2022
1a4397f
Update maps.js
Zorn192 Oct 30, 2022
e6b4c43
Update maps.js
Zorn192 Oct 30, 2022
c52d019
Update maps.js
Zorn192 Oct 30, 2022
b56f71e
Update breedtimer.js
Zorn192 Oct 30, 2022
c53f0e6
Update maps.js
Zorn192 Oct 30, 2022
86824b0
Update maps.js
Zorn192 Oct 30, 2022
ccc444f
Create mapfunctions.js
Zorn192 Oct 30, 2022
495b449
Update AutoTrimps2.js
Zorn192 Oct 30, 2022
e9c0b51
Update mapfunctions.js
Zorn192 Oct 30, 2022
91587b8
Update maps.js
Zorn192 Oct 30, 2022
6f84214
Update mapfunctions.js
Zorn192 Oct 30, 2022
8d8e308
Update maps.js
Zorn192 Oct 30, 2022
42f5608
Update maps.js
Zorn192 Oct 31, 2022
03ceb57
Update mapfunctions.js
Zorn192 Oct 31, 2022
94b6507
Update maps.js
Zorn192 Oct 31, 2022
b41e69e
Update mapfunctions.js
Zorn192 Oct 31, 2022
6565ff6
Update maps.js
Zorn192 Oct 31, 2022
23c048d
Update maps.js
Zorn192 Oct 31, 2022
d981d01
Update mapfunctions.js
Zorn192 Oct 31, 2022
3fd365a
Update AutoTrimps2.js
Zorn192 Oct 31, 2022
d0467da
Update SettingsGUI.js
Zorn192 Oct 31, 2022
a86d6db
Update mapfunctions.js
Zorn192 Oct 31, 2022
3e12573
Update maps.js
Zorn192 Oct 31, 2022
404951d
Update AutoTrimps2.js
Zorn192 Nov 1, 2022
2ba54b7
Update AutoTrimps2.js
Zorn192 Nov 1, 2022
cb0af91
Update heirlooms.js
Zorn192 Nov 1, 2022
830732d
Update calc.js
Zorn192 Nov 1, 2022
0742fdb
Update mapfunctions.js
Zorn192 Nov 1, 2022
1977750
Update calc.js
Zorn192 Nov 1, 2022
665b3d7
Update maps.js
Zorn192 Nov 1, 2022
e1b941d
Update mapfunctions.js
Zorn192 Nov 1, 2022
8395553
Update maps.js
Zorn192 Nov 1, 2022
594f51f
Update maps.js
Zorn192 Nov 1, 2022
3b0e5c4
Update maps.js
Zorn192 Nov 1, 2022
ffa40f4
Update mapfunctions.js
Zorn192 Nov 1, 2022
9c7e304
Update magmite.js
Zorn192 Nov 1, 2022
459c5d0
Update SettingsGUI.js
Zorn192 Nov 1, 2022
db504a5
Update mapfunctions.js
Zorn192 Nov 2, 2022
9f93aff
Update maps.js
Zorn192 Nov 2, 2022
6b5d296
Update mapfunctions.js
Zorn192 Nov 2, 2022
f416da8
Update mapfunctions.js
Zorn192 Nov 2, 2022
21f7490
Update maps.js
Zorn192 Nov 2, 2022
9195e8d
Update mapfunctions.js
Zorn192 Nov 2, 2022
0248405
Update AutoTrimps2.js
Zorn192 Nov 2, 2022
0b51b7f
Update mapfunctions.js
Zorn192 Nov 2, 2022
dc6d4d1
Update portal.js
Zorn192 Nov 2, 2022
1388911
Update maps.js
Zorn192 Nov 2, 2022
a648fae
Update mapfunctions.js
Zorn192 Nov 2, 2022
7c92995
Update mapfunctions.js
Zorn192 Nov 2, 2022
ca75d5a
Update maps.js
Zorn192 Nov 2, 2022
908676e
Update mapfunctions.js
Zorn192 Nov 2, 2022
761a131
Update SettingsGUI.js
Zorn192 Nov 2, 2022
462d341
Update SettingsGUI.js
Zorn192 Nov 3, 2022
3548187
Update AutoTrimps2.js
Zorn192 Nov 3, 2022
a2b4eab
Update mapfunctions.js
Zorn192 Nov 3, 2022
ac9faf2
Update maps.js
Zorn192 Nov 3, 2022
34c817c
Update maps.js
Zorn192 Nov 3, 2022
41dfa29
Update buildings.js
Zorn192 Nov 3, 2022
4902bab
Update maps.js
Zorn192 Nov 4, 2022
936eff4
Update mapfunctions.js
Zorn192 Nov 4, 2022
30c024f
Update maps.js
Zorn192 Nov 4, 2022
caebad6
hip
Zorn192 Nov 6, 2022
85d47a1
Update other.js
Zorn192 Nov 6, 2022
bd9208c
Update buildings.js
Zorn192 Nov 6, 2022
76c289a
Update AutoTrimps2.js
Zorn192 Nov 6, 2022
3500360
Update other.js
Zorn192 Nov 6, 2022
d120851
Update mapfunctions.js
Zorn192 Nov 6, 2022
23a652c
Update mapfunctions.js
Zorn192 Nov 6, 2022
b731812
Update mapfunctions.js
Zorn192 Nov 6, 2022
e134958
Update mapfunctions.js
Zorn192 Nov 6, 2022
2aa0336
Update mapfunctions.js
Zorn192 Nov 6, 2022
bd225c6
Update mapfunctions.js
Zorn192 Nov 6, 2022
b2d5651
Update mapfunctions.js
Zorn192 Nov 6, 2022
d09ef79
Update SettingsGUI.js
Zorn192 Nov 6, 2022
60dd401
Update SettingsGUI.js
Zorn192 Nov 7, 2022
632a775
Update MAZ.js
Zorn192 Nov 7, 2022
6a84196
Update maps.js
Zorn192 Nov 7, 2022
d51a80e
Update mapfunctions.js
Zorn192 Nov 7, 2022
26c181f
Update gather.js
Zorn192 Nov 7, 2022
3a4e0ce
Update jobs.js
Zorn192 Nov 7, 2022
3172c13
Update mapfunctions.js
Zorn192 Nov 7, 2022
d6b2db4
Update mapfunctions.js
Zorn192 Nov 7, 2022
b3dfa90
Update mapfunctions.js
Zorn192 Nov 7, 2022
f2e5b27
Update mapfunctions.js
Zorn192 Nov 7, 2022
dc42bd1
Update mapfunctions.js
Zorn192 Nov 7, 2022
78ec6f3
Update mapfunctions.js
Zorn192 Nov 7, 2022
cbe798c
Update mapfunctions.js
Zorn192 Nov 7, 2022
4748558
Update maps.js
Zorn192 Nov 8, 2022
9141807
Update maps.js
Zorn192 Nov 8, 2022
f9ae9b9
Update maps.js
Zorn192 Nov 8, 2022
e0b4b2a
Update maps.js
Zorn192 Nov 8, 2022
634c4f7
Update maps.js
Zorn192 Nov 8, 2022
48552e9
Update maps.js
Zorn192 Nov 8, 2022
9f4b560
Update maps.js
Zorn192 Nov 9, 2022
d74e8f5
Update mapfunctions.js
Zorn192 Nov 9, 2022
cd8df9f
Update SettingsGUI.js
Zorn192 Nov 13, 2022
29a3922
Update scryer.js
Zorn192 Nov 13, 2022
b633366
Update SettingsGUI.js
Zorn192 Nov 13, 2022
d5a432f
Update AutoTrimps2.js
Zorn192 Nov 13, 2022
f1d7938
Update AutoTrimps2.js
Zorn192 Nov 13, 2022
1d1c1fa
Update other.js
Zorn192 Nov 13, 2022
a527ff2
Update mapfunctions.js
Zorn192 Nov 15, 2022
b78a8cb
Update scryer.js
Zorn192 Nov 15, 2022
3cf8fbd
Update heirlooms.js
Zorn192 Nov 16, 2022
b9ab269
Update maps.js
Zorn192 Nov 19, 2022
1252db4
Update SettingsGUI.js
Zorn192 Nov 27, 2022
a40325a
Update SettingsGUI.js
Zorn192 Nov 27, 2022
91a0376
Graphs Rework
Quiaaaa Dec 22, 2022
60a6113
fix for ancient JS
Quiaaaa Dec 22, 2022
c371420
themes and css
Quiaaaa Dec 22, 2022
bb81484
github path for public testing
Quiaaaa Dec 23, 2022
a0c0932
de graphs, bugfixes
Quiaaaa Dec 25, 2022
49c26d9
hide universe selector when not needed
Quiaaaa Dec 25, 2022
c517a7f
remove graph fixes, added lastwarp graph
Quiaaaa Dec 26, 2022
ce6d889
fix visible graphs, expose maxGraphs
Quiaaaa Dec 26, 2022
4190d5b
fix: old JS support
Quiaaaa Dec 26, 2022
2b38a45
fix: fluffy exp now includes past evos
Quiaaaa Dec 27, 2022
25e9a96
Use game time instead of real clock time
Quiaaaa Dec 27, 2022
63e04b6
fix: remembered portal selection remembers too much
Quiaaaa Dec 27, 2022
f633451
feature: perZone toggle
Quiaaaa Dec 27, 2022
f5d93a2
feature: c2 graph; code cleanup
Quiaaaa Dec 28, 2022
8d463db
bugfix: fluffy exp formula
Quiaaaa Dec 29, 2022
3a4c8d4
fix: fluffy exp tracks properly on graphs started after z1
Quiaaaa Dec 29, 2022
fb98c67
bugfix: c2 breaks after abandon
Quiaaaa Dec 30, 2022
448cb87
consolidate time graphs, remove animation, fix first/last data on per…
Quiaaaa Jan 2, 2023
994fc11
feature: Time in maps, map counter
Quiaaaa Jan 8, 2023
320bf79
new graph: Mutated Seeds
Quiaaaa Jan 11, 2023
f1b3a3c
minor: start select graphs at relevant zones
Quiaaaa Jan 11, 2023
d3fd98f
bugfix: s3norm graphs were broken
Quiaaaa Jan 12, 2023
6a484f7
code cleanup: Toggles
Quiaaaa Jan 12, 2023
6e6cb8f
bug: fenceposting on hze vs hzc
Quiaaaa Jan 14, 2023
e7f9b13
feature: multi column graphs, run stats per portal
Quiaaaa Jan 15, 2023
fb800ec
fix: disable hotkeys while graphs is open
Quiaaaa Jan 18, 2023
26d9323
feature: Portal stats graph upgrades
Quiaaaa Jan 18, 2023
3128e9d
fix: mapcount formatter
Quiaaaa Jan 18, 2023
f1b603a
feature: live updates (preliminary, perf issues)
Quiaaaa Jan 19, 2023
1e4708c
fix: high values sometimes clip
Quiaaaa Jan 23, 2023
65a860a
fix: escape did not close graphs
Quiaaaa Jan 23, 2023
7a3da81
fix: Trimps Settings window would not open on Esc
Quiaaaa Jan 23, 2023
b6ff265
feature: display X portals
Quiaaaa Jan 26, 2023
375861b
reorganizing
Quiaaaa Jan 29, 2023
370d488
bugfix: Fluffy exp overcaps in game and causes horrible horrible nega…
Quiaaaa Jan 29, 2023
cf4e143
fix: downgrading code to ES5, again.
Quiaaaa Jan 30, 2023
412bdb8
.
Quiaaaa Jan 31, 2023
962b12b
.
Quiaaaa Jan 31, 2023
1a65d65
Merge pull request #180 from Quiaaaa/gh-pages
Zorn192 Jan 31, 2023
aef090c
fix: Graphs window loses track of when it's open
Quiaaaa Feb 3, 2023
bc0a043
fix: window toggles
Quiaaaa Feb 3, 2023
14f94a6
Merge pull request #182 from Quiaaaa/gh-pages
Zorn192 Feb 3, 2023
115f1e3
Update calc.js
Zorn192 Feb 11, 2023
ace16d3
Update SettingsGUI.js
Zorn192 Feb 11, 2023
d37136f
Update calc.js
Zorn192 Feb 11, 2023
2d96aac
Update mapfunctions.js
Zorn192 Feb 11, 2023
e5566d1
Update maps.js
Zorn192 Feb 11, 2023
a83f31b
Update calc.js
Zorn192 Feb 11, 2023
1e3a9fe
Update SettingsGUI.js
Zorn192 Feb 11, 2023
7a4e191
Update mapfunctions.js
Zorn192 Feb 11, 2023
3f93cbb
Update upgrades.js
Zorn192 Feb 11, 2023
0c0413a
Update AutoTrimps2.js
Zorn192 Feb 11, 2023
140d08d
Update calc.js
Zorn192 Feb 11, 2023
61f16a0
Update portal.js
Zorn192 Feb 13, 2023
97af338
Update AutoTrimps2.js
Zorn192 Feb 14, 2023
39fcdbc
Update AutoTrimps2.js
Zorn192 Feb 14, 2023
890fd4a
Update AutoTrimps2.js
Zorn192 Feb 14, 2023
34aa073
Update other.js
Zorn192 Feb 14, 2023
897db22
Update utils.js
Zorn192 Feb 18, 2023
920c949
Update SettingsGUI.js
Zorn192 Feb 20, 2023
1d8d24a
Update SettingsGUI.js
Zorn192 Feb 27, 2023
328318b
Update buildings.js
Zorn192 Feb 27, 2023
c47115a
Update buildings.js
Zorn192 Feb 27, 2023
2c79671
Update calc.js
Zorn192 Mar 9, 2023
691bfd6
Update gather.js
Zorn192 Mar 9, 2023
f69fd56
Update jobs.js
Zorn192 Mar 9, 2023
bdba47d
Update maps.js
Zorn192 Mar 9, 2023
1106e19
Update other.js
Zorn192 Mar 9, 2023
9246700
Update stance.js
Zorn192 Mar 9, 2023
207622a
Update equipment.js
Zorn192 Mar 9, 2023
ddfbe11
Update dynprestige.js
Zorn192 Mar 9, 2023
bc8d14a
Update fight.js
Zorn192 Mar 9, 2023
bcf1f9e
Update breedtimer.js
Zorn192 Mar 9, 2023
9bb8988
Update AutoTrimps2.js
Zorn192 Mar 9, 2023
22f3d1e
Update AutoTrimps2.js
Zorn192 Mar 18, 2023
3a68e56
Update breedtimer.js
Zorn192 Apr 28, 2023
a3e0aad
Update maps.js
Zorn192 Apr 28, 2023
e4f217f
Fix Quia breaking your fork
SadAugust Sep 29, 2024
517c37c
Merge pull request #189 from SadAugust/gh-pages
Zorn192 Sep 29, 2024
973156b
Stop touching Graphs
Quiaaaa Sep 30, 2024
5ccf525
Merge pull request #190 from Quiaaaa/patch-1
Zorn192 Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
/sparecode/
/AutoTrimps.PEM
/https.py
/https2.py
/server.pem
/SIMPLEHTTPSERVER.bat
AutoTrimps2.js
18 changes: 9 additions & 9 deletions .user.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// ==UserScript==
// @name AutoTrimps-genBTC
// @version 2.1.6.9-genbtc-3-23-2018
// @namespace https://genbtc.github.io/AutoTrimps
// @updateURL https://genbtc.github.io/AutoTrimps/.user.js
// @name AutoTrimps-Zek
// @version 1.0-Zek
// @namespace https://Zorn192.github.io/AutoTrimps
// @updateURL https://Zorn192.github.io/AutoTrimps/.user.js
// @description Automate all the trimps!
// @author zininzinin, spindrjr, Ishkaru, genBTC
// @author zininzinin, spindrjr, Ishkaru, genBTC, Zeker0
// @include *trimps.github.io*
// @include *kongregate.com/games/GreenSatellite/trimps
// @connect *genbtc.github.io/AutoTrimps*
// @connect *Zorn192.github.io/AutoTrimps*
// @connect *trimps.github.io*
// @connect self
// @grant none
// @grant GM_xmlhttpRequest
// ==/UserScript==

var script = document.createElement('script');
script.id = 'AutoTrimps-script';
script.id = 'AutoTrimps-Zek';
//This can be edited to point to your own Github Repository URL.
script.src = 'https://genBTC.github.io/AutoTrimps/AutoTrimps2.js';
script.src = 'https://Zorn192.github.io/AutoTrimps/AutoTrimps2.js';
//script.setAttribute('crossorigin',"use-credentials");
script.setAttribute('crossorigin',"anonymous");
document.head.appendChild(script);
490 changes: 301 additions & 189 deletions AutoTrimps2.js

Large diffs are not rendered by default.

139 changes: 10 additions & 129 deletions FastPriorityQueue.js
Original file line number Diff line number Diff line change
@@ -1,130 +1,11 @@
/**
* FastPriorityQueue.js : a fast heap-based priority queue in JavaScript.
* (c) the authors
* Licensed under the Apache License, Version 2.0.
*
* Speed-optimized heap-based priority queue for modern browsers and JavaScript engines.
*
* Usage :
Installation (in shell, if you use node):
$ npm install fastpriorityqueue

Running test program (in JavaScript):

// var FastPriorityQueue = require("fastpriorityqueue");// in node
var x = new FastPriorityQueue();
x.add(1);
x.add(0);
x.add(5);
x.add(4);
x.add(3);
x.peek(); // should return 0, leaves x unchanged
x.size; // should return 5, leaves x unchanged
while(!x.isEmpty()) {
console.log(x.poll());
} // will print 0 1 3 4 5
*/
'use strict';

var defaultcomparator = function(a, b) {
return a < b;
};

// the provided comparator function should take a, b and return *true* when a < b
function FastPriorityQueue(comparator) {
this.array = [];
this.size = 0;
this.compare = comparator || defaultcomparator;
}


// Add an element the the queue
// runs in O(log n) time
FastPriorityQueue.prototype.add = function(myval) {
var i = this.size;
this.array[this.size++] = myval;
while ( i > 0) {
var p = (i - 1) >> 1;
var ap = this.array[p];
if(!this.compare(myval, ap )) break;
this.array[i] = ap;
i = p;
}
this.array[i] = myval;
};

// replace the content of the heap by provided array and "heapifies it"
FastPriorityQueue.prototype.heapify = function(arr) {
this.array = arr;
this.size = arr.length;
for (var i = (this.size >> 1); i >= 0; i--) {
this._percolateDown(i);
}
};

// for internal use
FastPriorityQueue.prototype._percolateUp = function(i) {
var myval = this.array[i];
while ( i > 0) {
var p = (i - 1) >> 1;
var ap = this.array[p];
if(!this.compare(myval, ap )) break;
this.array[i] = ap;
i = p;
}
this.array[i] = myval;
};


// for internal use
FastPriorityQueue.prototype._percolateDown = function(i) {
var size = this.size;
var hsize = this.size >>> 1;
var ai = this.array[i];
while (i < hsize) {
var l = (i << 1) + 1;
var r = l + 1;
var bestc = this.array[l];
if (r < size) {
if (this.compare(this.array[r], bestc)) {
l = r;
bestc = this.array[r];
}
}
if (!this.compare(bestc,ai)) {
break;
}
this.array[i] = bestc;
i = l;
}
this.array[i] = ai;
};

//Look at the top of the queue (a smallest element)
// executes in constant time
FastPriorityQueue.prototype.peek = function(t) {
return this.array[0];
};

// remove the element on top of the heap (a smallest element)
// runs in logarithmic time
FastPriorityQueue.prototype.poll = function(i) {
var ans = this.array[0];
if(this.size > 1) {
this.array[0] = this.array[--this.size];
this._percolateDown(0 | 0);
}
else if (this.size == 0) --this.size;
return ans;
};


// recover unused memory (for long-running priority queues)
FastPriorityQueue.prototype.trim = function() {
this.array = this.array.slice(0,this.size);
};

// Check whether the heap is empty
FastPriorityQueue.prototype.isEmpty = function(i) {
return this.size == 0;
};
var defaultcomparator=function(a,b){return a<b};
function FastPriorityQueue(a){this.array=[],this.size=0,this.compare=a||defaultcomparator}
FastPriorityQueue.prototype.add=function(a){var b=this.size;for(this.array[this.size++]=a;0<b;){var c=b-1>>1,d=this.array[c];if(!this.compare(a,d))break;this.array[b]=d,b=c}this.array[b]=a};
FastPriorityQueue.prototype.heapify=function(a){this.array=a,this.size=a.length;for(var b=this.size>>1;0<=b;b--)this._percolateDown(b)};
FastPriorityQueue.prototype._percolateUp=function(a){for(var b=this.array[a];0<a;){var c=a-1>>1,d=this.array[c];if(!this.compare(b,d))break;this.array[a]=d,a=c}this.array[a]=b};
FastPriorityQueue.prototype._percolateDown=function(a){for(var b=this.size,c=this.size>>>1,d=this.array[a];a<c;){var e=(a<<1)+1,f=e+1,g=this.array[e];if(f<b&&this.compare(this.array[f],g)&&(e=f,g=this.array[f]),!this.compare(g,d))break;this.array[a]=g,a=e}this.array[a]=d};
FastPriorityQueue.prototype.peek=function(){return this.array[0]};
FastPriorityQueue.prototype.poll=function(){var b=this.array[0];return 1<this.size?(this.array[0]=this.array[--this.size],this._percolateDown(0)):0==this.size&&--this.size,b};
FastPriorityQueue.prototype.trim=function(){this.array=this.array.slice(0,this.size)};
FastPriorityQueue.prototype.isEmpty=function(){return 0==this.size};
Loading