From a80f2f841c10b245cd23c8a7e2f26a60eaf1e5f6 Mon Sep 17 00:00:00 2001 From: Peter Hudec Date: Sun, 17 Dec 2023 12:17:08 +0100 Subject: [PATCH] added game logic --- game.html | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/game.html b/game.html index a0fbe68..ecaee56 100644 --- a/game.html +++ b/game.html @@ -27,16 +27,16 @@
Tief: - {{ pos }} + {{ pos }} Police: - {{ pos }} + {{ pos }} Transport: {{ r.transport }}
Tief: - {{ pos }} + {{ pos }} Police: Transport: @@ -86,9 +86,25 @@ 'police': this.round.police.slice(), }) // clear values + + let tief = new Array() + for (vertex in this.round.tief) { + let tief_pos = this.round.tief[vertex] + // iterate edges + for (edge in this.graph[tief_pos].siblings) { + let sibbling = this.graph[tief_pos].siblings[edge] + if (this.round.police.includes(sibbling.vertex)) { + console.log("skip vertex, police there") + } else if (sibbling.edge == this.round.transport) { + tief.push(sibbling.vertex) + } else if (this.round.transport == 'hidden') { + tief.push(sibbling.vertex) + } + } + } this.round.police = new Array(this.police_players).fill(0); this.round.transport = null - this.round.tief.push(4) + this.round.tief = new Set(tief) }, listPossibleTransports(round) { let values = []