summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorPrzemyslaw <prymula76@outlook.com>2024-04-18 18:46:24 +0200
committerPrzemyslaw <prymula76@outlook.com>2024-04-18 18:46:24 +0200
commit11818054364b6248be8ff092d2914598f1081dc5 (patch)
tree361ab82dcba66f79a7cd4f911dc0873a0bf0632a /web
Init
Diffstat (limited to 'web')
-rw-r--r--web/samegame/.hg/00changelog.ibin0 -> 57 bytes
-rw-r--r--web/samegame/.hg/branch1
-rw-r--r--web/samegame/.hg/cache/branch2-base1
-rw-r--r--web/samegame/.hg/cache/branch2-immutable1
-rw-r--r--web/samegame/.hg/cache/branch2-served2
-rw-r--r--web/samegame/.hg/cache/branch2-served.hidden2
-rw-r--r--web/samegame/.hg/cache/branch2-visible1
-rw-r--r--web/samegame/.hg/cache/branch2-visible-hidden1
-rw-r--r--web/samegame/.hg/cache/rbc-names-v11
-rw-r--r--web/samegame/.hg/cache/rbc-revs-v1bin0 -> 8 bytes
-rw-r--r--web/samegame/.hg/dirstatebin0 -> 450 bytes
-rw-r--r--web/samegame/.hg/hgrc14
-rw-r--r--web/samegame/.hg/last-message.txt1
-rw-r--r--web/samegame/.hg/requires1
-rw-r--r--web/samegame/.hg/store/00changelog.ibin0 -> 296 bytes
-rw-r--r--web/samegame/.hg/store/00manifest.ibin0 -> 422 bytes
-rw-r--r--web/samegame/.hg/store/data/_changelog.txt.ibin0 -> 672 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/_m_e_t_a-_i_n_f/_m_a_n_i_f_e_s_t._m_f.ibin0 -> 104 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.ibin0 -> 336 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/display.jsp.ibin0 -> 2871 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.ibin0 -> 265 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.ibin0 -> 265 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.dbin0 -> 143617 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.ibin0 -> 64 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/index.jsp.ibin0 -> 409 bytes
-rw-r--r--web/samegame/.hg/store/data/src/main/webapp/menu.jsp.ibin0 -> 1137 bytes
-rw-r--r--web/samegame/.hg/store/fncache10
-rw-r--r--web/samegame/.hg/store/phaseroots0
-rw-r--r--web/samegame/.hg/store/requires7
-rw-r--r--web/samegame/.hg/store/undo0
-rw-r--r--web/samegame/.hg/store/undo.backup.phaseroots.bck1
-rw-r--r--web/samegame/.hg/store/undo.backupfilesbin0 -> 43 bytes
-rw-r--r--web/samegame/.hg/undo.desc3
-rwxr-xr-xweb/samegame/.hg/wcache/checkisexec0
l---------web/samegame/.hg/wcache/checklink1
-rw-r--r--web/samegame/.hg/wcache/checklink-target0
-rw-r--r--web/samegame/.hg/wcache/manifestfulltextcachebin0 -> 659 bytes
-rw-r--r--web/samegame/Changelog.txt15
-rw-r--r--web/samegame/src/main/webapp/META-INF/MANIFEST.MF3
-rw-r--r--web/samegame/src/main/webapp/WEB-INF/web.xml12
-rw-r--r--web/samegame/src/main/webapp/display.jsp429
-rw-r--r--web/samegame/src/main/webapp/display_desktop.css53
-rw-r--r--web/samegame/src/main/webapp/display_mobile.css53
-rw-r--r--web/samegame/src/main/webapp/img/SameGame.pngbin0 -> 143872 bytes
-rw-r--r--web/samegame/src/main/webapp/index.jsp20
-rw-r--r--web/samegame/src/main/webapp/menu.jsp103
46 files changed, 736 insertions, 0 deletions
diff --git a/web/samegame/.hg/00changelog.i b/web/samegame/.hg/00changelog.i
new file mode 100644
index 0000000..22e0643
--- /dev/null
+++ b/web/samegame/.hg/00changelog.i
Binary files differ
diff --git a/web/samegame/.hg/branch b/web/samegame/.hg/branch
new file mode 100644
index 0000000..4ad96d5
--- /dev/null
+++ b/web/samegame/.hg/branch
@@ -0,0 +1 @@
+default
diff --git a/web/samegame/.hg/cache/branch2-base b/web/samegame/.hg/cache/branch2-base
new file mode 100644
index 0000000..1be6c74
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-base
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 -1
diff --git a/web/samegame/.hg/cache/branch2-immutable b/web/samegame/.hg/cache/branch2-immutable
new file mode 100644
index 0000000..1be6c74
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-immutable
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 -1
diff --git a/web/samegame/.hg/cache/branch2-served b/web/samegame/.hg/cache/branch2-served
new file mode 100644
index 0000000..d800641
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-served
@@ -0,0 +1,2 @@
+c653e48f8fe31fee3da2a1bf5161babbdaebfcce 0
+c653e48f8fe31fee3da2a1bf5161babbdaebfcce o default
diff --git a/web/samegame/.hg/cache/branch2-served.hidden b/web/samegame/.hg/cache/branch2-served.hidden
new file mode 100644
index 0000000..d800641
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-served.hidden
@@ -0,0 +1,2 @@
+c653e48f8fe31fee3da2a1bf5161babbdaebfcce 0
+c653e48f8fe31fee3da2a1bf5161babbdaebfcce o default
diff --git a/web/samegame/.hg/cache/branch2-visible b/web/samegame/.hg/cache/branch2-visible
new file mode 100644
index 0000000..1be6c74
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-visible
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 -1
diff --git a/web/samegame/.hg/cache/branch2-visible-hidden b/web/samegame/.hg/cache/branch2-visible-hidden
new file mode 100644
index 0000000..1be6c74
--- /dev/null
+++ b/web/samegame/.hg/cache/branch2-visible-hidden
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 -1
diff --git a/web/samegame/.hg/cache/rbc-names-v1 b/web/samegame/.hg/cache/rbc-names-v1
new file mode 100644
index 0000000..331d858
--- /dev/null
+++ b/web/samegame/.hg/cache/rbc-names-v1
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/web/samegame/.hg/cache/rbc-revs-v1 b/web/samegame/.hg/cache/rbc-revs-v1
new file mode 100644
index 0000000..3db0480
--- /dev/null
+++ b/web/samegame/.hg/cache/rbc-revs-v1
Binary files differ
diff --git a/web/samegame/.hg/dirstate b/web/samegame/.hg/dirstate
new file mode 100644
index 0000000..49209d0
--- /dev/null
+++ b/web/samegame/.hg/dirstate
Binary files differ
diff --git a/web/samegame/.hg/hgrc b/web/samegame/.hg/hgrc
new file mode 100644
index 0000000..e936f00
--- /dev/null
+++ b/web/samegame/.hg/hgrc
@@ -0,0 +1,14 @@
+# example repository config (see 'hg help config' for more info)
+[paths]
+default = https://repo2.small.pl/hg/pub/pietraszczyk/samegame
+
+# path aliases to other clones of this repo in URLs or filesystem paths
+# (see 'hg help config.paths' for more info)
+#
+# default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
+# my-fork = ssh://jdoe@example.net/hg/jdoes-fork
+# my-clone = /home/jdoe/jdoes-clone
+
+[ui]
+# name and email (local to this repository, optional), e.g.
+# username = Jane Doe <jdoe@example.com>
diff --git a/web/samegame/.hg/last-message.txt b/web/samegame/.hg/last-message.txt
new file mode 100644
index 0000000..9392150
--- /dev/null
+++ b/web/samegame/.hg/last-message.txt
@@ -0,0 +1 @@
+smaegame-0.240307-2 \ No newline at end of file
diff --git a/web/samegame/.hg/requires b/web/samegame/.hg/requires
new file mode 100644
index 0000000..653b649
--- /dev/null
+++ b/web/samegame/.hg/requires
@@ -0,0 +1 @@
+share-safe
diff --git a/web/samegame/.hg/store/00changelog.i b/web/samegame/.hg/store/00changelog.i
new file mode 100644
index 0000000..afb46a1
--- /dev/null
+++ b/web/samegame/.hg/store/00changelog.i
Binary files differ
diff --git a/web/samegame/.hg/store/00manifest.i b/web/samegame/.hg/store/00manifest.i
new file mode 100644
index 0000000..447434d
--- /dev/null
+++ b/web/samegame/.hg/store/00manifest.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/_changelog.txt.i b/web/samegame/.hg/store/data/_changelog.txt.i
new file mode 100644
index 0000000..5d4aad5
--- /dev/null
+++ b/web/samegame/.hg/store/data/_changelog.txt.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/_m_e_t_a-_i_n_f/_m_a_n_i_f_e_s_t._m_f.i b/web/samegame/.hg/store/data/src/main/webapp/_m_e_t_a-_i_n_f/_m_a_n_i_f_e_s_t._m_f.i
new file mode 100644
index 0000000..c66c6e0
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/_m_e_t_a-_i_n_f/_m_a_n_i_f_e_s_t._m_f.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i b/web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i
new file mode 100644
index 0000000..112c28e
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/display.jsp.i b/web/samegame/.hg/store/data/src/main/webapp/display.jsp.i
new file mode 100644
index 0000000..d8739f7
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/display.jsp.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.i b/web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.i
new file mode 100644
index 0000000..ea91c3c
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.i b/web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.i
new file mode 100644
index 0000000..ea91c3c
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.d b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.d
new file mode 100644
index 0000000..552da45
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.d
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.i b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.i
new file mode 100644
index 0000000..adebd2e
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/index.jsp.i b/web/samegame/.hg/store/data/src/main/webapp/index.jsp.i
new file mode 100644
index 0000000..389a047
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/index.jsp.i
Binary files differ
diff --git a/web/samegame/.hg/store/data/src/main/webapp/menu.jsp.i b/web/samegame/.hg/store/data/src/main/webapp/menu.jsp.i
new file mode 100644
index 0000000..158837e
--- /dev/null
+++ b/web/samegame/.hg/store/data/src/main/webapp/menu.jsp.i
Binary files differ
diff --git a/web/samegame/.hg/store/fncache b/web/samegame/.hg/store/fncache
new file mode 100644
index 0000000..fe7a980
--- /dev/null
+++ b/web/samegame/.hg/store/fncache
@@ -0,0 +1,10 @@
+data/src/main/webapp/img/SameGame.png.i
+data/src/main/webapp/img/SameGame.png.d
+data/src/main/webapp/META-INF/MANIFEST.MF.i
+data/src/main/webapp/display.jsp.i
+data/src/main/webapp/menu.jsp.i
+data/src/main/webapp/display_desktop.css.i
+data/src/main/webapp/WEB-INF/web.xml.i
+data/src/main/webapp/display_mobile.css.i
+data/src/main/webapp/index.jsp.i
+data/Changelog.txt.i
diff --git a/web/samegame/.hg/store/phaseroots b/web/samegame/.hg/store/phaseroots
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web/samegame/.hg/store/phaseroots
diff --git a/web/samegame/.hg/store/requires b/web/samegame/.hg/store/requires
new file mode 100644
index 0000000..52fc616
--- /dev/null
+++ b/web/samegame/.hg/store/requires
@@ -0,0 +1,7 @@
+dotencode
+fncache
+generaldelta
+revlog-compression-zstd
+revlogv1
+sparserevlog
+store
diff --git a/web/samegame/.hg/store/undo b/web/samegame/.hg/store/undo
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web/samegame/.hg/store/undo
diff --git a/web/samegame/.hg/store/undo.backup.phaseroots.bck b/web/samegame/.hg/store/undo.backup.phaseroots.bck
new file mode 100644
index 0000000..a27ae64
--- /dev/null
+++ b/web/samegame/.hg/store/undo.backup.phaseroots.bck
@@ -0,0 +1 @@
+1 c653e48f8fe31fee3da2a1bf5161babbdaebfcce
diff --git a/web/samegame/.hg/store/undo.backupfiles b/web/samegame/.hg/store/undo.backupfiles
new file mode 100644
index 0000000..a48725e
--- /dev/null
+++ b/web/samegame/.hg/store/undo.backupfiles
Binary files differ
diff --git a/web/samegame/.hg/undo.desc b/web/samegame/.hg/undo.desc
new file mode 100644
index 0000000..2b4a95a
--- /dev/null
+++ b/web/samegame/.hg/undo.desc
@@ -0,0 +1,3 @@
+1
+push-response
+https://repo2.small.pl/hg/pub/pietraszczyk/samegame
diff --git a/web/samegame/.hg/wcache/checkisexec b/web/samegame/.hg/wcache/checkisexec
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/web/samegame/.hg/wcache/checkisexec
diff --git a/web/samegame/.hg/wcache/checklink b/web/samegame/.hg/wcache/checklink
new file mode 120000
index 0000000..326d735
--- /dev/null
+++ b/web/samegame/.hg/wcache/checklink
@@ -0,0 +1 @@
+checklink-target \ No newline at end of file
diff --git a/web/samegame/.hg/wcache/checklink-target b/web/samegame/.hg/wcache/checklink-target
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web/samegame/.hg/wcache/checklink-target
diff --git a/web/samegame/.hg/wcache/manifestfulltextcache b/web/samegame/.hg/wcache/manifestfulltextcache
new file mode 100644
index 0000000..731f57f
--- /dev/null
+++ b/web/samegame/.hg/wcache/manifestfulltextcache
Binary files differ
diff --git a/web/samegame/Changelog.txt b/web/samegame/Changelog.txt
new file mode 100644
index 0000000..c87aaae
--- /dev/null
+++ b/web/samegame/Changelog.txt
@@ -0,0 +1,15 @@
+0.240307-2 - Póki co nie zrzuca wyjątków, zmana nazwy na Same Game
+0.230307-1 - Przebudowa ekranu powitalnego c.d oraz próba obsługi wyjąktku dla like_*
+0.240307-0 - Przebudowa ekranu powitalnego
+0.240306-2 - Przy pierwszym bądz również drugim wejściu na stronę gry, aplkkacja zrzuca wyjątek - poprawki w like_*
+0.240306-1 - Poprawki przy orientacji
+0.240306-0 - Orientacja pionowa i pozioma - finisz ?
+0.240305-1 - Orientacja pionowa i pozioma - próba
+0,240305-0 - Sortowanie listy 'groupList', w pierwszym rzucie usuwa prawidłowo do koloru
+0.240304-1 - Prawie dobrze, zdarza się jednak że gdy kliknie się pole z dołu o nie usunie na górze
+0.240304-0 - Prawie kasuje w grupie kolorów, wymaga dopracowania
+0.240303-0 - Próba skasowania kilku wybranych wedlug koloru pozycji
+0.240222-2 - Wypośrodkowanie, lang=pl
+0.230222-0 - Dodałem proste menu z przyciskami - niestety nie można ustawić odgórnie trybu pełnoekranowego
+0.240220-0 - Przynajmniej w teorii powinien rozpoznawać orenację ekranu
+0.240219-0 - Inicjacja
diff --git a/web/samegame/src/main/webapp/META-INF/MANIFEST.MF b/web/samegame/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/web/samegame/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/web/samegame/src/main/webapp/WEB-INF/web.xml b/web/samegame/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..01ac0bc
--- /dev/null
+++ b/web/samegame/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" id="WebApp_ID" version="6.0">
+ <display-name>samegame</display-name>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ </welcome-file-list>
+</web-app> \ No newline at end of file
diff --git a/web/samegame/src/main/webapp/display.jsp b/web/samegame/src/main/webapp/display.jsp
new file mode 100644
index 0000000..a67a792
--- /dev/null
+++ b/web/samegame/src/main/webapp/display.jsp
@@ -0,0 +1,429 @@
+<!--
+ Same Game - drugie podejscie do JSP
+ data:2024-02-19
+ IDE: Eclipse
+ napisal: Przemyslaw R. Pietraszczyk
+ licencja: GPL3
+ -->
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"
+ import="java.util.*" import="java.lang.*"%>
+ <%
+ out.print("<!DOCTYPE html><html lang=\"pl\"><head><meta charset=\"UTF-8\"><title>Same Game (BETA)</title>");
+%>
+<%!
+class Box {
+ int index;
+ int groupIndex;
+ String color;
+ int x , y;
+ boolean visit;
+ public List<String> groupList = new ArrayList<String> ();
+ public Box() {
+ visit=false;
+ }
+ public void setIndex(int n) {
+ int index = n;
+ }
+ public void setGroupIndex(int n) {
+ groupIndex = n;
+ }
+ public void setColorName(String c) {
+ color = c;
+ }
+ public void setVelocity (int _x, int _y){
+ x =_x;
+ y =_y;
+ }
+ public int geGroupIndex() {
+ return groupIndex;
+ }
+ public String getColor() {
+ return color;
+ }
+// public String veloctyToString() {
+// return (String.valueOf(x)+ " " + String.valueOf(y));
+// }
+ public int getVelocityY() {
+ return y;
+ }
+ public int getVelocityX() {
+ return x;
+ }
+ public Box get(){
+ return this;
+ }
+
+}
+
+public void like_landscape(String color, Box [][] squares, int y, int x, int origy, int origx) throws StackOverflowError{
+
+ if (squares[y][x].getColor().equals(color)) {
+ if (y >= 1) {
+ if (squares[y-1][x].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_landscape(color, squares, y-1, x, origy, origx);
+ try {
+ like_landscape(color, squares, y-1, x, origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_landscape(color, squares, y-1, x, origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ if (x >= 1) {
+ if (squares[y][x-1].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_landscape(color, squares, y, x-1 , origy, origx);
+ try {
+ like_landscape(color, squares, y, x-1 , origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_landscape(color, squares, y, x-1 , origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ if (y < 4) {
+ if (squares[y+1][x].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_landscape(color, squares, y+1, x, origy, origx);
+ try {
+ like_landscape(color, squares, y+1, x, origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_landscape(color, squares, y+1, x, origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ if (x < 10) {
+ if (squares[y][x+1].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_landscape(color, squares, y, x+1 , origy, origx);
+ try {
+ like_landscape(color, squares, y, x+1 , origy, origx);
+ // intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_landscape(color, squares, y, x+1 , origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ squares[y][x].visit = false;
+ }
+}
+
+public void like_portrait(String color, Box [][] squares, int y, int x, int origy, int origx)throws Exception, StackOverflowError {
+
+ if (squares[y][x].getColor().equals(color)) {
+ if (y >= 1) {
+ if (squares[y-1][x].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_portrait(color, squares, y-1, x, origy, origx);
+ try {
+ like_portrait(color, squares, y-1, x, origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_portrait(color, squares, y-1, x, origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ if (x >= 1) {
+ if (squares[y][x-1].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_portrait(color, squares, y, x-1 , origy, origx);
+ try {
+ like_portrait(color, squares, y, x-1 , origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_portrait(color, squares, y, x-1 , origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+
+ if (y < 10) {
+ if (squares[y+1][x].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_portrait(color, squares, y+1, x, origy, origx);
+ try {
+ like_portrait(color, squares, y+1, x, origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_portrait(color, squares, y+1, x, origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ if (x < 4) {
+ if (squares[y][x+1].visit == false) {
+ squares[origy][origx].groupList.add(String.valueOf(squares[y][x].geGroupIndex()));
+ //like_portrait(color, squares, y, x+1 , origy, origx);
+ try {
+ like_portrait(color, squares, y, x+1 , origy, origx);
+ //intelligence.add("3");
+ }
+ catch (StackOverflowError s) {
+ like_portrait(color, squares, y, x+1 , origy, origx);
+ intelligence.add("4");
+ }
+ }
+ squares[y][x].visit = true;
+ }
+ squares[y][x].visit = false;
+ }
+}
+
+
+public void removeDuplicates(Box b) {
+ List<String> tmp = new ArrayList<String> ();
+
+ for(String item:b.groupList){
+ boolean find = false;
+ for (String t:tmp) {
+ if (t.equals(item)){
+ find = true;
+ }
+ }
+ if (find == false) {
+ tmp.add(item);
+ }
+ }
+ b.groupList.clear();
+ b.groupList = tmp;
+}
+
+public void clearVisit(Box[][] b, int y, int x){
+ b[y][x].visit = false;
+}
+
+public void sort(Box b) {
+
+ String[] strings = b.groupList.toArray(String[]::new);
+
+ Integer[] numbers = new Integer[strings.length];
+ for(int i = 0;i < strings.length;i++)
+ {
+ try
+ {
+ numbers[i] = Integer.parseInt(strings[i]);
+ }
+ catch (NumberFormatException nfe)
+ {
+ numbers[i] = null;
+ }
+ }
+
+ int n = numbers.length;
+ int temp = 0;
+ for(int i=0; i < n; i++){
+ for(int j=1; j < (n-i); j++){
+ if(numbers[j-1] > numbers[j]){
+ //swap elements
+ temp = numbers[j-1];
+ numbers[j-1] = numbers[j];
+ numbers[j] = temp;
+ }
+
+ }
+ }
+ b.groupList.clear();
+ for(int i = 0;i < numbers.length;i++)
+ {
+ try
+ {
+ b.groupList.add(Integer.toString(numbers[i]));
+ }
+ catch (NumberFormatException nfe)
+ {
+ //numbers[i] = null;
+ }
+ }
+
+}
+//public int intelligence = 0;
+public List<String> intelligence = new ArrayList<String> ();
+
+
+%>
+<%
+String userAgent = request.getHeader("User-Agent");
+boolean isMobile = (userAgent != null && !userAgent.isEmpty() && userAgent.toLowerCase().contains("android"));
+
+if (isMobile) {
+ out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"display_mobile.css\">");
+
+}
+else {
+ out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"display_desktop.css\">");
+}
+
+
+%>
+
+ <script type="text/javascript">
+ const colors = new Array("green", "red", "pink", "aqua", "blue", "lime", "fuchsia", "maroon", "olive");
+ function launchFullScreen(element) {
+ if(element.requestFullScreen) {
+ element.requestFullScreen();
+ } else if(element.mozRequestFullScreen) {
+ element.mozRequestFullScreen();
+ } else if(element.webkitRequestFullScreen) {
+ element.webkitRequestFullScreen();
+ }
+ }
+ <%
+ //List<Box> squares = new ArrayList<Box> ();
+ List<String> list = new ArrayList<String> ();
+ Random rand = new Random();
+ String[] colors = { "green", "red", "pink", "aqua", "blue", "lime", "fuchsia", "maroon", "olive"};
+
+
+ //Iterator<String> ite = list.iterator();
+ //while (ite.hasNext()) {
+ // Object o = ite.next();
+ //some condition
+// ite.remove();
+// }
+ //int r = rand.nextInt(8 - 1) + 1;; // 8
+ int r = rand.nextInt(2);
+ list.add(colors[r]);
+ out.print("function change(list) { if (list.length >= 2) {list.forEach((n) => { document.getElementById(\"group\"+n).remove()})}}");
+ %>
+
+ </script>
+
+
+</head>
+
+
+
+<%
+
+String orient = request.getParameter("data");
+Box[][] squares;
+
+ //orient = "portrait";
+ //while (true) {
+ int x = 0;
+ int y = 0;
+ List<Integer> tmp = new ArrayList<Integer> ();
+ int orientX = 5;
+ int orientY = 5;
+ //boolean landscape = true;
+
+ if (orient.equals("landscape")) {
+ orientX = 11;
+ orientY = 5;
+ //landscape = true;
+ }
+ else if (orient.equals("portrait")) {
+ orientX = 5;
+ orientY = 11;
+ //landscape = false;
+ }
+
+ squares = new Box[orientY][orientX];
+
+ int k = 0;
+ for (int i = 0; i < orientY; i++) {
+ for (int j = 0; j < orientX; j++) {
+ squares[i][j] = new Box();
+
+ squares[i][j].setColorName(colors[rand.nextInt(3)]); // 9
+ //squares[i][j].incrementGroupIndex();
+ squares[i][j].setGroupIndex(k++);
+ squares[i][j].setVelocity(i, j);
+
+ }
+ }
+ out.print("<body>");
+
+ out.print("<table class=\"center\">");
+ k = 0;
+ for (int i = 0; i < orientY; i++) {
+ out.print("<tr>");
+
+
+ for (int j = 0; j < orientX; j++, k++) {
+ List<String> ids = new ArrayList<String> ();
+
+ //like (squares[i][j].getColor(), squares, squares[i][j].getVelocityY(), squares[i][j].getVelocityX(), ids, i, j);
+ if (orient.equals("landscape")) {
+ //if (landscape == true) {
+
+ try {
+ like_landscape(squares[i][j].getColor(), squares, i,j, i, j);
+ }
+ catch (Exception e) {
+ //exejava.lang.StackOverflowError
+ try {
+ like_landscape(squares[i][j].getColor(), squares, i,j, i, j);
+ // intelligence.add("1");
+ }
+ catch (StackOverflowError s) {
+ like_landscape(squares[i][j].getColor(), squares, i,j, i, j);
+ intelligence.add("2");
+ }
+ }
+ }
+ else if (orient.equals("portrait")) {
+ //else {
+ try {
+ like_portrait(squares[i][j].getColor(), squares, i,j, i, j);
+ }
+ catch (Exception e) {
+ //exejava.lang.StackOverflowError
+ try {
+ like_portrait(squares[i][j].getColor(), squares, i,j, i, j);
+ // intelligence.add("1");
+ }
+ catch (StackOverflowError s) {
+ like_portrait(squares[i][j].getColor(), squares, i,j, i, j);
+ intelligence.add("2");
+ }
+ }
+ }
+
+ clearVisit(squares, i, j);
+
+ removeDuplicates(squares[i][j]);
+ sort(squares[i][j]);
+ //out.print("<td class=\""+squares[i][j].getColor()+"\" id=\"group"+k+"\" onclick=\"change("+squares[i][j].groupList.toString()+")\">"+squares[i][j].getColor()+"</td>");
+ //out.print("<td class=\""+squares[i][j].getColor()+"\" id=\"group"+k+"\" onclick=\"change("+squares[i][j].groupList.toString()+")\">"+squares[i][j].groupList.toString()+"</td>");
+ out.print("<td class=\""+squares[i][j].getColor()+"\" id=\"group"+k+"\" onclick=\"change("+squares[i][j].groupList.toString()+")\">"+orient+squares[i][j].groupList.toString()+"</td>");
+
+ //++k;
+
+
+
+ }
+ out.print("</tr>");
+ out.print(">"+intelligence.toString()+"<");
+
+ }
+
+
+
+ out.print("</table>");
+
+ out.print("</body>\n</html>");
+
+%> \ No newline at end of file
diff --git a/web/samegame/src/main/webapp/display_desktop.css b/web/samegame/src/main/webapp/display_desktop.css
new file mode 100644
index 0000000..c472f0e
--- /dev/null
+++ b/web/samegame/src/main/webapp/display_desktop.css
@@ -0,0 +1,53 @@
+body {
+ background-color: grey;
+}
+.green {
+ width: 10rem;
+ height: 10rem;
+ background-color: green;
+}
+.red {
+ width: 10rem;
+ height: 10rem;
+ background-color: red;
+}
+.pink {
+ width: 10rem;
+ height: 10rem;
+ background-color: pink;
+}
+.aqua {
+ width: 10rem;
+ height: 10rem;
+ background-color: aqua;
+}
+.blue {
+ width: 10rem;
+ height: 10rem;
+ background-color: blue;
+}
+.lime {
+ width: 10rem;
+ height: 10rem;
+ background-color: lime;
+}
+.fuchsia {
+ width: 10rem;
+ height: 10rem;
+ background-color: fuchsia;
+}
+.maroon {
+ width: 10rem;
+ height: 10rem;
+ background-color: maroon;
+}
+.olive {
+ width: 10rem;
+ height: 10rem;
+ background-color: olive;
+}
+.center {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: auto;
+} \ No newline at end of file
diff --git a/web/samegame/src/main/webapp/display_mobile.css b/web/samegame/src/main/webapp/display_mobile.css
new file mode 100644
index 0000000..c472f0e
--- /dev/null
+++ b/web/samegame/src/main/webapp/display_mobile.css
@@ -0,0 +1,53 @@
+body {
+ background-color: grey;
+}
+.green {
+ width: 10rem;
+ height: 10rem;
+ background-color: green;
+}
+.red {
+ width: 10rem;
+ height: 10rem;
+ background-color: red;
+}
+.pink {
+ width: 10rem;
+ height: 10rem;
+ background-color: pink;
+}
+.aqua {
+ width: 10rem;
+ height: 10rem;
+ background-color: aqua;
+}
+.blue {
+ width: 10rem;
+ height: 10rem;
+ background-color: blue;
+}
+.lime {
+ width: 10rem;
+ height: 10rem;
+ background-color: lime;
+}
+.fuchsia {
+ width: 10rem;
+ height: 10rem;
+ background-color: fuchsia;
+}
+.maroon {
+ width: 10rem;
+ height: 10rem;
+ background-color: maroon;
+}
+.olive {
+ width: 10rem;
+ height: 10rem;
+ background-color: olive;
+}
+.center {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: auto;
+} \ No newline at end of file
diff --git a/web/samegame/src/main/webapp/img/SameGame.png b/web/samegame/src/main/webapp/img/SameGame.png
new file mode 100644
index 0000000..0616614
--- /dev/null
+++ b/web/samegame/src/main/webapp/img/SameGame.png
Binary files differ
diff --git a/web/samegame/src/main/webapp/index.jsp b/web/samegame/src/main/webapp/index.jsp
new file mode 100644
index 0000000..db94d27
--- /dev/null
+++ b/web/samegame/src/main/webapp/index.jsp
@@ -0,0 +1,20 @@
+<!--
+ Same Game - drugie podejscie do JSP
+ data:2024-02-19
+ IDE: Eclipse
+ napisal: Przemyslaww R. Pietraszczyk
+ licencja: GPL3
+ -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Same Game</title>
+</head>
+<body>
+<script>
+if (window.matchMedia("(orientation: landscape)").matches) { document.location.href = "menu.jsp?data="+"landscape"; } // you're in LANDSCAPE mode
+else { document.location.href = "menu.jsp?data="+"portrait"; }
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/web/samegame/src/main/webapp/menu.jsp b/web/samegame/src/main/webapp/menu.jsp
new file mode 100644
index 0000000..8847e89
--- /dev/null
+++ b/web/samegame/src/main/webapp/menu.jsp
@@ -0,0 +1,103 @@
+<!--
+ Same Game - drugie podejście do JSP
+ data:2024-02-19
+ IDE: Eclipse
+ napisał: Przemysłąw R. Pietraszczyk
+ licencja: GPL3
+ -->
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html lang="pl">
+<head>
+<title>Same Game</title>
+
+<style>
+ body {
+ background-color: brown;
+ }
+ .about {
+ padding: 5rem 8rem;
+ width: 30rem;
+ height: 10rem;
+ background-color: green;
+ }
+ .play {
+ padding: 1rem 8rem;
+ width: 30rem;
+ height: 10rem;
+ background-color: blue;
+ font-size: 5rem;
+ }
+ .center {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: cener;;
+ margin-bottom: auto;
+ border-collapse:separate;
+ border-spacing: 0 1em;
+ }
+ .center_img {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: center;
+ margin-bottom: 10rem;
+ border-collapse:separate;
+ border-spacing: 0 1em;
+ }
+ a.button {
+ padding: 1px 6px;
+ border: 1px outset buttonborder;
+ border-radius: 3px;
+ color: buttontext;
+ background-color: buttonface;
+ text-decoration: none;
+ }
+</style>
+
+ <script type="text/javascript">
+ function launchFullScreen(element) {
+ if(element.requestFullScreen) {
+ element.requestFullScreen();
+ } else if(element.mozRequestFullScreen) {
+ element.mozRequestFullScreen();
+ } else if(element.webkitRequestFullScreen) {
+ element.webkitRequestFullScreen();
+ }
+ }
+</script>
+
+</head>
+<body>
+<%
+String orient = request.getParameter("data");
+if (orient.equals("landscape")) {
+
+
+ out.print("<table class=\"center_img\"><tr>");
+ out.print("<td><img src=\"img/SameGame.png\" alt=\"Same Game\"></td></tr>");
+ out.print("</tablae>");
+ out.print("<table class=\"center\"><tr>");
+ //out.print("td><button class=\"about\" type=\"button\" onclick=\"location.href='about.jsp?data=landscape'\">O MNIE...</button><td>");
+ out.print("<td><button class=\"play\" type=\"button\" onclick=\"location.href='display.jsp?data=landscape'\">GRAJ</button><td>");
+ // przykłąd
+ // out.print("<td><a href=\"display.jsp?data=landscape\" class=\"button\" onclick=\"launchFullScreen(document.documentElement)\">Play</a></td>");
+ out.print("</tr></table>");
+
+}
+else if (orient.equals("portrait")) {
+ out.print("<table class=\"center_img\"><tr>");
+ out.print("<td><img src=\"img/SameGame.png\" alt=\"Same Game\"></td></tr>");
+ out.print("</tablae>");
+ out.print("<table class=\"center\"><tr>");
+ //out.print("<td><button class=\"about\" type=\"button\" onclick=\"location.href='about.jsp?data=portrait'\">O MNIE...</button><td></tr>");
+ out.print("<td><button class=\"play\" type=\"button\" onclick=\"location.href='display.jsp?data=portrait'\">GRAJ</button><td>");
+ // przykłąd
+ // out.print("<td><a href=\"display.jsp?data=portraid\" class=\"button\" onclick=\"launchFullScreen(document.documentElement)\"O mnie...</a></td>");
+ out.print("</tr></table>");
+}
+%>
+
+
+</body>
+</html> \ No newline at end of file