Skip to content

Commit

Permalink
chore snake facts (#6401)
Browse files Browse the repository at this point in the history
* chore snake facts

* Snake translations

* Update interfaces/Portalicious/src/app/pages/snake/game/snake.component.ts

Co-authored-by: Peter Smallenbroek <PeterSmallenbroek@users.noreply.github.com>

* Update interfaces/Portalicious/src/app/pages/snake/game/snake.component.ts

Co-authored-by: Peter Smallenbroek <PeterSmallenbroek@users.noreply.github.com>

* Update interfaces/Portalicious/src/app/pages/snake/game/snake.component.ts

Co-authored-by: Peter Smallenbroek <PeterSmallenbroek@users.noreply.github.com>

* Update interfaces/Portalicious/src/app/pages/snake/game/snake.component.html

Co-authored-by: Peter Smallenbroek <PeterSmallenbroek@users.noreply.github.com>

---------

Co-authored-by: Ruben <vandervalk@geoit.nl>
Co-authored-by: Peter Smallenbroek <PeterSmallenbroek@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 20, 2025
1 parent fd9f9d6 commit da237a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
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 @@ -1859,6 +1859,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 @@ -1396,6 +1396,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>

0 comments on commit da237a9

Please sign in to comment.