Skip to content

Commit

Permalink
Merge pull request #37 from LyonSyonII/dev
Browse files Browse the repository at this point in the history
small fixes
  • Loading branch information
LyonSyonII authored Jul 5, 2024
2 parents f60a492 + eaf83cd commit b61dd4d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 26 deletions.
3 changes: 1 addition & 2 deletions frontend/src/components/Checkpoint/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export async function add(id: string) {
v = new Set();
}
v.add(id);
console.log("updated", {v});
return v;
}, store);
await callSubscribed(level);
Expand All @@ -23,7 +22,7 @@ export async function remove(id: string) {
v = new Set();
}
v.delete(id);
v.delete(`${level}-confetti`);
v.delete(`${level}-completed`);
return v;
}, store);
await callSubscribed(level);
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Feedback/Feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export class FeedbackElement extends HTMLElement {
form.querySelector("#review") as HTMLTextAreaElement
).value.trim(),
};

console.log(data);


await fetch("http://rust-quest.garriga.dev", {
method: "POST",
headers: {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/components/LanguageDetector.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
const preferred = navigator.languages;
for (const l of preferred) {
if (Object.keys(langs).includes(l)) {
console.log({
base: import.meta.env.BASE_URL,
location: window.location,
origin: window.location.origin,
});
window.location.href =
window.location.origin + import.meta.env.BASE_URL + `${l}`;
break;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Progress.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
const { id, total, confetti = true } = Astro.props;
---
<Checkpoint id=`${id}-${total}`>
<Checkpoint id=`${id}-completed`>
<Donate />
</Checkpoint>

Expand Down Expand Up @@ -79,14 +79,14 @@ const { id, total, confetti = true } = Astro.props;
const value = checkpoint.size < total ? checkpoint.size : total;
label.innerText = `${value} / ${total}`;
progress.value = value;
const confettiId = `${id}-confetti`;
if (value !== total) {
return;
}
if (launchConfetti && !checkpoint.has(confettiId)) {
const completedId = `${id}-completed`
if (launchConfetti && !checkpoint.has(completedId)) {
confetti();
add(confettiId);
}
add(completedId);
});

const feedback = this.querySelector("dialog")!;
Expand Down
17 changes: 7 additions & 10 deletions frontend/src/components/RobotGame/RobotGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export class RobotGame extends HTMLElement {
this.codeblock.setRunning(false);
return Promise.reject();
}

const responses: [EvalResponse, Board][] = await Promise.all(
const responses: [Promise<EvalResponse>, Board][] = await Promise.all(
this.boards.map(async (board) => {
const { rows, cols, start, enemies } = board;
await this.setupCodeBlock(
Expand All @@ -77,14 +77,12 @@ export class RobotGame extends HTMLElement {
enemies,
this.functions,
);

const response = await this.codeblock.evaluateSnippet(value);
const response = this.codeblock.evaluateSnippet(value);
return [response, board];
}),
);

console.log({ robotResponses: responses });


const simulationError = async () => {
this.codeblock.setOutput(
"There was an error during the simulation, please try again.",
Expand All @@ -101,7 +99,8 @@ export class RobotGame extends HTMLElement {
return simulationError();
}

for (const [response, board] of responses) {
for (const [r, board] of responses) {
const response = await r;
if (typeof response !== "string") {
return simulationError();
}
Expand Down Expand Up @@ -253,8 +252,6 @@ export class RobotGame extends HTMLElement {
await wait(150);
}

console.log({ killedEnemies, numEnemies: board.numEnemies });

if (killedEnemies < board.numEnemies) {
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ More functions will be unlocked once enough monsters are defeated.
##### 2. Usage
To kill a monster, just move the robot where it is and the machine will do the rest.

To ensure 100% success rate, multiple simulations will run before executing your program.
**This means that your code must be able to solve ALL the simulations.**
To ensure a 100% success rate, multiple simulations will run before executing your program.
**This means that your code must be able to solve ALL the simulations at the same time.**

##### 3. Legal and Ethical Considerations
- Adhere to local laws and regulations governing the use of monster-killing robots.
Expand Down

0 comments on commit b61dd4d

Please sign in to comment.