From 1610bf2467bf96c7865567256d0fc632c211d28b Mon Sep 17 00:00:00 2001 From: Arnas Udovic Date: Fri, 29 Dec 2023 20:40:04 +0200 Subject: [PATCH] UI finished --- main.go | 5 +++++ views/about.en.html | 25 +++++++++++++++++++++++++ views/about.sgs.html | 25 +++++++++++++++++++++++++ views/index.html | 26 +++++++++++++++----------- views/layouts/master.html | 13 ++++++++++++- views/statistics.en.html | 6 ++++++ views/statistics.sgs.html | 6 ++++++ views/title.en.html | 2 +- views/title.sgs.html | 2 +- 9 files changed, 96 insertions(+), 14 deletions(-) create mode 100644 views/about.en.html create mode 100644 views/about.sgs.html create mode 100644 views/statistics.en.html create mode 100644 views/statistics.sgs.html diff --git a/main.go b/main.go index e5277e4..c391513 100644 --- a/main.go +++ b/main.go @@ -79,6 +79,11 @@ func main() { return false }, + "total": 8787, + "aiWon": 232, + "aiWonPercent": "3.5%", + "draw": 6777, + "drawPercent": "94.4%", }) }) diff --git a/views/about.en.html b/views/about.en.html new file mode 100644 index 0000000..cd476dd --- /dev/null +++ b/views/about.en.html @@ -0,0 +1,25 @@ +

+ A small project to test pseudo AI on Tic Tac Toe. +

+ +

+ Main idea was to train AI by playing game. AI has wining games datebase and select next click by selecting next step from already plaied game. In the last results AI should never lose. +

+ +

+ Another idea was for myself to get some trainings on go programming language. +

+ +

+ Project written on GPL3 license what you can get here. Project source are https://g.arns.lt/zordsdavini/tic-tac-toe. +

+ +

About myself

+ +

+ I am Arns Udovič from Lithuania. You can follow me on fediverse at @zordsdavini@s.arns.lt +

+ +

+ +

diff --git a/views/about.sgs.html b/views/about.sgs.html new file mode 100644 index 0000000..c32581e --- /dev/null +++ b/views/about.sgs.html @@ -0,0 +1,25 @@ +

+ Mažos pruojektoks patestoutė pseudo DI so Krīžioku-Nulioku žaidėmo. +

+ +

+ Pėrmuojė idiejė bova ėšmuokintė DI žaidont žaidėma. DI tor vėsus laimietus žaidėmus duombazie ė pajem sekonti ējėma ėš jau sožaistū žaidėmu. Galotėniam rezoltatė DI turietom nabpralaimietė. +

+ +

+ Kėta idiejė bova pasėtrenėroutė mon patiam ont Go programavėma kalbuos. +

+ +

+ Pruojekts parašīts ont GPL3 licenzėjės , katron galat gautė ėš če (onglėškā). Pruojekta kuods īr https://g.arns.lt/zordsdavini/tic-tac-toe. +

+ +

Aple monėm pati

+ +

+ Eso Udovič Arns. Galat monėm sektė fediversė @zordsdavini@s.arns.lt +

+ +

+ +

diff --git a/views/index.html b/views/index.html index ad1ef62..0969148 100644 --- a/views/index.html +++ b/views/index.html @@ -40,17 +40,21 @@ {{define "content"}} -
- {{ $Game := .game }} - {{ $GameFlow := .gameFlow }} - {{ range .fields }} - {{ if call $.disabled $Game . }} - - {{ else }} - +
+ {{ $Game := .game }} + {{ $GameFlow := .gameFlow }} + {{ range .fields }} + {{ if call $.disabled $Game . }} + + {{ else }} + + {{ end }} {{ end }} - {{ end }} -
+
-Game: {{.gameFlow}} + {{ if eq .lang "sgs"}} + {{include "statistics.sgs"}} + {{ else }} + {{include "statistics.en"}} + {{ end }} {{end}} diff --git a/views/layouts/master.html b/views/layouts/master.html index f40444e..26e7420 100644 --- a/views/layouts/master.html +++ b/views/layouts/master.html @@ -17,7 +17,18 @@ {{ end }} - {{template "content" .}} +
+
+ {{template "content" .}} +
+
+ {{ if eq .lang "sgs"}} + {{include "about.sgs"}} + {{ else }} + {{include "about.en"}} + {{ end }} +
+
{{include "layouts/footer"}} diff --git a/views/statistics.en.html b/views/statistics.en.html new file mode 100644 index 0000000..82a2c15 --- /dev/null +++ b/views/statistics.en.html @@ -0,0 +1,6 @@ +

+ Game: {{.gameFlow}}
+ Total plaied: {{.total}}
+ AI Won: {{.aiWon}} {{.aiWonPercent}}
+ Draw: {{.draw}} {{.drawPercent}}
+

diff --git a/views/statistics.sgs.html b/views/statistics.sgs.html new file mode 100644 index 0000000..052f9af --- /dev/null +++ b/views/statistics.sgs.html @@ -0,0 +1,6 @@ +

+ Žaidėms: {{.gameFlow}}
+ Ėš vėsa žaidėmu: {{.total}}
+ Laimiejė DI: {{.aiWon}} {{.aiWonPercent}}
+ Līgiuoms: {{.draw}} {{.drawPercent}}
+

diff --git a/views/title.en.html b/views/title.en.html index 61a87cb..e7df63d 100644 --- a/views/title.en.html +++ b/views/title.en.html @@ -9,7 +9,7 @@
- Me first! + Me first! AI first
diff --git a/views/title.sgs.html b/views/title.sgs.html index 23fec07..1fdd66d 100644 --- a/views/title.sgs.html +++ b/views/title.sgs.html @@ -9,6 +9,6 @@
- Aš pėrms! + Aš pėrms! DI pėrms