264 Commits

Author SHA1 Message Date
lieght
b39659d02d Back to 10ms 2026-01-22 00:00:57 +01:00
lieght
c107e8c0d1 Correct time data visualization effect on timetable lookup for data collection purposes 2026-01-21 23:52:29 +01:00
lieght
8a94aad622 Infinite game collection 2026-01-21 23:46:59 +01:00
lieght
992523b936 Better data collection for overnight run 2026-01-21 23:43:11 +01:00
ramollia
5d2fff7ae7 changed the way multithreading worked 2026-01-21 20:05:19 +01:00
ramollia
f168b974ab Merge remote-tracking branch 'origin/Development' into Development 2026-01-21 15:42:08 +01:00
ramollia
057487e4f9 readded the exploration constant 2026-01-21 15:40:38 +01:00
michiel
fb32bc6f8e saving games data to games.csv 2026-01-20 13:41:10 +01:00
ramollia
4c8bd89a35 fixed things 2026-01-20 13:18:29 +01:00
ramollia
f7b24edf1e implement solved 2026-01-20 13:15:48 +01:00
michiel
e5ea838430 New CSV structure thats cleaner, the code in AITest is also cleaner 2026-01-19 13:05:17 +01:00
michiel
989e0a65c6 added visual score to reversi 2026-01-19 09:47:41 +01:00
Ticho Hidding
7565757b6b Research Experiment Data generator 2026-01-19 01:40:50 +01:00
Bas Antonius de Jong
a6b2356a5e update mcts, incremental merge (#311)
* mcts v1, v2, v3, v4 done. v5 wip

* update mcts

* mcts v1, v2, v3, v4 done. v5 wip

* update mcts

* Merge changes on dev

* update mcts

---------

Co-authored-by: ramollia <>
2026-01-17 04:05:11 +01:00
Bas Antonius de Jong
d078a70950 289 server (#308) Incremental server update, with working tournament and player input timeout
* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

---------

Co-authored-by: ramollia <>
Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes

* Working tournament

* GlobalEventBus is now async instead

* Shuffle now changeable, host can now switch tournament gametype

* Tournament results are now send back to the clients connected to the server

* Tournament now returns result to clients

* Refactored tournament to use interfaces and builders

* Removed unnecessary imports

* Tournament refactor for better naming and easier to understand code

* Starting a tournament now requires to be admin

* Request admin list

* Added admins to games

* Tournament is now without admins

* Added result comeback with a draw

* Async tournament runner

* Added back ability to shuffle matchmaker

* Moved scoring calculation into scoring system

* Tournament now uses propper builder pattern

* Null handling

* Removed input mistake, removed print

* Refactored Tournament to use matchExecutor and ResultBroadcaster. Added turnTime and players are now added through Tournament creation instead of on MatchMaker/ScoreSystem creation

* Added shuffle to builder

* Removed unnecessary throw

* More adaptable scoring system

* Moved async runner to virtual thread

* Timeout added

* AI player given time change

---------

Co-authored-by: Stef <stbuwalda@gmail.com>
Co-authored-by: Stef <48526421+StefBuwalda@users.noreply.github.com>
2026-01-16 13:06:09 +01:00
Ticho Hidding
94e3fc71b8 legal move highlight and onhover effect added back 2026-01-12 13:41:59 +01:00
Ticho Hidding
9fcbe7d298 Turn information 2026-01-12 12:56:37 +01:00
Bas de Jong
35f7a4fd13 Revert "Merge remote-tracking branch 'refs/remotes/origin/main' into Development"
This reverts commit e2132b549d, reversing
changes made to 9aefcb9b7b.
2026-01-09 19:27:47 +01:00
Bas de Jong
e2132b549d Merge remote-tracking branch 'refs/remotes/origin/main' into Development
# Conflicts:
#	app/src/main/java/org/toop/Main.java
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/Server.java
#	app/src/main/java/org/toop/app/canvas/BitGameCanvas.java
#	app/src/main/java/org/toop/app/canvas/GameCanvas.java
#	app/src/main/java/org/toop/app/canvas/ReversiBitCanvas.java
#	app/src/main/java/org/toop/app/canvas/TicTacToeBitCanvas.java
#	app/src/main/java/org/toop/app/gameControllers/GenericGameController.java
#	app/src/main/java/org/toop/app/gameControllers/ReversiBitController.java
#	app/src/main/java/org/toop/app/gameControllers/TicTacToeBitController.java
#	app/src/main/java/org/toop/app/widget/Primitive.java
#	app/src/main/java/org/toop/app/widget/complex/ConfirmWidget.java
#	app/src/main/java/org/toop/app/widget/complex/PlayerInfoWidget.java
#	app/src/main/java/org/toop/app/widget/complex/ViewWidget.java
#	app/src/main/java/org/toop/app/widget/popup/ChallengePopup.java
#	app/src/main/java/org/toop/app/widget/popup/EscapePopup.java
#	app/src/main/java/org/toop/app/widget/popup/SendChallengePopup.java
#	app/src/main/java/org/toop/app/widget/tutorial/BaseTutorialWidget.java
#	app/src/main/java/org/toop/app/widget/tutorial/ShowEnableTutorialWidget.java
#	app/src/main/java/org/toop/app/widget/view/GameView.java
#	app/src/main/java/org/toop/app/widget/view/LocalMultiplayerView.java
#	app/src/main/java/org/toop/app/widget/view/LocalView.java
#	app/src/main/java/org/toop/app/widget/view/MainView.java
#	app/src/main/java/org/toop/app/widget/view/OnlineView.java
#	app/src/main/java/org/toop/app/widget/view/ServerView.java
#	framework/pom.xml
#	framework/src/main/java/org/toop/framework/gameFramework/GameState.java
#	framework/src/main/java/org/toop/framework/gameFramework/controller/GameController.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/game/TurnBasedGame.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/game/threadBehaviour/AbstractThreadBehaviour.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/game/threadBehaviour/ThreadBehaviour.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/player/AI.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/player/AbstractAI.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/player/AbstractPlayer.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/player/Player.java
#	framework/src/main/java/org/toop/framework/networking/NetworkingClient.java
#	framework/src/main/java/org/toop/framework/networking/NetworkingClientManager.java
#	framework/src/main/java/org/toop/framework/networking/NetworkingGameClientHandler.java
#	framework/src/main/java/org/toop/framework/networking/NetworkingInitializationException.java
#	framework/src/main/java/org/toop/framework/networking/clients/TournamentNetworkingClient.java
#	framework/src/main/java/org/toop/framework/networking/connection/clients/TournamentNetworkingClient.java
#	framework/src/main/java/org/toop/framework/networking/connection/exceptions/NetworkingInitializationException.java
#	framework/src/main/java/org/toop/framework/networking/connection/handlers/NetworkingGameClientHandler.java
#	framework/src/main/java/org/toop/framework/networking/events/NetworkEvents.java
#	framework/src/main/java/org/toop/framework/networking/exceptions/NetworkingInitializationException.java
#	framework/src/main/java/org/toop/framework/networking/handlers/NetworkingGameClientHandler.java
#	framework/src/test/java/org/toop/framework/networking/NetworkingClientManagerTest.java
#	framework/src/test/java/org/toop/framework/networking/events/NetworkEventsTest.java
2026-01-09 19:22:14 +01:00
Bas Antonius de Jong
9aefcb9b7b 289 server demo ready (#306)
* Server update with new dev changes (#305)

* merge widgets with development

* readd previous game thread code

* Revert "readd previous game thread code"

This reverts commit d24feef73e.

* Revert "Merge remote-tracking branch 'origin/Development' into Development"

This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.

* Revert "merge widgets with development"

This reverts commit 38681c5db0.

* Merge 292 into development (#293)

Applied template method pattern to abstract player

* Added documentation to player classes and improved method names (#295)

* mcts v1

* bitboard optimization

* bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon

* main

* Hotfix for stuff

* Logging and fixed user input getting stuck

* Fixed merge mistakes
2026-01-07 23:47:38 +01:00
58a9ce78fe Merge remote-tracking branch 'origin/289-server' into Development
# Conflicts:
#	app/src/main/java/org/toop/app/Server.java
#	app/src/main/java/org/toop/app/gameControllers/GenericGameController.java
#	app/src/main/java/org/toop/app/widget/view/LocalMultiplayerView.java
#	framework/src/main/java/org/toop/framework/game/BitboardGame.java
#	framework/src/main/java/org/toop/framework/game/players/ArtificialPlayer.java
#	framework/src/main/java/org/toop/framework/game/players/LocalPlayer.java
#	framework/src/main/java/org/toop/framework/game/players/OnlinePlayer.java
#	framework/src/main/java/org/toop/framework/game/players/ai/MiniMaxAI.java
#	framework/src/main/java/org/toop/framework/game/players/ai/RandomAI.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/game/TurnBasedGame.java
#	framework/src/main/java/org/toop/framework/gameFramework/model/player/AbstractPlayer.java
#	game/src/main/java/org/toop/game/players/MiniMaxAI.java
#	game/src/main/java/org/toop/game/players/RandomAI.java
#	game/src/main/java/org/toop/game/players/ai/MiniMaxAI.java
#	game/src/main/java/org/toop/game/players/ai/RandomAI.java
2026-01-07 16:13:53 +01:00
230f7480e4 Merge remote-tracking branch 'origin/289-server' into 289-server 2026-01-07 15:41:28 +01:00
ramollia
6aa0eb952a main 2026-01-07 14:44:45 +01:00
ramollia
df93b44d19 bitboard fix & mcts v2 & mcts v3. v3 still in progress and v4 coming soon 2026-01-07 14:39:38 +01:00
Bas de Jong
67f39c3f3b Code readability 2026-01-07 14:38:19 +01:00
6e6a383708 Collapsed interfaces in View section 2026-01-07 13:26:43 +01:00
b7dec7798b Collapsed interfaces in Controller section 2026-01-07 13:13:32 +01:00
2caa4fc79f Fixed runtime error I forgot to fix. 2026-01-07 12:42:54 +01:00
e72d888d84 Collapsed interfaces from model portion 2026-01-07 12:41:25 +01:00
ramollia
e149588b60 bitboard optimization 2025-12-15 10:31:22 +01:00
Bas de Jong
a7d1a964c2 Moved subscriptions to store 2025-12-15 10:01:23 +01:00
ramollia
380e219c08 mcts v1 2025-12-15 09:06:56 +01:00
lieght
dccf428bb8 TableWidget 2025-12-14 17:18:57 +01:00
ramollia
4ad922423c Merge remote-tracking branch 'origin/Development' into Development 2025-12-14 17:05:17 +01:00
lieght
6e2ea82a32 UI fixes after game end 2025-12-14 13:30:21 +01:00
lieght
34c85ec472 Removed user from subscription if in a game 2025-12-14 13:11:55 +01:00
2d9b34b7f6 Quick fix so more than one game can be played in succession 2025-12-14 11:36:51 +01:00
lieght
8867d5a1ea Missed a boolean 2025-12-14 01:19:16 +01:00
lieght
b94d1b6c9d Small improvements to usability, auto disconnect when server closes connection 2025-12-14 01:13:42 +01:00
lieght
8cb0a86d4e Working subscription, button only subs to reversi right now 2025-12-13 23:20:28 +01:00
lieght
c2f1df7143 Refactor done, added ability to subscribe 2025-12-13 22:44:13 +01:00
lieght
0956286616 Partial server refactor 2025-12-13 21:11:26 +01:00
55de6b5b18 Merge remote-tracking branch 'origin/289-server' into 289-server 2025-12-13 18:53:18 +01:00
73d71f2a2d Making moves works. Game notifies when game has ended. 2025-12-13 18:53:10 +01:00
lieght
cbcce29780 Closable server 2025-12-13 18:38:31 +01:00
lieght
afcd9be71e Fixed hasArgs 2025-12-13 17:53:31 +01:00
a9145d44cf Merge remote-tracking branch 'origin/289-server' into 289-server 2025-12-13 17:50:03 +01:00
c015100ebf Werkt nog niet 2025-12-13 17:49:54 +01:00
lieght
cd5736afc8 Removed space in naming 2025-12-13 17:38:36 +01:00
lieght
89a9cb1e55 Using pairs now in server.java 2025-12-13 17:37:34 +01:00
lieght
22270e58dc Added pairs 2025-12-13 17:33:14 +01:00
lieght
edd2c24b65 Added ability to take ServerPlayer from user 2025-12-13 17:22:56 +01:00
c929abc4b8 Removed Generics, pray nothing breaks. 2025-12-13 17:08:34 +01:00
lieght
8b85915c74 Fixes 2025-12-13 17:08:10 +01:00
lieght
150fb2986f Fixed tic tac toe naming 2025-12-13 15:17:16 +01:00
lieght
9c20fcbc39 Fixed bugs, easy to use host button 2025-12-13 15:01:28 +01:00
lieght
4d31a8ed44 Working challenges 2025-12-12 21:48:57 +01:00
lieght
fc47d81b8e Init challenges 2025-12-12 19:47:51 +01:00
lieght
a60c702306 Tests and better instantiation 2025-12-12 16:47:17 +01:00
lieght
c30c118c04 Code cleanup 2025-12-12 16:04:12 +01:00
4b8edf1585 Merge remote-tracking branch 'origin/289-server' into 289-server
# Conflicts:
#	app/src/main/java/org/toop/app/canvas/ReversiBitCanvas.java
#	app/src/main/java/org/toop/app/canvas/TicTacToeBitCanvas.java
#	framework/src/main/java/org/toop/framework/game/games/reversi/BitboardReversi.java
#	framework/src/main/java/org/toop/framework/game/games/tictactoe/BitboardTicTacToe.java
2025-12-12 15:53:45 +01:00
fa9c2ce32b Removed Generics, pray nothing breaks. 2025-12-12 15:53:24 +01:00
Bas de Jong
2599f9fa40 Testing code 2025-12-12 15:17:29 +01:00
Bas de Jong
84e411fa38 Moves 2025-12-12 15:17:12 +01:00
Bas de Jong
66cb000fad Init server code 2025-12-12 15:15:55 +01:00
Stef
1ae79daef0 Added documentation to player classes and improved method names (#295) 2025-12-10 13:17:01 +01:00
Stef
cd8eb99559 Merge 292 into development (#293)
Applied template method pattern to abstract player
2025-12-10 12:39:40 +01:00
Bas Antonius de Jong
0132981d94 Merge branch 'main' into Development 2025-12-09 21:20:08 +01:00
Bas de Jong
322197494c Will fix tests etc later 2025-12-09 21:19:30 +01:00
Bas de Jong
a9c99df5d2 Better limits to generic acceptance 2025-12-09 21:07:30 +01:00
ramollia
d702f82194 Merge remote-tracking branch 'origin/Development' into Development
# Conflicts:
#	game/src/main/java/org/toop/game/reversi/ReversiAI.java
2025-12-09 12:54:12 +01:00
Stef
912d25c01f Merge bitboards into development (#285)
* added new classes for the games that use bitboards instead. also combined game with turnbasedgame

* (DOES NOT COMPILE) In-between commit

* turn updates

* smalle fixes aan turn updates

* Bitboard implemented with scuffed TicTacToe translation done by game. This should be done by the view.

* Almost done with implementing bitboards. Reversi is broken and artifical players don't work yet.

* better human/ai selector with bot selection and depth on TicTacToeAIR

* fixed getLegalMoves

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* fixed? getLegalMoves

* Everything is broken

* Removed todo

* fixed getLegalMoves & getFlips

* Challenge popups "Fixed"

* Fixed local and online play for both games

* Popups now remove themselves

* Removed souts for debugging

* localize the ChallengePopup text

* made the game text a header instead

* made more classes deepClonable.

* fixed getAllWidgets

* Added comment

* Escape popup

* fixed redundant container

* Made all network events async again

* Escape remove popup

* Working escape menu

* Removed old AI and old files. Added a new generic random AI. game no longer deals with translation.

* Drawing of board on canvas is now done from bitboards rather than translating.

* Added a method getWinner() to game interface.Controller now tells gameThreads how to deal with drawing UI and sending a move to server.

* Added find functionality

* Added a ChatGPT generated MiniMaxAI based on the old MiniMaxAI but with alpha-beta pruning and heuristics for Reversi

* Removed System-Outs to clean up console

* Update BitGameCanvas.java

* Merge fixes

* Removed unused imports

---------

Co-authored-by: ramollia <>
Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: lieght <49651652+BAFGdeJong@users.noreply.github.com>
2025-12-08 18:23:06 +01:00
Ticho Hidding
adc7b1a8f3 fixed reversi colors being switched, causing multiple issues 2025-12-08 17:14:31 +01:00
Ticho Hidding
3a8b1c2454 shitty fix for player selector spacing issue v2 2025-12-08 16:12:42 +01:00
Ticho Hidding
846898988f shitty fix for player selector spacing issue 2025-12-08 15:59:11 +01:00
Ticho Hidding
ecd0fd26be changed "fullscreen exit key combination" from esc to F11 2025-12-08 15:11:17 +01:00
lieght
a838973e67 Code cleanup 2025-12-07 20:43:56 +01:00
lieght
a4f2a67d9c Deleted unnecessary imports 2025-12-07 20:39:29 +01:00
lieght
12bccb8854 Safety 2025-12-07 20:33:27 +01:00
lieght
80d3e47ad9 initSystems now uses latch instead of timer. Moved single threads to Executor 2025-12-07 18:59:19 +01:00
Bas Antonius de Jong
38f50cc16d Event bus now testable, improved UI (#284)
* turn updates

* smalle fixes aan turn updates

* better human/ai selector with bot selection and depth on TicTacToeAIR

* depth + thinktime back to AIs, along with a a specific TicTacToeAIRSleep

* fixed overlapping back and disconnect buttons

* Changed to debug instead of info

* changed the transitionNextCustom to be easier to use

* added getAllWidgets to WidgetContainer

* Correct back view

* added replacePrevious in ViewWidget

* added removeIndexFromPreviousChain

* fixed incorrect index counting

* Fixt wrong view order

* Removed todo

* Challenge popups "Fixed"

* Popups now remove themselves

* localize the ChallengePopup text

* made the game text a header instead

* fixed getAllWidgets

* Escape popup

* fixed redundant container

* Escape remove popup

* Working escape menu

* Added find functionality

* Tutorials moved to escape menu

* Escape can't be opened in mainview now

* Can now test the event bus, created testable interfaces

* Logging errors

* Made events and handlers more generic

* Suppress

* Managers now have changeable eventbus

* Tutorials fixed

* Removed import

* Single threaded eventbus

* Fixed wrong eventbus

* Removed get

* Removed old code

* Renaming

* Optimization

* Removed useless comment

* Removed unnecessary imports

* Rename

* Renaming, refactor and type safety

* Rename

* Removed import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
2025-12-07 17:38:34 +01:00
lieght
f60df73b66 Loading circle, better loading colors. 2025-12-03 23:55:12 +01:00
8ca2399e6a Merge branch 'Development' of https://github.com/2OOP/pism into Development 2025-12-03 21:51:14 +01:00
8c75ac1471 Making threads verbose regarding exceptions 2025-12-03 21:51:01 +01:00
lieght
f866eab8ba Best fix for white screen at start 2025-12-03 21:50:32 +01:00
Stef
8d77f51355 272 remake game framework interfaces to properly represent vmc (#278)
* Cleaned up a lot of old files and renamed/remade interfaces to better suit the framework

* Broken commit

* Fixed online play

* Better file structure and closer to MVC
2025-12-03 20:35:37 +01:00
lieght
040287ad70 Added infinite boolean, fixed loading behaviour at startup 2025-12-03 18:56:08 +01:00
lieght
740d2cf3db Fixed systems starting, before assets being loaded (I am retarded) 2025-12-03 18:13:57 +01:00
Bas Antonius de Jong
628e4f30b5 Main menu loader (#277)
* LoadingWidget main menu

* fixed garbage code

* Fixed garbage code 2

* LoadWidget fix, added loading to starting the game. Removed unnecessary console output

---------

Co-authored-by: ramollia <>
2025-12-03 14:49:59 +01:00
ramollia
f4678edf2f Merge remote-tracking branch 'origin/Development' into Development 2025-12-03 12:49:14 +01:00
Bas de Jong
bc84171029 Double loading call fix, LoadingWidget docs 2025-12-03 11:39:25 +01:00
Bas Antonius de Jong
3c9b010dd3 231 connecting to server feedback (#275)
* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Imports

* fixed loadingwidget

* Workable LoadingWidget and trying to connect to server

* Removed output

* Small bug temp fix

---------

Co-authored-by: ramollia <>
2025-12-02 20:59:46 +01:00
michiel
4dbc4997a0 added back button sounds because SOMEONE fucked it up..... 2025-12-02 11:51:00 +01:00
ramollia
9a0bfc4fce Merge remote-tracking branch 'origin/Development' into Development 2025-12-02 11:25:42 +01:00
Stef
9f55f8e1c7 Merge new framework into development (#269)
* Created a somewhat generic TurnBasedGame thread. Temporary UI that only works for TicTacToe rn. Added a LocalPlayer with the intent to add more players

* (RANDOM COMMIT) Hope it works

* Changes by bas

* Fixed dependency issues

* Fixed major issue in game deepcopy

* Merge conflict fix

* Removed unused import

* Update GTBGT branch from dev branch (#263)

* started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do.

* rest van de tutorials toegevoegd

* Removed views

* Merge conflict fix

* Removed unused import

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: ramollia <>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>

* Revert "Update GTBGT branch from dev branch (#263)"

This reverts commit 9134d7e343.

* Fixed frontend not using GameController because of spaghetti code.

* Removed unused imports

* GameCanvas not implements a DrawPlayerMove that can be overridden for specific implementations

* Created an event that will request the controller to refresh the UI.

* ADDED DEPENDENCY. Renamed GameControllers to GameManagers, gameThread is not game controller.

* Attempt at adding an online player. I think it doesn't work because of unsubscriben after success not working

* Multiplayer is functional through OnlineThreadBehaviour. Empty slots are currently represented by -1 in the GUI.

* Removed sout spam, added logger than I can't get to work.

* Idek what these changes are

* Te lang geen commit, sorry

* Multiplayer seems to work pretty well now, hopefully I can add the other games soon.

* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Inbetween commit of adding Reversi. This is a lot of spaghetti.

* Fixed stress tests

* Fixed typo in NetworkingGameClientHandler that prevented losses from being received

* Missed 2nd typo. Fixed

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Works now with updated EventFlow(). Unsubscribing works. ReversiAIR has an issue where a forced move returns -1 and local play back button doesn't work properly. To be fixed

* Fixed ReversiR issue that caused skip turn desync

* Fixed color mismatch with server and online main player is now correct.

* Added a bunch of java doc and small changes

* Small changes

* Added a new Thread Behaviour to test framework.

* Fixed human error I made in TicTacToeR logic...

* Fixed broken event and wrong player being presented as winner.

* Idk changes

* Fixed PR conflicts

---------

Co-authored-by: michiel301b <m.brands.3@st.hanze.nl>
Co-authored-by: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com>
2025-12-02 11:25:22 +01:00
ramollia
0b750d5c0d Merge remote-tracking branch 'origin/Development' into Development
# Conflicts:
#	app/src/main/java/org/toop/app/view/views/GameView.java
2025-12-02 11:24:42 +01:00
Bas Antonius de Jong
d9437c1b8a Tutorials to Dev (#264)
* Fixed garbage code

* added a pop button

* Tutorial images now use ImageAsset.java

* Added button to continue and start game. Refactors

* Refactored nextScreen runnable

* Removed unused imports

* Refactored switch statement

* Added documentation

* Removed space

* Added translations

* Added function input for enabling/disabling localization p/text

---------

Co-authored-by: ramollia <>
2025-12-02 10:57:46 +01:00
c332033a06 Fixed old new EventFlow().listen() missing false as third param 2025-11-30 18:03:16 +01:00
lieght
3953762178 Removed loading widget from Server.java 2025-11-30 17:55:52 +01:00
Bas Antonius de Jong
12a20a224e Fix music display not working (#267)
* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import

* Added LoadingWidget.java for server feedback

* Replace deprecated with correct function
2025-11-30 17:51:52 +01:00
Bas Antonius de Jong
81740acd04 Debugs for EventBus and fixed unsubscribe all (#266)
* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function

* Added debugging to GlobalEventBus

* Fixed cleaning flow

* Fixed unsubscribe all

* Fixed unsubscribe all

* Removed unused import
2025-11-30 17:15:14 +01:00
Bas Antonius de Jong
25c02c7ad0 Fix eventbus problems (#265)
* Added unsubscribe to EventFlow. ListenerHandler now functional. GlobalEventbus now user listenerHandler

* getAllListeners

* Removed nulls

* Fixed stress tests

* Added docs, no more list creation when adding events to the bus.

* Fixed unsubscribe not working.

* Moved away from deprecated functions

* moved from wildcard to typed

* Moved away from deprecated function
2025-11-30 14:22:05 +01:00
lieght
ec0ce4ea37 Added function input for enabling/disabling localization p/text 2025-11-29 12:23:17 +01:00
lieght
0ab071693f Removed views 2025-11-28 12:09:40 +01:00
Bas Antonius de Jong
1a11827ba3 Merge pull request #261 from 2OOP/Tutorials
merge tutorials to dev branch
2025-11-28 11:56:42 +01:00
ramollia
a2d651cd7d Merge remote-tracking branch 'refs/remotes/origin/Development' into Tutorials
# Conflicts:
#	app/src/main/java/org/toop/app/game/Connect4Game.java
2025-11-28 11:51:46 +01:00
ramollia
07f3319675 Merge remote-tracking branch 'origin/Development' into Development 2025-11-27 18:50:12 +01:00
0cb025edb9 Changed the way turns are being stored in TurnBasedGame. 2025-11-27 18:37:34 +01:00
6ea94fe658 Fixed compilation errors 2025-11-27 17:42:39 +01:00
ramollia
1dfa6a7c6e Merge remote-tracking branch 'origin/Development' into Development
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/canvas/ReversiCanvas.java
#	app/src/main/java/org/toop/app/game/ReversiGame.java
#	app/src/main/java/org/toop/app/game/TicTacToeGame.java
#	app/src/main/java/org/toop/app/view/displays/SongDisplay.java
#	app/src/main/java/org/toop/local/AppContext.java
2025-11-27 17:28:12 +01:00
tichohidding
ef5c1ce6e3 Merge pull request #241 from 2OOP/Widgets
Widgets into development
2025-11-27 17:19:30 +01:00
tichohidding
8c01c7fa7a Merge branch 'Development' into Widgets 2025-11-27 17:19:17 +01:00
144de5100e Revert "merge widgets with development"
This reverts commit 38681c5db0.
2025-11-27 16:58:54 +01:00
40ddf08e2d Revert "Merge remote-tracking branch 'origin/Development' into Development"
This reverts commit 59d46cb73c, reversing
changes made to 38681c5db0.
2025-11-27 16:58:51 +01:00
2936cc0b72 Revert "readd previous game thread code"
This reverts commit d24feef73e.
2025-11-27 16:58:47 +01:00
ramollia
d24feef73e readd previous game thread code 2025-11-27 16:53:58 +01:00
ramollia
59d46cb73c Merge remote-tracking branch 'origin/Development' into Development
# Conflicts:
#	app/src/main/java/org/toop/app/game/ReversiGame.java
#	app/src/main/java/org/toop/app/view/views/GameView.java
2025-11-27 15:58:22 +01:00
ramollia
38681c5db0 merge widgets with development 2025-11-27 15:57:46 +01:00
Ticho Hidding
72dd78137b Merge remote-tracking branch 'origin/Development' into Development 2025-11-27 15:50:36 +01:00
71c918e9ee Squashed commit of the following:
commit a517f2f302baa89f8ef59946a31c7bb59c56770f
Author: Stef <stbuwalda@gmail.com>
Date:   Thu Nov 27 15:43:43 2025 +0100

    Make it so the game shows "Waiting on ... to make their move". Styling isn't done but it is easier to see who's turn it is. There is a lot of structuring to do in the previous code...
2025-11-27 15:45:31 +01:00
Ticho Hidding
81f4d307a2 fixed turn skip bug
fixed end score bug
now only shows legal and highlight moves when human
2025-11-27 15:41:09 +01:00
ramollia
cbe01fbca5 Merge branch 'Widgets' into Development
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/canvas/ReversiCanvas.java
#	app/src/main/java/org/toop/app/game/ReversiGame.java
#	app/src/main/java/org/toop/app/game/TicTacToeGame.java
#	app/src/main/java/org/toop/app/view/displays/SongDisplay.java
#	app/src/main/java/org/toop/local/AppContext.java
2025-11-27 14:44:00 +01:00
Ticho Hidding
710438ec1b resizable true 2025-11-27 14:07:39 +01:00
michiel
c14b66e892 rest van de tutorials toegevoegd 2025-11-27 11:42:38 +01:00
michiel301b
8c69453506 started a basis for the tutorials, tic tac toe is almost done with some general stuff still to do. 2025-11-26 22:03:06 +01:00
Bas de Jong
a6b835bddf Removed no more needed comments 2025-11-20 11:41:44 +01:00
Bas de Jong
ca11151381 Functional code, is now object orientated 2025-11-06 15:32:15 +01:00
ramollia
fa4e1ad5e3 widget system almost complete 2025-11-03 12:47:56 +01:00
Ticho Hidding
295c61c7eb added some comments and made some methods a bit more readable 2025-11-01 15:12:09 +01:00
ramollia
1c9af58264 half done with the widget system 2025-10-31 17:33:19 +01:00
6dc05e7123 Made connect4 public method private 2025-10-29 20:09:39 +01:00
d1a9f94ee0 Fixed warning "Warning:(27, 12) Copy constructor does not copy field 'mostRecentlyFlippedPieces'", removed unused field 2025-10-29 20:04:50 +01:00
edfb4ffe51 Changed checkForEarlyDraw so it doesn't need a game as input. 2025-10-29 20:03:07 +01:00
be31de4660 Reversi: made method private 2025-10-29 19:51:09 +01:00
ea30e20585 Privated methods that didn't have to be public 2025-10-29 18:05:01 +01:00
d7e370536e Applied encapsulation principle to TurnBasedBame.java 2025-10-29 17:37:21 +01:00
6811890531 Removed unused imports 2025-10-29 17:29:28 +01:00
5da0a02cc8 Refactored Game to follow encapsulation principle 2025-10-29 17:28:43 +01:00
50713c5021 Turned Abstract Method for AI into interface 2025-10-29 15:01:58 +01:00
d17edf7c4a Renamed Interface Playtable to IPlayable 2025-10-29 14:52:19 +01:00
84e257c17c Removed unused imports 2025-10-29 14:50:40 +01:00
925c848fda Moved the Move record into it's own file, seperated from Game 2025-10-29 14:49:43 +01:00
13bac113b7 Turned abstract methods into an interface 2025-10-29 14:37:31 +01:00
068337e01b Removed unused import 2025-10-29 14:27:51 +01:00
44d8ffbef2 Made the GameState enum it's own file and fixed imports 2025-10-29 14:26:41 +01:00
Ticho Hidding
ff611724e7 Merge remote-tracking branch 'origin/Development' into Development 2025-10-29 14:06:23 +01:00
Ticho Hidding
7f36d7f244 cool onhover effect for reversi 2025-10-29 14:06:05 +01:00
eda85ea888 Removed unused import and unused parameter 2025-10-29 13:51:56 +01:00
f026a4fec6 Manually fallback to the fallback locale when a ResourceBundle is missing a resource key. Fallsback to "MISSING RESOUREC" if it's not present in the fallback. 2025-10-29 13:49:50 +01:00
Bas de Jong
b84255e00e Added replace to reduce boiler plate code 2025-10-28 15:23:36 +01:00
Bas de Jong
84c17d185b Fixes for garbage code by Omar 2025-10-28 14:37:15 +01:00
michiel
3776167299 iets met timing verkeerd temporary fix 2025-10-28 14:23:53 +01:00
ramollia
48ed6df6b4 started working on the widget system 2025-10-28 12:59:15 +01:00
michiel
2428048bd5 updated music ma,es 2025-10-28 12:53:10 +01:00
michiel
1440190ac3 kleine ui fix 2025-10-28 12:30:48 +01:00
ramollia
3a51434f91 Merge remote-tracking branch 'origin/Development' into Development 2025-10-28 11:14:22 +01:00
ramollia
5b20909f80 moved score out of game 2025-10-28 11:13:56 +01:00
michiel
00b5f9dced mainview false for sendchallengeview 2025-10-28 11:10:17 +01:00
michiel
188a5e8a45 can now go to last using previous and being at the first song 2025-10-28 10:53:02 +01:00
ramollia
0638a38fc1 moved score out of game 2025-10-28 09:53:33 +01:00
ramollia
75fb865dad Merge branch 'Demo3' into Development 2025-10-28 09:16:22 +01:00
ramollia
2cda94e4db canvas changes 2025-10-28 09:13:09 +01:00
ramollia
d6f3bb2185 Merge remote-tracking branch 'origin/Demo3' into Demo3 2025-10-27 17:22:35 +01:00
ramollia
95d7ea5e1d Merge branch 'OtherGames' into Demo3 2025-10-27 17:22:07 +01:00
Ticho Hidding
6fb248bec4 spam minder v2 2025-10-27 17:21:50 +01:00
ramollia
7b5c188280 Merge remote-tracking branch 'origin/OtherGames' into OtherGames 2025-10-27 17:21:32 +01:00
ramollia
1c2736ac75 fixed setgamelabels 2025-10-27 17:21:04 +01:00
Ticho Hidding
caa812217f spam minder 2025-10-27 17:20:22 +01:00
Ticho Hidding
c115fb91af tourney ready 2025-10-27 17:14:36 +01:00
Ticho Hidding
b506afdade can start game from playerlist screen 2025-10-27 14:57:15 +01:00
michiel
59cc64ada7 fixed tests 2025-10-27 14:20:20 +01:00
Ticho Hidding
bd096df2c2 Merge remote-tracking branch 'origin/AudioDisplay' into OtherGames 2025-10-27 13:56:07 +01:00
Ticho Hidding
dfd3934b96 Merge branch 'Development' into OtherGames 2025-10-27 13:53:06 +01:00
michiel
2f7f2955c1 Merge remote-tracking branch 'origin/AudioDisplay' into Development 2025-10-27 10:00:49 +01:00
ramollia
fb8acbe228 add simple flip animations and fixed(?) server somewhat 2025-10-25 17:37:50 +02:00
michiel301b
be40ee0187 Made it so that it indicates with the play/pause button if its paused or played 2025-10-24 13:28:59 +02:00
michiel301b
0c536b0f9b Toegevoegd:
-Play Button + CSS + Events
-Previous Button + CSS + Events
-Changed interface for AudioResource to include a pause button which works really well with mediaplayer, however now SoundEffectAsset has an unnessescary pause
2025-10-24 13:22:42 +02:00
lieght
c85ab38142 Merge remote-tracking branch 'origin/185-networkingeventlistener' into Development 2025-10-21 20:43:21 +02:00
Ticho Hidding
c3f764f33d connect4 with minimax AI 2025-10-19 22:01:33 +02:00
Ticho Hidding
df493a5eba new reversi test (both players no legal moves) 2025-10-19 13:06:46 +02:00
Ticho Hidding
0447f7b0fe added method for sorting the flipped pieces by distance to Move.position 2025-10-19 02:18:11 +02:00
lieght
b1589032be test fix 2025-10-17 20:22:27 +02:00
lieght
55989ab8ce Merge remote-tracking branch 'origin/UI' into AudioDisplay 2025-10-17 20:13:05 +02:00
lieght
443f2da97d Merge remote-tracking branch 'origin/UI' into 185-networkingeventlistener 2025-10-17 20:12:41 +02:00
lieght
8f047cd7b5 Faster event schedule for PlayingMusic event 2025-10-17 19:51:49 +02:00
lieght
bb2630f3d5 Small event fix 2025-10-17 19:46:03 +02:00
michiel
f44bf6bd02 Tiny fix when natural skip 2025-10-16 14:00:40 +02:00
Bas de Jong
3a120803e3 Fixes for garbage code by Omar 2025-10-16 13:59:24 +02:00
michiel
6e35067c18 Skip Button 2025-10-16 13:37:01 +02:00
michiel
30f797022c Skip Button 2025-10-16 13:35:41 +02:00
lieght
abc173a1ee Merge remote-tracking branch 'origin/AudioDisplay' into AudioDisplay 2025-10-16 00:57:01 +02:00
lieght
3784cd790e Clips now also return positional information 2025-10-16 00:56:46 +02:00
michiel301b
f44c3932dc Basis Audio Display toegevoegd + standaard CSS toegevoegd
Kan nu zien hoe lang de song duurt, hoe lang ie al bezig is met draaien en de titel (-.mp3)
2025-10-16 00:45:29 +02:00
lieght
975207a6de Nuke everything on close. 2025-10-16 00:37:20 +02:00
lieght
545e830b3c Updated timings 2025-10-15 23:54:17 +02:00
lieght
977e9bb102 Updated test. 2025-10-15 23:24:21 +02:00
lieght
69bc55dc26 Polling music event, fires every 1 second 2025-10-15 23:21:00 +02:00
michiel301b
62e2b71ece begin van audio display 2025-10-15 22:58:25 +02:00
lieght
cf9dbef882 Correct client creation and user polling 2025-10-15 21:36:46 +02:00
Bas Antonius de Jong
09f3dc4e3e Merge pull request #186 from 2OOP/UI
Update UI for networking
2025-10-15 21:06:31 +02:00
lieght
6ae5f1c2d2 Merge remote-tracking branch 'origin/UI' into UI
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/layer/layers/MainLayer.java
#	app/src/main/java/org/toop/app/layer/layers/OptionsPopup.java
#	app/src/main/java/org/toop/app/layer/layers/game/TicTacToeLayer.java
#	app/src/main/java/org/toop/local/AppSettings.java
2025-10-15 21:05:33 +02:00
lieght
b30420616a Merge remote-tracking branch 'origin/185-networkingeventlistener' into UI
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/layer/layers/ConnectedLayer.java
#	app/src/main/java/org/toop/app/layer/layers/MainLayer.java
#	app/src/main/java/org/toop/app/layer/layers/OptionsPopup.java
#	app/src/main/java/org/toop/app/layer/layers/game/TicTacToeLayer.java
#	app/src/main/java/org/toop/local/AppSettings.java
2025-10-15 21:05:01 +02:00
lieght
1134649197 Documentation 2025-10-15 20:11:43 +02:00
lieght
5beebf9663 Quick fix for closing connection. 2025-10-15 19:08:18 +02:00
lieght
798005de2c Refactor to make Events easier to work with. 2025-10-15 19:05:09 +02:00
ramollia
e71369f7ff visual update 2025-10-15 16:46:19 +02:00
ramollia
56ebe1347c add: server chat box 2025-10-15 16:13:42 +02:00
ramollia
7f8ed029b9 add: reversi game 2025-10-15 15:22:19 +02:00
lieght
bc6182e29a Fixed event bug 2025-10-15 03:26:19 +02:00
lieght
dc81d9c3ca Added exceptions. Added reconnect attempts and changeable address 2025-10-15 02:58:14 +02:00
ramollia
2c8db95ba7 Merge remote-tracking branch 'origin/Reversi' into UI
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/canvas/GameCanvas.java
#	app/src/main/java/org/toop/app/layer/layers/MainLayer.java
#	app/src/main/java/org/toop/app/layer/layers/OptionsPopup.java
#	app/src/main/java/org/toop/app/layer/layers/game/TicTacToeLayer.java
#	app/src/main/java/org/toop/local/AppSettings.java
#	app/src/main/resources/assets/localization/localization_ar.properties
#	app/src/main/resources/assets/localization/localization_de.properties
#	app/src/main/resources/assets/localization/localization_en.properties
#	app/src/main/resources/assets/localization/localization_es.properties
#	app/src/main/resources/assets/localization/localization_fr.properties
#	app/src/main/resources/assets/localization/localization_hi.properties
#	app/src/main/resources/assets/localization/localization_it.properties
#	app/src/main/resources/assets/localization/localization_ja.properties
#	app/src/main/resources/assets/localization/localization_ko.properties
#	app/src/main/resources/assets/localization/localization_nl.properties
#	app/src/main/resources/assets/localization/localization_ru.properties
#	app/src/main/resources/assets/localization/localization_zh.properties
2025-10-15 00:39:14 +02:00
ramollia
1f64a2dfd0 fixed merge conflicts 2025-10-15 00:26:27 +02:00
ramollia
0a6c2487bd Merge remote-tracking branch 'origin/UI' into UI
# Conflicts:
#	app/src/main/java/org/toop/app/App.java
#	app/src/main/java/org/toop/app/GameInformation.java
#	app/src/main/java/org/toop/app/canvas/GameCanvas.java
#	app/src/main/java/org/toop/app/canvas/TicTacToeCanvas.java
#	app/src/main/java/org/toop/app/layer/Container.java
#	app/src/main/java/org/toop/app/layer/Layer.java
#	app/src/main/java/org/toop/app/layer/NodeBuilder.java
#	app/src/main/java/org/toop/app/layer/Popup.java
#	app/src/main/java/org/toop/app/layer/containers/HorizontalContainer.java
#	app/src/main/java/org/toop/app/layer/containers/VerticalContainer.java
#	app/src/main/java/org/toop/app/layer/layers/ConnectedLayer.java
#	app/src/main/java/org/toop/app/layer/layers/CreditsPopup.java
#	app/src/main/java/org/toop/app/layer/layers/MainLayer.java
#	app/src/main/java/org/toop/app/layer/layers/MultiplayerLayer.java
#	app/src/main/java/org/toop/app/layer/layers/OptionsPopup.java
#	app/src/main/java/org/toop/app/layer/layers/QuitPopup.java
#	app/src/main/java/org/toop/app/layer/layers/game/GameFinishedPopup.java
#	app/src/main/java/org/toop/app/layer/layers/game/TicTacToeLayer.java
#	app/src/main/java/org/toop/local/AppSettings.java
2025-10-15 00:17:17 +02:00
ramollia
e382cf95f2 gui refactor 2025-10-15 00:14:39 +02:00
lieght
14e6785c6f Some better docs. 2025-10-15 00:01:41 +02:00
lieght
444a81abc3 Improved API for dependency injection 2025-10-14 23:44:45 +02:00
lieght
d0676d9363 Forgot to remove 2025-10-14 23:27:52 +02:00
lieght
8f7e78efb5 Reworked NetworkingClientManager into SRP model. 2025-10-14 23:27:12 +02:00
lieght
cb7e3298fd Added shuffling on user request 2025-10-14 19:57:07 +02:00
michiel
c09f0eb1f9 punk toegevoegd 2025-10-14 14:18:52 +02:00
michiel
a3203dd78e Merge remote-tracking branch 'origin/Reversi' into Reversi 2025-10-14 13:40:00 +02:00
michiel
efbab12b10 Tests toegevoegd 2025-10-14 13:39:22 +02:00
Ticho Hidding
8e823b4108 getLegalMoves logic seems fixed //todo write better tests 2025-10-14 13:34:47 +02:00
3165ff33b3 Tests for SoundEffectManager 2025-10-14 13:21:17 +02:00
Ticho Hidding
81abeef843 commit ofzo 2025-10-14 13:12:45 +02:00
Ticho Hidding
be26db953e Merge remote-tracking branch 'origin/Development' into Reversi
# Conflicts:
#	app/src/main/java/org/toop/app/canvas/GameCanvas.java
#	app/src/main/java/org/toop/app/layer/layers/MainLayer.java
#	game/src/main/java/org/toop/game/Game.java
#	game/src/main/java/org/toop/game/othello/Othello.java
#	game/src/main/java/org/toop/game/othello/OthelloAI.java
2025-10-14 11:25:46 +02:00
Ticho Hidding
76c7e44447 Merge remote-tracking branch 'origin/Development' into Reversi 2025-10-14 11:07:10 +02:00
Ticho Hidding
d9f6c7ee74 commit 2025-10-14 11:06:41 +02:00
Bas de Jong
0e3165ed98 Added linelistener to SoundEffectAsset 2025-10-13 13:45:16 +02:00
lieght
4bcf70d4dc Removed ResourceManager from AudioManagers 2025-10-13 02:47:34 +02:00
lieght
fcc0b9d0dd SoundEffectManager now generic 2025-10-13 02:27:04 +02:00
lieght
cdc34b432e Changed pom to be correct.
Fixed SnowflakeGenerator not making unique ids.
Changed naming for event implementation.
Automated id getter for events.
Added Error-Prone to all modules.
Added parents to all modules.
Added processors module.
2025-10-13 02:06:12 +02:00
Bas Antonius de Jong
00daf37244 Merge pull request #175 from 2OOP/166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen
166 audiomanager opslitsen om single responsibility principle te volgen Done
2025-10-12 20:44:57 +02:00
lieght
bab11b64a5 Merge remote-tracking branch 'origin/166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen' into 166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen 2025-10-12 20:42:09 +02:00
lieght
4b60fa88ee Moved restrictedAPI to future release 2025-10-12 20:41:56 +02:00
lieght
f3316145e7 Finished todo's 2025-10-12 20:41:54 +02:00
lieght
53a72cc340 Moved restrictedAPI to future release 2025-10-12 20:41:10 +02:00
lieght
081fbda7b1 Merge remote-tracking branch 'origin/166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen' into 166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen
# Conflicts:
#	framework/src/main/java/org/toop/framework/audio/MusicManager.java
2025-10-12 20:37:23 +02:00
lieght
d051e3e603 Finished todo's 2025-10-12 20:36:28 +02:00
Bas de Jong
5317c42c81 Removed no more needed code. 2025-10-12 07:20:28 +02:00
Bas de Jong
6085f6ebe2 Small fixes. 2025-10-12 07:19:27 +02:00
Bas de Jong
ea6264e519 Added ErrorProne for potential bugs. Fixed potential bugs. 2025-10-12 07:14:26 +02:00
lieght
e3bce3889e Renamed VolumeTypes to VolumeControl. Made it thread safe. Added docs to VolumeControl and co.
removed .updateAllVolumes() in favor of auto updating inside enum instead
2025-10-12 02:20:30 +02:00
lieght
b050e06ceb Minor changes in API design 2025-10-12 01:56:06 +02:00
lieght
7631a10838 Renamed VOLUME to MASTERVOLUME for better naming 2025-10-12 01:02:58 +02:00
lieght
ca25338971 Fixed grammer and spelling mistakes 2025-10-12 00:55:02 +02:00
lieght
42e03e0878 Removed file no longer in use 2025-10-12 00:52:02 +02:00
lieght
9b81ee1e65 Added ability to remove a manager from VolumeTypes 2025-10-12 00:39:16 +02:00
lieght
a4b0f890da Merge remote-tracking branch 'origin/166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen' into 166-audiomanager-opslitsen-om-single-responsibility-principle-te-volgen 2025-10-12 00:37:21 +02:00
lieght
a766b85a75 Fixed AudioVolumemanager, all volumes calculations are now made in VolumeTypes enum 2025-10-12 00:37:02 +02:00
Stef
34ccddaea5 Hotfix for loading clip volume issue (#174) 2025-10-12 00:04:59 +02:00
lieght
73a2fe3da2 Unit tests for MusicManager.java 2025-10-11 23:08:28 +02:00
Stef
d958b9730a Split SoundEffectManager from AudioManager. (#171)
Clips no longer create a new clip instance each time they are played.  A singular clip is made for each resource and is opened/closed when loaded/unloaded. When a clip is played that is already playing it'll stop playback and start again. Clip volume handling isn't done very well.
2025-10-11 23:00:06 +02:00
Bas de Jong
9749d3eee8 Added more flexible dependency injection to MusicManager for unittesting. Moved to event driven design for less complex code and lower runtime complexity. 2025-10-11 20:45:57 +02:00
Bas de Jong
1ecdb9a555 Made all of the updated classes more generic for better flexibility in unittesting 2025-10-11 19:31:55 +02:00
lieght
b101734fd7 Reworked to now use better defined generics and easier to use API. Added AudioResource to be used in changing volume 2025-10-11 06:09:13 +02:00
lieght
123ecc7d3a Working state. Split AudioManager into 3 different branches for easier testing and srp 2025-10-11 04:50:49 +02:00
Ticho Hidding
c1f7a093ef Moves flip dots. all tests pass. can play reversi local. 2025-10-11 00:51:46 +02:00
Ticho Hidding
5dda85248e legal moves now get highlighted in red 2025-10-09 15:27:58 +02:00
Ticho Hidding
5a3490af2e start to reversi logic 2025-10-08 17:27:50 +02:00
Bas de Jong
7f3d858320 AppSettings now also get loaded into the assetmanager 2025-10-08 00:14:40 +02:00
Bas de Jong
e9dfbbd150 Renamed asset folder to resource, made resourceLoader more robust. Completed some TODO's, formatting 2025-10-07 23:54:33 +02:00
Bas de Jong
72e322675e Fixed bugs and oversights 2025-10-07 22:39:47 +02:00
ramollia
e12e48b4fb fast server connection 2025-10-07 12:40:12 +02:00
9 changed files with 74 additions and 581 deletions

View File

@@ -1,9 +1,23 @@
package org.toop;
import org.toop.app.App;
import org.toop.framework.game.games.reversi.BitboardReversi;
import org.toop.framework.game.players.ArtificialPlayer;
import org.toop.game.players.ai.MCTSAI;
import org.toop.game.players.ai.RandomAI;
import org.toop.game.players.ai.mcts.MCTSAI1;
import org.toop.game.players.ai.mcts.MCTSAI2;
import org.toop.game.players.ai.mcts.MCTSAI3;
import org.toop.game.players.ai.mcts.MCTSAI4;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public final class Main {
static void main(String[] args) {
App.run(args);
// final ExecutorService executor = Executors.newFixedThreadPool(1);
// executor.execute(() -> testAIs(25));
}
}

View File

@@ -210,7 +210,7 @@ public final class Server {
Player[] players = new Player[2];
players[userStartingTurn] = new ArtificialPlayer(new MCTSAI3(1000, 8), user);
players[userStartingTurn] = new ArtificialPlayer(new MCTSAI3(1000), user);
players[opponentStartingTurn] = new OnlinePlayer(response.opponent());
switch (type) {

View File

@@ -88,7 +88,7 @@ public class LocalMultiplayerView extends ViewWidget {
if (information.players[1].isHuman) {
players[1] = new LocalPlayer(information.players[1].name);
} else {
players[1] = new ArtificialPlayer(new MCTSAI4(100, 8), "MCTS V4 AI");
players[1] = new ArtificialPlayer(new MCTSAI4(100), "MCTS V4 AI");
}
if (AppSettings.getSettings().getTutorialFlag() && AppSettings.getSettings().getFirstReversi()) {
new ShowEnableTutorialWidget(

View File

@@ -1,195 +0,0 @@
package org.toop.game.players.ai;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.framework.gameFramework.model.player.AbstractAI;
import java.util.Random;
public class MCTSAI2 extends AbstractAI {
private static class Node {
public TurnBasedGame state;
public long move;
public long unexpandedMoves;
public Node parent;
public Node[] children;
public int expanded;
public float value;
public int visits;
public Node(TurnBasedGame state, Node parent, long move) {
final long legalMoves = state.getLegalMoves();
this.state = state;
this.move = move;
this.unexpandedMoves = legalMoves;
this.parent = parent;
this.children = new Node[Long.bitCount(legalMoves)];
this.expanded = 0;
this.value = 0.0f;
this.visits = 0;
}
public Node(TurnBasedGame state) {
this(state, null, 0L);
}
public boolean isFullyExpanded() {
return expanded == children.length;
}
public float calculateUCT(int parentVisits) {
final float exploitation = value / visits;
final float exploration = 1.41f * (float)(Math.sqrt(Math.log(parentVisits) / visits));
return exploitation + exploration;
}
public Node bestUCTChild() {
Node highestUCTChild = null;
float highestUCT = Float.NEGATIVE_INFINITY;
for (int i = 0; i < expanded; i++) {
final float childUCT = children[i].calculateUCT(visits);
if (childUCT > highestUCT) {
highestUCTChild = children[i];
highestUCT = childUCT;
}
}
return highestUCTChild;
}
}
private final Random random;
private final int milliseconds;
public MCTSAI2(int milliseconds) {
this.random = new Random();
this.milliseconds = milliseconds;
}
public MCTSAI2(MCTSAI2 other) {
this.random = other.random;
this.milliseconds = other.milliseconds;
}
@Override
public MCTSAI2 deepCopy() {
return new MCTSAI2(this);
}
@Override
public long getMove(TurnBasedGame game) {
final Node root = new Node(game, null, 0L);
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
while (System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final float value = simulation(leaf);
backPropagation(leaf, value);
}
final Node mostVisitedChild = mostVisitedChild(root);
return mostVisitedChild != null? mostVisitedChild.move : 0L;
}
private Node mostVisitedChild(Node root) {
Node mostVisitedChild = null;
int mostVisited = -1;
for (int i = 0; i < root.expanded; i++) {
if (root.children[i].visits > mostVisited) {
mostVisitedChild = root.children[i];
mostVisited = root.children[i].visits;
}
}
return mostVisitedChild;
}
private Node selection(Node root) {
while (root.isFullyExpanded() && !root.state.isTerminal()) {
root = root.bestUCTChild();
}
return root;
}
private Node expansion(Node leaf) {
if (leaf.unexpandedMoves == 0L) {
return leaf;
}
final long unexpandedMove = leaf.unexpandedMoves & -leaf.unexpandedMoves;
final TurnBasedGame copiedState = leaf.state.deepCopy();
copiedState.play(unexpandedMove);
final Node expandedChild = new Node(copiedState, leaf, unexpandedMove);
leaf.children[leaf.expanded] = expandedChild;
leaf.expanded++;
leaf.unexpandedMoves &= ~unexpandedMove;
return expandedChild;
}
private float simulation(Node leaf) {
final TurnBasedGame copiedState = leaf.state.deepCopy();
final int playerIndex = 1 - copiedState.getCurrentTurn();
while (!copiedState.isTerminal()) {
final long legalMoves = copiedState.getLegalMoves();
final long randomMove = randomSetBit(legalMoves);
copiedState.play(randomMove);
}
if (copiedState.getWinner() == playerIndex) {
return 1.0f;
} else if (copiedState.getWinner() >= 0) {
return -1.0f;
}
return 0.0f;
}
private void backPropagation(Node leaf, float value) {
while (leaf != null) {
leaf.value += value;
leaf.visits++;
value = -value;
leaf = leaf.parent;
}
}
private long randomSetBit(long value) {
if (0L == value) {
return 0;
}
final int bitCount = Long.bitCount(value);
final int randomBitCount = random.nextInt(bitCount);
for (int i = 0; i < randomBitCount; i++) {
value &= value - 1;
}
return value & -value;
}
}

View File

@@ -1,258 +0,0 @@
package org.toop.game.players.ai;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.framework.gameFramework.model.player.AbstractAI;
import java.util.Random;
public class MCTSAI3 extends AbstractAI {
private static class Node {
public TurnBasedGame state;
public long move;
public long unexpandedMoves;
public Node parent;
public Node[] children;
public int expanded;
public float value;
public int visits;
public Node(TurnBasedGame state, Node parent, long move) {
final long legalMoves = state.getLegalMoves();
this.state = state;
this.move = move;
this.unexpandedMoves = legalMoves;
this.parent = parent;
this.children = new Node[Long.bitCount(legalMoves)];
this.expanded = 0;
this.value = 0.0f;
this.visits = 0;
}
public Node(TurnBasedGame state) {
this(state, null, 0L);
}
public boolean isFullyExpanded() {
return expanded == children.length;
}
public float calculateUCT(int parentVisits) {
final float exploitation = value / visits;
final float exploration = 1.41f * (float)(Math.sqrt(Math.log(parentVisits) / visits));
return exploitation + exploration;
}
public Node bestUCTChild() {
Node highestUCTChild = null;
float highestUCT = Float.NEGATIVE_INFINITY;
for (int i = 0; i < expanded; i++) {
final float childUCT = children[i].calculateUCT(visits);
if (childUCT > highestUCT) {
highestUCTChild = children[i];
highestUCT = childUCT;
}
}
return highestUCTChild;
}
}
private final Random random;
private Node root;
private final int milliseconds;
public MCTSAI3(int milliseconds) {
this.random = new Random();
this.root = null;
this.milliseconds = milliseconds;
}
public MCTSAI3(MCTSAI3 other) {
this.random = other.random;
this.root = other.root;
this.milliseconds = other.milliseconds;
}
@Override
public MCTSAI3 deepCopy() {
return new MCTSAI3(this);
}
@Override
public long getMove(TurnBasedGame game) {
detectRoot(game);
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
while (System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final float value = simulation(leaf);
backPropagation(leaf, value);
}
final Node mostVisitedChild = mostVisitedChild(root);
final long move = mostVisitedChild != null? mostVisitedChild.move : 0L;
newRoot(move);
return move;
}
private Node mostVisitedChild(Node root) {
Node mostVisitedChild = null;
int mostVisited = -1;
for (int i = 0; i < root.expanded; i++) {
if (root.children[i].visits > mostVisited) {
mostVisitedChild = root.children[i];
mostVisited = root.children[i].visits;
}
}
return mostVisitedChild;
}
private void detectRoot(TurnBasedGame game) {
if (root == null) {
root = new Node(game.deepCopy());
return;
}
final long[] currentBoards = game.getBoard();
final long[] rootBoards = root.state.getBoard();
boolean detected = true;
for (int i = 0; i < rootBoards.length; i++) {
if (rootBoards[i] != currentBoards[i]) {
detected = false;
break;
}
}
if (detected) {
return;
}
for (int i = 0; i < root.expanded; i++) {
final Node child = root.children[i];
final long[] childBoards = child.state.getBoard();
detected = true;
for (int j = 0; j < childBoards.length; j++) {
if (childBoards[j] != currentBoards[j]) {
detected = false;
break;
}
}
if (detected) {
root = child;
return;
}
}
root = new Node(game.deepCopy());
}
private void newRoot(long move) {
for (final Node child : root.children) {
if (child.move == move) {
root = child;
break;
}
}
}
private Node selection(Node root) {
while (root.isFullyExpanded() && !root.state.isTerminal()) {
root = root.bestUCTChild();
}
return root;
}
private Node expansion(Node leaf) {
if (leaf.unexpandedMoves == 0L) {
return leaf;
}
final long unexpandedMove = leaf.unexpandedMoves & -leaf.unexpandedMoves;
final TurnBasedGame copiedState = leaf.state.deepCopy();
copiedState.play(unexpandedMove);
final Node expandedChild = new Node(copiedState, leaf, unexpandedMove);
leaf.children[leaf.expanded] = expandedChild;
leaf.expanded++;
leaf.unexpandedMoves &= ~unexpandedMove;
return expandedChild;
}
private float simulation(Node leaf) {
final TurnBasedGame copiedState = leaf.state.deepCopy();
final int playerIndex = 1 - copiedState.getCurrentTurn();
while (!copiedState.isTerminal()) {
final long legalMoves = copiedState.getLegalMoves();
final long randomMove = randomSetBit(legalMoves);
copiedState.play(randomMove);
}
if (copiedState.getWinner() == playerIndex) {
return 1.0f;
} else if (copiedState.getWinner() >= 0) {
return -1.0f;
}
return 0.0f;
}
private void backPropagation(Node leaf, float value) {
while (leaf != null) {
leaf.value += value;
leaf.visits++;
value = -value;
leaf = leaf.parent;
}
}
private long randomSetBit(long value) {
if (0L == value) {
return 0;
}
final int bitCount = Long.bitCount(value);
final int randomBitCount = random.nextInt(bitCount);
for (int i = 0; i < randomBitCount; i++) {
value &= value - 1;
}
return value & -value;
}
}

View File

@@ -3,27 +3,21 @@ package org.toop.game.players.ai.mcts;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.game.players.ai.MCTSAI;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class MCTSAI3 extends MCTSAI {
private final int threads;
private final ExecutorService threadPool;
private static final int THREADS = 8;
public MCTSAI3(int milliseconds, int threads) {
private static final ExecutorService threadPool = Executors.newFixedThreadPool(THREADS);
public MCTSAI3(int milliseconds) {
super(milliseconds);
this.threads = threads;
this.threadPool = Executors.newFixedThreadPool(threads);
}
public MCTSAI3(MCTSAI3 other) {
super(other);
this.threads = other.threads;
this.threadPool = other.threadPool;
}
@Override
@@ -37,21 +31,12 @@ public class MCTSAI3 extends MCTSAI {
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
final CountDownLatch latch = new CountDownLatch(threads);
for (int i = 0; i < threads; i++) {
threadPool.submit(() -> {
try {
iterate(root, endTime);
} finally {
latch.countDown();
}
});
for (int i = 0; i < THREADS; i++) {
threadPool.submit(() -> iterate(root, endTime));
}
try {
final long remaining = endTime - System.nanoTime();
latch.await(remaining, TimeUnit.NANOSECONDS);
threadPool.awaitTermination(milliseconds + 50, TimeUnit.MILLISECONDS);
lastIterations = root.visits.get();
@@ -65,12 +50,14 @@ public class MCTSAI3 extends MCTSAI {
}
}
private void iterate(Node root, long endTime) {
private Void iterate(Node root, long endTime) {
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final int value = simulation(leaf);
backPropagation(leaf, value);
}
return null;
}
}

View File

@@ -3,29 +3,27 @@ package org.toop.game.players.ai.mcts;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
import org.toop.game.players.ai.MCTSAI;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class MCTSAI4 extends MCTSAI {
private final int threads;
private final ExecutorService threadPool;
private static final int THREADS = Runtime.getRuntime().availableProcessors();
private static final ExecutorService threadPool = Executors.newFixedThreadPool(THREADS);
private Node root;
public MCTSAI4(int milliseconds, int threads) {
public MCTSAI4(int milliseconds) {
super(milliseconds);
this.threads = threads;
this.threadPool = Executors.newFixedThreadPool(threads);
this.root = null;
}
public MCTSAI4(MCTSAI4 other) {
super(other);
this.threads = other.threads;
this.threadPool = other.threadPool;
this.root = other.root;
}
@Override
@@ -39,21 +37,12 @@ public class MCTSAI4 extends MCTSAI {
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
final CountDownLatch latch = new CountDownLatch(threads);
for (int i = 0; i < threads; i++) {
threadPool.submit(() -> {
try {
iterate(root, endTime);
} finally {
latch.countDown();
}
});
for (int i = 0; i < THREADS; i++) {
threadPool.submit(() -> iterate(root, endTime));
}
try {
final long remaining = endTime - System.nanoTime();
latch.await(remaining, TimeUnit.NANOSECONDS);
threadPool.awaitTermination(milliseconds + 50, TimeUnit.MILLISECONDS);
lastIterations = root.visits.get();
@@ -71,12 +60,14 @@ public class MCTSAI4 extends MCTSAI {
}
}
private void iterate(Node root, long endTime) {
private Void iterate(Node root, long endTime) {
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final int value = simulation(leaf);
backPropagation(leaf, value);
}
return null;
}
}

View File

@@ -23,15 +23,15 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.text.DecimalFormat;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AITest {
private static String fileName = "gameData.csv";
private static List<Matchup> matchupList = new ArrayList<Matchup>();
private static List<AIData> dataList = new ArrayList<AIData>();
private static List<GameData> gameDataList = new ArrayList<GameData>();
@@ -42,8 +42,8 @@ public class AITest {
var versions = new ArtificialPlayer[4];
versions[0] = new ArtificialPlayer(new MCTSAI1(10), "MCTS V1");
versions[1] = new ArtificialPlayer(new MCTSAI2(10), "MCTS V2");
versions[2] = new ArtificialPlayer(new MCTSAI3(10, 8), "MCTS V3");
versions[3] = new ArtificialPlayer(new MCTSAI4(10, 8), "MCTS V4");
versions[2] = new ArtificialPlayer(new MCTSAI3(10), "MCTS V3");
versions[3] = new ArtificialPlayer(new MCTSAI4(10), "MCTS V4");
for (int i = 0; i < versions.length; i++) {
for (int j = i + 1; j < versions.length; j++) {
@@ -55,32 +55,6 @@ public class AITest {
}
}
// @BeforeAll
// public static void init() {
//
// var versions = new ArtificialPlayer[11];
// versions[0] = new ArtificialPlayer(new MCTSAI3(10, 1), "MCTS V3T1");
// versions[1] = new ArtificialPlayer(new MCTSAI3(10, 2), "MCTS V3T2");
// versions[2] = new ArtificialPlayer(new MCTSAI3(10, 4), "MCTS V3T4");
// versions[3] = new ArtificialPlayer(new MCTSAI3(10, 8), "MCTS V3T8");
// versions[4] = new ArtificialPlayer(new MCTSAI3(10, 16), "MCTS V3T16");
// versions[5] = new ArtificialPlayer(new MCTSAI3(10, 128), "MCTS V3T32");
// versions[6] = new ArtificialPlayer(new MCTSAI3(10, 256), "MCTS V3T64");
// versions[7] = new ArtificialPlayer(new MCTSAI3(10, 128), "MCTS V3T128");
// versions[8] = new ArtificialPlayer(new MCTSAI3(10, 256), "MCTS V3T256");
// versions[9] = new ArtificialPlayer(new MCTSAI3(10, 512), "MCTS V3T512");
// versions[10] = new ArtificialPlayer(new MCTSAI3(10, 1024), "MCTS V3T1024");
//
// for (int i = 0; i < versions.length; i++) {
// for (int j = i + 1; j < versions.length; j++) {
// final int playerIndex1 = i % versions.length;
// final int playerIndex2 = j % versions.length;
// addMatch(versions[playerIndex1], versions[playerIndex2]);
// addMatch(versions[playerIndex2], versions[playerIndex1]); // home vs away system
// }
// }
// }
public static void addMatch(ArtificialPlayer v1, ArtificialPlayer v2) {
matchupList.add(new Matchup(v1, v2));
}
@@ -103,8 +77,8 @@ public class AITest {
}
public void playGame(Matchup m) {
long nanocounterAI1 = 0L;
long nanocounterAI2 = 0L;
long millisecondscounterAI1 = 0L;
long millisecondscounterAI2 = 0L;
List<Integer> iterationsAI1 = new ArrayList<>();
List<Integer> iterationsAI2 = new ArrayList<>();
final BitboardReversi match = new BitboardReversi();
@@ -117,21 +91,19 @@ public class AITest {
final long startTime = System.nanoTime();
final long move = players[currentAI].getMove(match);
final long endTime = System.nanoTime();
if (players[currentAI].getAi() instanceof MCTSAI) {
final int lastIterations = ((MCTSAI) players[currentAI].getAi()).getLastIterations();
if (currentAI == 0) {
iterationsAI1.add(lastIterations);
nanocounterAI1 += (endTime - startTime);
millisecondscounterAI1 += (endTime - startTime);
} else {
iterationsAI2.add(lastIterations);
nanocounterAI2 += (endTime - startTime);
millisecondscounterAI2 += (endTime - startTime);
}
}
match.play(move);
}
generateMatchData(m.getPlayer1().getName(), m.getPlayer2().getName(), match, iterationsAI1, iterationsAI2, nanocounterAI1, nanocounterAI2);
generateMatchData(m.getPlayer1().getName(), m.getPlayer2().getName(), match, iterationsAI1, iterationsAI2, millisecondscounterAI1, millisecondscounterAI2);
}
public void generateMatchData(
@@ -142,45 +114,39 @@ public class AITest {
List<Integer> iterationsAI1,
List<Integer> iterationsAI2,
long nanocounterAI1,
long nanocounterAI2
long millisecondscounterAI1,
long millisecondscounterAI2
) {
try {
var ai110 = iterationsAI1.subList(0, 10);
var ai120 = iterationsAI1.subList(10, 20);
var ai110 = iterationsAI1.subList(0, 9);
var ai120 = iterationsAI1.subList(10, 19);
var ai130 = iterationsAI1.subList(20, iterationsAI1.size());
var ai210 = iterationsAI2.subList(0, 10);
var ai220 = iterationsAI2.subList(10, 20);
var ai210 = iterationsAI2.subList(0, 9);
var ai220 = iterationsAI2.subList(10, 19);
var ai230 = iterationsAI2.subList(20, iterationsAI2.size());
writeGamesToCSV(fileName, new GameData(
writeGamesToCSV("gameData.csv", new GameData(
AI1,
AI2,
getWinnerForMatch(AI1, AI2, match),
match.getAmountOfTurns(),
iterationsAI1.stream().mapToLong(Integer::longValue).sum(),
ai110.stream().mapToLong(Integer::longValue).sum(),
ai120.stream().mapToLong(Integer::longValue).sum(),
ai130.stream().mapToLong(Integer::longValue).sum(),
iterationsAI1.stream().mapToInt(Integer::intValue).sum(),
iterationsAI1.stream().mapToDouble(Integer::doubleValue).sum() / iterationsAI1.size(),
ai110.stream().mapToDouble(Integer::doubleValue).sum() / ai110.size(),
ai120.stream().mapToDouble(Integer::doubleValue).sum() / ai120.size(),
ai130.stream().mapToDouble(Integer::doubleValue).sum() / ai130.size(),
iterationsAI2.stream().mapToInt(Integer::intValue).sum(),
ai210.stream().mapToLong(Integer::longValue).sum(),
ai220.stream().mapToLong(Integer::longValue).sum(),
ai230.stream().mapToLong(Integer::longValue).sum(),
iterationsAI2.stream().mapToDouble(Integer::doubleValue).sum() / iterationsAI2.size(),
ai210.stream().mapToDouble(Integer::doubleValue).sum() / ai210.size(),
ai220.stream().mapToDouble(Integer::doubleValue).sum() / ai220.size(),
ai230.stream().mapToDouble(Integer::doubleValue).sum() / ai230.size(),
nanocounterAI1,
nanocounterAI2,
millisecondscounterAI1,
millisecondscounterAI2,
LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss"))
));
} catch (IOException e) {
@@ -289,7 +255,7 @@ public class AITest {
final BufferedReader reader = new BufferedReader(new FileReader(filepath))
) {
if (reader.readLine() == null || reader.readLine().isBlank()) {
writer.write("Black,White,Winner,Turns Played,Black total iterations,Black total iterations 0-10,Black total iterations 11-20,Black total iterations 21-30,Black average iterations,Black average iterations 0-10,Black average iterations 11-20,Black average iterations 21-30,White total iterations,White total iterations 0-10,White total iterations 11-20,White total iterations 21-30,White average iterations,White average iterations 0-10,White average iterations 11-20,White average iterations 21-30,Total Time AI1,Total Time AI2,Time");
writer.write("Black,White,Winner,Turns Played,Black iterations,Black average iterations,Black average iterations 0-10,Black average iterations 11-20,Black average iterations 21-30,White iterations,White average iterations,White average iterations 0-10,White average iterations 11-20,White average iterations 21-30,Total Time AI1,Total Time AI2,Time");
writer.newLine();
}
@@ -299,23 +265,17 @@ public class AITest {
gameData.winner() + "," +
gameData.turns() + "," +
gameData.AI1totalIterations() + "," +
gameData.AI1totalIterations10() + "," +
gameData.AI1totalIterations20() + "," +
gameData.AI1totalIterations30() + "," +
BigDecimal.valueOf(gameData.AI1averageIterations()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations10()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations20()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations30()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations10()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations20()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI1averageIterations30()).setScale(2, RoundingMode.DOWN) + "," +
gameData.AI2totalIterations() + "," +
gameData.AI2totalIterations10() + "," +
gameData.AI2totalIterations20() + "," +
gameData.AI2totalIterations30() + "," +
BigDecimal.valueOf(gameData.AI2averageIterations()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations10()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations20()).setScale(2, RoundingMode.HALF_EVEN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations30()).setScale(2, RoundingMode.HALF_EVEN) + "," +
(gameData.nanoAI1() / 1_000_000L) + "," +
(gameData.nanoAI2() / 1_000_000L) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations10()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations20()).setScale(2, RoundingMode.DOWN) + "," +
BigDecimal.valueOf(gameData.AI2averageIterations30()).setScale(2, RoundingMode.DOWN) + "," +
(gameData.millisecondsAI1() / 1_000_000L) + "," +
(gameData.millisecondsAI2() / 1_000_000L) + "," +
gameData.time());
writer.newLine();
}

View File

@@ -6,26 +6,20 @@ public record GameData(
String winner,
int turns,
long AI1totalIterations,
long AI1totalIterations10,
long AI1totalIterations20,
long AI1totalIterations30,
int AI1totalIterations,
double AI1averageIterations,
double AI1averageIterations10,
double AI1averageIterations20,
double AI1averageIterations30,
long AI2totalIterations,
long AI2totalIterations10,
long AI2totalIterations20,
long AI2totalIterations30,
int AI2totalIterations,
double AI2averageIterations,
double AI2averageIterations10,
double AI2averageIterations20,
double AI2averageIterations30,
long nanoAI1,
long nanoAI2,
long millisecondsAI1,
long millisecondsAI2,
String time
) {}