feat: add score calculation function
This commit is contained in:
parent
728bc1abe1
commit
4919a5258d
1 changed files with 12 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
let latlng = $state(L.latLng(0, 0));
|
||||
let distance = $derived(latlng.distanceTo(point));
|
||||
let points = $derived(5000 * Math.exp(-Math.max(0, distance - 20) / 750));
|
||||
let points = $derived(calculatePoints());
|
||||
|
||||
let lines = $state(true);
|
||||
let labels = $state(false);
|
||||
|
@ -65,6 +65,17 @@
|
|||
latlng = e.latlng;
|
||||
});
|
||||
}
|
||||
|
||||
function calculatePoints(): number {
|
||||
const lenientDistance = Math.max(0, distance - 20);
|
||||
const score = 5000 * Math.exp(-lenientDistance / 750);
|
||||
|
||||
let multiplier = 1; /*
|
||||
if (lines) multiplier *= 0.5;
|
||||
if (labels) multiplier *= 0.5; */
|
||||
|
||||
return score * multiplier;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="banner" {hidden}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue