From 11818054364b6248be8ff092d2914598f1081dc5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Date: Thu, 18 Apr 2024 18:46:24 +0200 Subject: Init --- web/samegame/.hg/00changelog.i | Bin 0 -> 57 bytes web/samegame/.hg/branch | 1 + web/samegame/.hg/cache/branch2-base | 1 + web/samegame/.hg/cache/branch2-immutable | 1 + web/samegame/.hg/cache/branch2-served | 2 + web/samegame/.hg/cache/branch2-served.hidden | 2 + web/samegame/.hg/cache/branch2-visible | 1 + web/samegame/.hg/cache/branch2-visible-hidden | 1 + web/samegame/.hg/cache/rbc-names-v1 | 1 + web/samegame/.hg/cache/rbc-revs-v1 | Bin 0 -> 8 bytes web/samegame/.hg/dirstate | Bin 0 -> 450 bytes web/samegame/.hg/hgrc | 14 + web/samegame/.hg/last-message.txt | 1 + web/samegame/.hg/requires | 1 + web/samegame/.hg/store/00changelog.i | Bin 0 -> 296 bytes web/samegame/.hg/store/00manifest.i | Bin 0 -> 422 bytes web/samegame/.hg/store/data/_changelog.txt.i | Bin 0 -> 672 bytes .../webapp/_m_e_t_a-_i_n_f/_m_a_n_i_f_e_s_t._m_f.i | Bin 0 -> 104 bytes .../data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i | Bin 0 -> 336 bytes .../.hg/store/data/src/main/webapp/display.jsp.i | Bin 0 -> 2871 bytes .../data/src/main/webapp/display__desktop.css.i | Bin 0 -> 265 bytes .../data/src/main/webapp/display__mobile.css.i | Bin 0 -> 265 bytes .../data/src/main/webapp/img/_same_game.png.d | Bin 0 -> 143617 bytes .../data/src/main/webapp/img/_same_game.png.i | Bin 0 -> 64 bytes .../.hg/store/data/src/main/webapp/index.jsp.i | Bin 0 -> 409 bytes .../.hg/store/data/src/main/webapp/menu.jsp.i | Bin 0 -> 1137 bytes web/samegame/.hg/store/fncache | 10 + web/samegame/.hg/store/phaseroots | 0 web/samegame/.hg/store/requires | 7 + web/samegame/.hg/store/undo | 0 web/samegame/.hg/store/undo.backup.phaseroots.bck | 1 + web/samegame/.hg/store/undo.backupfiles | Bin 0 -> 43 bytes web/samegame/.hg/undo.desc | 3 + web/samegame/.hg/wcache/checkisexec | 0 web/samegame/.hg/wcache/checklink | 1 + web/samegame/.hg/wcache/checklink-target | 0 web/samegame/.hg/wcache/manifestfulltextcache | Bin 0 -> 659 bytes web/samegame/Changelog.txt | 15 + web/samegame/src/main/webapp/META-INF/MANIFEST.MF | 3 + web/samegame/src/main/webapp/WEB-INF/web.xml | 12 + web/samegame/src/main/webapp/display.jsp | 429 +++++++++++++++++++++ web/samegame/src/main/webapp/display_desktop.css | 53 +++ web/samegame/src/main/webapp/display_mobile.css | 53 +++ web/samegame/src/main/webapp/img/SameGame.png | Bin 0 -> 143872 bytes web/samegame/src/main/webapp/index.jsp | 20 + web/samegame/src/main/webapp/menu.jsp | 103 +++++ 46 files changed, 736 insertions(+) create mode 100644 web/samegame/.hg/00changelog.i create mode 100644 web/samegame/.hg/branch create mode 100644 web/samegame/.hg/cache/branch2-base create mode 100644 web/samegame/.hg/cache/branch2-immutable create mode 100644 web/samegame/.hg/cache/branch2-served create mode 100644 web/samegame/.hg/cache/branch2-served.hidden create mode 100644 web/samegame/.hg/cache/branch2-visible create mode 100644 web/samegame/.hg/cache/branch2-visible-hidden create mode 100644 web/samegame/.hg/cache/rbc-names-v1 create mode 100644 web/samegame/.hg/cache/rbc-revs-v1 create mode 100644 web/samegame/.hg/dirstate create mode 100644 web/samegame/.hg/hgrc create mode 100644 web/samegame/.hg/last-message.txt create mode 100644 web/samegame/.hg/requires create mode 100644 web/samegame/.hg/store/00changelog.i create mode 100644 web/samegame/.hg/store/00manifest.i create mode 100644 web/samegame/.hg/store/data/_changelog.txt.i create mode 100644 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 create mode 100644 web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/display.jsp.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.d create mode 100644 web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/index.jsp.i create mode 100644 web/samegame/.hg/store/data/src/main/webapp/menu.jsp.i create mode 100644 web/samegame/.hg/store/fncache create mode 100644 web/samegame/.hg/store/phaseroots create mode 100644 web/samegame/.hg/store/requires create mode 100644 web/samegame/.hg/store/undo create mode 100644 web/samegame/.hg/store/undo.backup.phaseroots.bck create mode 100644 web/samegame/.hg/store/undo.backupfiles create mode 100644 web/samegame/.hg/undo.desc create mode 100755 web/samegame/.hg/wcache/checkisexec create mode 120000 web/samegame/.hg/wcache/checklink create mode 100644 web/samegame/.hg/wcache/checklink-target create mode 100644 web/samegame/.hg/wcache/manifestfulltextcache create mode 100644 web/samegame/Changelog.txt create mode 100644 web/samegame/src/main/webapp/META-INF/MANIFEST.MF create mode 100644 web/samegame/src/main/webapp/WEB-INF/web.xml create mode 100644 web/samegame/src/main/webapp/display.jsp create mode 100644 web/samegame/src/main/webapp/display_desktop.css create mode 100644 web/samegame/src/main/webapp/display_mobile.css create mode 100644 web/samegame/src/main/webapp/img/SameGame.png create mode 100644 web/samegame/src/main/webapp/index.jsp create mode 100644 web/samegame/src/main/webapp/menu.jsp (limited to 'web') diff --git a/web/samegame/.hg/00changelog.i b/web/samegame/.hg/00changelog.i new file mode 100644 index 0000000..22e0643 Binary files /dev/null and b/web/samegame/.hg/00changelog.i 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 Binary files /dev/null and b/web/samegame/.hg/cache/rbc-revs-v1 differ diff --git a/web/samegame/.hg/dirstate b/web/samegame/.hg/dirstate new file mode 100644 index 0000000..49209d0 Binary files /dev/null and b/web/samegame/.hg/dirstate 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 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 Binary files /dev/null and b/web/samegame/.hg/store/00changelog.i differ diff --git a/web/samegame/.hg/store/00manifest.i b/web/samegame/.hg/store/00manifest.i new file mode 100644 index 0000000..447434d Binary files /dev/null and b/web/samegame/.hg/store/00manifest.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/_changelog.txt.i 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 Binary files /dev/null and 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 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/_w_e_b-_i_n_f/web.xml.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/display.jsp.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/display__desktop.css.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/display__mobile.css.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.d 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/img/_same_game.png.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/index.jsp.i 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 Binary files /dev/null and b/web/samegame/.hg/store/data/src/main/webapp/menu.jsp.i 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 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 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 Binary files /dev/null and b/web/samegame/.hg/store/undo.backupfiles 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 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 diff --git a/web/samegame/.hg/wcache/manifestfulltextcache b/web/samegame/.hg/wcache/manifestfulltextcache new file mode 100644 index 0000000..731f57f Binary files /dev/null and b/web/samegame/.hg/wcache/manifestfulltextcache 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 @@ + + + samegame + + index.html + index.jsp + index.htm + default.html + default.jsp + default.htm + + \ 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 @@ + +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" + import="java.util.*" import="java.lang.*"%> + <% + out.print("Same Game (BETA)"); +%> +<%! +class Box { + int index; + int groupIndex; + String color; + int x , y; + boolean visit; + public List groupList = new ArrayList (); + 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 tmp = new ArrayList (); + + 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 intelligence = new ArrayList (); + + +%> +<% +String userAgent = request.getHeader("User-Agent"); +boolean isMobile = (userAgent != null && !userAgent.isEmpty() && userAgent.toLowerCase().contains("android")); + +if (isMobile) { + out.print(""); + +} +else { + out.print(""); +} + + +%> + + + + + + + + +<% + +String orient = request.getParameter("data"); +Box[][] squares; + + //orient = "portrait"; + //while (true) { + int x = 0; + int y = 0; + List tmp = new ArrayList (); + 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(""); + + out.print(""); + k = 0; + for (int i = 0; i < orientY; i++) { + out.print(""); + + + for (int j = 0; j < orientX; j++, k++) { + List ids = new ArrayList (); + + //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(""); + //out.print(""); + out.print(""); + + //++k; + + + + } + out.print(""); + out.print(">"+intelligence.toString()+"<"); + + } + + + + out.print("
"+squares[i][j].getColor()+""+squares[i][j].groupList.toString()+""+orient+squares[i][j].groupList.toString()+"
"); + + out.print("\n"); + +%> \ 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 Binary files /dev/null and b/web/samegame/src/main/webapp/img/SameGame.png 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 + + + + + \ 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 @@ + +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + +Same Game + + + + + + + +<% +String orient = request.getParameter("data"); +if (orient.equals("landscape")) { + + + out.print(""); + out.print(""); + out.print(""); + out.print("
\"Same
"); + //out.print("td>"); + out.print("
"); + out.print(""); + // przykłąd + // out.print("Play
"); + +} +else if (orient.equals("portrait")) { + out.print(""); + out.print(""); + out.print(""); + out.print("
\"Same
"); + //out.print(""); + out.print(""); + out.print("
"); + // przykłąd + // out.print("
"); +} +%> + + + + \ No newline at end of file -- cgit v1.2.3