1 | // also updates when equal score and shorter code |
2 | static class HighestShortest {
|
3 | S a; |
4 | double score; |
5 | |
6 | bool update(S x, double s) {
|
7 | if (a == null || s > score || (s == score && l(x) < l(a))) {
|
8 | a = x; |
9 | score = s; |
10 | true; |
11 | } |
12 | false; |
13 | } |
14 | |
15 | Pair<S, Double> getPair() {
|
16 | ret a == null ? null : pair(a, score); |
17 | } |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1004717 |
| Snippet name: | class HighestShortest - collect highest score, then shortest code |
| Eternal ID of this version: | #1004717/1 |
| Text MD5: | 72c240a21f1f7e4d252e2c77c02dc857 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-08-27 22:42:49 |
| Source code size: | 364 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 805 / 1420 |
| Referenced in: | [show references] |