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

chore snake facts #6401

Merged
merged 6 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@
grid-template-columns: repeat(21, 1fr);
"
></div>
<!-- Random Fact Section -->
<div class="mt-4 rounded-lg border bg-white p-4 shadow-md">
<h3
i18n
class="mb-2 text-lg font-semibold"
>
Did you know?
</h3>
<p class="text-gray-700">{{ random121Fact() }}</p>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class SnakeComponent implements AfterViewInit {
public isGameStarted = signal(false);
public isGameOver = signal(false);
public score = signal(0);
public random121Fact = signal('');

private lastRenderTime = 0;
private inputDirection: Vector;
Expand Down Expand Up @@ -106,6 +107,25 @@ export class SnakeComponent implements AfterViewInit {
this.drawSnake();
this.drawFood();
this.changeDetectorRef.detectChanges();
this.showRandom121Fact();
}

private showRandom121Fact() {
const random121Facts = [
'The number 121 is the sum of the first 11 prime numberss',
'121 is the 11th number in the Fibonacci sequence',
'121 is the 15th number in the Pell sequence',
'121 is a centered octagonal number',
'121 is easy',
'121 is safe',
'121 is fast',
'Did you know that you can share your registration table filter by copying the URL?',
'Have you ever typed "Henry Dunant" in the search bar?',
'By recording all data entries and changes, 121 enhances accountability and security, making auditing easier through a privacy-by-design system.',
];
this.random121Fact.set(
random121Facts[Math.floor(Math.random() * random121Facts.length)],
);
}

private checkGameOver() {
Expand All @@ -125,6 +145,7 @@ export class SnakeComponent implements AfterViewInit {
if (this.isSnakeIntersecting({ position: this.foodPosition })) {
this.expandSnake();
this.foodPosition = this.getRandomPositionOnGrid();
this.showRandom121Fact();
}
}

Expand Down
4 changes: 4 additions & 0 deletions interfaces/Portalicious/src/locale/messages.nl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,10 @@
<source>Start!</source>
<target state="new">Start!</target>
</trans-unit>
<trans-unit id="8220517666190714329" datatype="html">
<source>Did you know?</source>
<target state="new">Did you know?</target>
</trans-unit>
</body>
</file>
</xliff>
3 changes: 3 additions & 0 deletions interfaces/Portalicious/src/locale/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,9 @@
<trans-unit id="7924647147478852112" datatype="html">
<source>Game over!</source>
</trans-unit>
<trans-unit id="8220517666190714329" datatype="html">
<source>Did you know?</source>
</trans-unit>
</body>
</file>
</xliff>
Loading