+
+
+
+
+
+ {{ 'PATHFINDING.GRID_HEIGHT' | translate }}
+
+
+
+ {{ 'PATHFINDING.GRID_WIDTH' | translate }}
+
+
+
+
diff --git a/src/app/pages/algorithms/conway-gol/conway-gol.models.ts b/src/app/pages/algorithms/conway-gol/conway-gol.models.ts
new file mode 100644
index 0000000..a3300a6
--- /dev/null
+++ b/src/app/pages/algorithms/conway-gol/conway-gol.models.ts
@@ -0,0 +1,11 @@
+export interface Node {
+ row: number;
+ col: number;
+}
+
+export const DEFAULT_GRID_ROWS = 100;
+export const DEFAULT_GRID_COLS = 100;
+
+export const MIN_GRID_SIZE = 20;
+export const MAX_GRID_SIZE = 200;
+export const MAX_GRID_PX = 1000;
diff --git a/src/app/pages/algorithms/conway-gol/conway-gol.ts b/src/app/pages/algorithms/conway-gol/conway-gol.ts
index b0ecc02..a80abc4 100644
--- a/src/app/pages/algorithms/conway-gol/conway-gol.ts
+++ b/src/app/pages/algorithms/conway-gol/conway-gol.ts
@@ -1,9 +1,14 @@
-import { Component } from '@angular/core';
+import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card";
import {TranslatePipe} from "@ngx-translate/core";
import {UrlConstants} from '../../../constants/UrlConstants';
import {Information} from '../information/information';
import {AlgorithmInformation} from '../information/information.models';
+import {MatButton} from '@angular/material/button';
+import {MatIcon} from '@angular/material/icon';
+import {MatFormField, MatInput, MatLabel} from '@angular/material/input';
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
+import {DEFAULT_GRID_COLS, DEFAULT_GRID_ROWS, MAX_GRID_SIZE, MIN_GRID_SIZE, MAX_GRID_PX, Node} from './conway-gol.models';
@Component({
selector: 'app-conway-gol',
@@ -13,31 +18,136 @@ import {AlgorithmInformation} from '../information/information.models';
MatCardHeader,
MatCardTitle,
TranslatePipe,
- Information
+ Information,
+ MatButton,
+ MatIcon,
+ MatFormField,
+ MatInput,
+ MatLabel,
+ ReactiveFormsModule,
+ FormsModule
],
templateUrl: './conway-gol.html',
styleUrl: './conway-gol.scss',
})
-export class ConwayGol {
-
- protected readonly UrlConstants = UrlConstants;
+export class ConwayGol implements AfterViewInit {
algoInformation: AlgorithmInformation = {
- title: 'PATHFINDING.EXPLANATION.TITLE',
+ title: 'GOL.EXPLANATION.TITLE',
entries: [
{
- name: 'Dijkstra',
- description: 'PATHFINDING.EXPLANATION.DIJKSTRA_EXPLANATION',
- link: UrlConstants.DIJKSTRA_WIKI
- },
- {
- name: 'A*',
- description: 'PATHFINDING.EXPLANATION.ASTAR_EXPLANATION',
- link: UrlConstants.ASTAR_WIKI
+ name: '',
+ description: 'GOL.EXPLANATION.EXPLANATION',
+ link: UrlConstants.CONWAYS_WIKI
}
],
- disclaimer: 'PATHFINDING.EXPLANATION.DISCLAIMER',
+ disclaimer: 'GOL.EXPLANATION.DISCLAIMER',
disclaimerBottom: '',
- disclaimerListEntry: []
+ disclaimerListEntry: ['GOL.EXPLANATION.DISCLAIMER_1', 'GOL.EXPLANATION.DISCLAIMER_2', 'GOL.EXPLANATION.DISCLAIMER_3', 'GOL.EXPLANATION.DISCLAIMER_4']
};
+ protected gridCols = DEFAULT_GRID_COLS;
+ protected gridRows = DEFAULT_GRID_ROWS;
+ protected readonly MIN_GRID_SIZE = MIN_GRID_SIZE;
+ protected readonly MAX_GRID_SIZE = MAX_GRID_SIZE;
+ nodeSize = 10;
+ grid: Node[][] = [];
+
+ @ViewChild('gridCanvas', { static: true })
+ canvas!: ElementRef