Skip to content

Commit

Permalink
[web-deal-finder] Display more info
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomif committed Sep 19, 2024
1 parent 56144af commit 2a95ccc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
16 changes: 16 additions & 0 deletions fc-solve/site/wml/lib/sass/web-fc-solve.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,22 @@ textarea.emscripten {
&.error {
color: red;
}

table.found_result {
border-collapse: collapse;
&,
& td {
border: 2px solid black;
}

td {
padding: 0.3em;
}

td.val {
font-weight: normal;
}
}
}

#status_wrap,
Expand Down
34 changes: 32 additions & 2 deletions fc-solve/site/wml/src/ts/find-fc-deal-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function find_deal_ui(): void {
chunk_s = in_storage_s;
}
}
const start = new Date().getTime();
df.run(
1,
"8589934591",
Expand All @@ -92,11 +93,40 @@ export function find_deal_ui(): void {
function resume() {
const ret_Deal = df.cont();
if (ret_Deal.found) {
const elapsed = new Date().getTime() - start;
const val_td = '<td class="val">';

ctl.html(
'Found: <input id="found_result" ' +
'<table class="found_result">' +
"<tr>" +
"<td>" +
"Found:" +
"</td>" +
val_td +
' <input id="found_result" ' +
'name="found_result" value="' +
ret_Deal.result.toString() +
'" readonly="readonly" />',
'" readonly="readonly" />' +
"<br/>" +
"</td>" +
"</tr>" +
"<tr>" +
"<td>" +
"<b>Elapsed:</b>" +
"</td>" +
val_td +
(elapsed / 1000).toString() +
"</td>" +
"</tr>" +
"<tr>" +
"<td>" +
"<b>Iteration step size:</b>" +
"</td>" +
val_td +
df.getChunk().toString() +
"</td>" +
"</tr>" +
"</table>",
);
} else if (ret_Deal.cont) {
setTimeout(() => {
Expand Down
6 changes: 6 additions & 0 deletions fc-solve/site/wml/src/ts/find-fc-deal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function FC_Solve_init_wrappers_with_module(Module): ModuleWrapper {
export class Freecell_Deal_Finder {
private obj: number;
private abs_end: bigInt.BigInteger;
private CHUNK: bigInt.BigInteger;
private CHUNKM: bigInt.BigInteger;
private start: bigInt.BigInteger;
private update_cb: any;
Expand All @@ -48,6 +49,7 @@ export class Freecell_Deal_Finder {
return typeof x === "undefined" || x === undefined || x === null;
}
const CHUNK = bigInt(_is_null(chunk_s) ? 10000000 : chunk_s);
that.CHUNK = CHUNK;
that.CHUNKM = CHUNK.add(bigInt.minusOne);
const start = bigInt(abs_start);
const abs_end = bigInt(abs_end_param);
Expand Down Expand Up @@ -81,4 +83,8 @@ export class Freecell_Deal_Finder {
return { found: false, cont: false };
}
}
public getChunk(): bigInt.BigInteger {
const that = this;
return that.CHUNK.add(bigInt.zero);
}
}

0 comments on commit 2a95ccc

Please sign in to comment.