From 0db6be32b6d02a530adec8df23acc39f6c197fe3 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 10:05:02 +0100 Subject: [PATCH 01/68] Road.java and changes SiedlerGame buildRoad Method --- .gitignore | 1 + .../ch/zhaw/catan/Config$Faction.class | Bin 1465 -> 1465 bytes .../ch/zhaw/catan/Config$Land.class | Bin 2136 -> 2136 bytes .../ch/zhaw/catan/Config$Resource.class | Bin 1530 -> 1530 bytes .../ch/zhaw/catan/Config$Structure.class | Bin 2969 -> 2969 bytes .../ch/zhaw/catan/Config.class | Bin 3892 -> 3892 bytes .../ch/zhaw/catan/Dummy$1.class | Bin 702 -> 702 bytes .../ch/zhaw/catan/Dummy$Actions.class | Bin 1113 -> 1113 bytes .../ch/zhaw/catan/Dummy.class | Bin 3788 -> 3788 bytes .../ch/zhaw/catan/SiedlerBoard.class | Bin 5398 -> 5365 bytes .../ch/zhaw/catan/SiedlerBoardTextView.class | Bin 681 -> 681 bytes .../ch/zhaw/catan/SiedlerGame.class | Bin 2586 -> 2740 bytes .../ch/zhaw/hexboard/Edge.class | Bin 2689 -> 2689 bytes .../hexboard/FieldAnnotationPosition.class | Bin 2239 -> 2239 bytes .../ch/zhaw/hexboard/HexBoard.class | Bin 12025 -> 12025 bytes .../ch/zhaw/hexboard/HexBoardTextView.class | Bin 8235 -> 8235 bytes .../ch/zhaw/hexboard/Label.class | Bin 1235 -> 1235 bytes src/ch/zhaw/catan/Road.java | 13 +++++++++++++ 18 files changed, 14 insertions(+) create mode 100644 .gitignore create mode 100644 src/ch/zhaw/catan/Road.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a3417b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/out/ diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class index d312fff43d77181fa04aeec4c5c291969fba6a77..a9c9a44e6bb763d39b275dcbf6f35d961bad970d 100644 GIT binary patch delta 17 ZcmdnVy_1{c)W2Q(7#J9AHgara1pq*%27CYj delta 17 ZcmdnVy_1{c)W2Q(7#J9AH*#!b1pq*+27Lek diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class index 2a20065c61fe93f6bc65a3beb56983a3a86d994f..a0e3700d37eb7ebebe102891270c75592f6aa796 100644 GIT binary patch delta 29 lcmca1a6>@g)W2Q(7#J9A7)sa~m>3x(CtqX|-Kc8J0RWgZ2!H?p delta 29 lcmca1a6>@g)W2Q(7#J9A8A{k0m>3x(CtqX|-Kc8J0RWgq2!Q|q diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class index 58f80c19d826c4c3d20a93bb7cc34cd58bfbf4c1..82c496d4a344d4551e973a178c0d2b1feb11773f 100644 GIT binary patch delta 17 Zcmeyx{fnF9)W2Q(7#J9AHgbGo1prA%2R{G+ delta 17 Zcmeyx{fnF9)W2Q(7#J9AH*$Pp1prA+2S5M- diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class index 169ab41df0a499b0974a70ca692c220aade8ba7a..cfb923789cbee4999b3277de56d6adbfb46ab006 100644 GIT binary patch delta 29 lcmbO!K2u!a)W2Q(7#J9A7`oXRm>3yECVylW*{D*=4FHaJ2!;Rv delta 29 lcmbO!K2u!a)W2Q(7#J9A8M@gSm>3yECVylW*{D*=4FHaa2!{Xw diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class index 922ab81f29087b69126385b1f5d1e57df820260c..598fcb0bcb49d4a9e62bbb1a06337c38fcce3681 100644 GIT binary patch delta 17 ZcmdlYw?&TQ)W2Q(7#J9AHgf3j0{}rl1|0wZ delta 17 ZcmdlYw?&TQ)W2Q(7#J9AH*)Ck0{}rq1|9$a diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class index f4062e0543dd7a05698bdfc914692770f987eff1..8567a9baf96bfafe29eaf344e89d39a5ee1dcf7d 100644 GIT binary patch delta 23 fcmdnTx{sCP)W2Q(7#J9AHgcphF{)24VDbY1X}|}l delta 23 fcmdnTx{sCP)W2Q(7#J9AH*%yiF{({2VDbY1X~qYr diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$Actions.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$Actions.class index 3410db753ca6458025bf856739f3d98ae36bec03..0d99f9f2a2000f589248dd6620c2a76c84bb5e38 100644 GIT binary patch delta 17 Zcmcb~ag&4N)W2Q(7#J9AHgW{A002Xa22}t6 delta 17 Zcmcb~ag&4N)W2Q(7#J9AH*y5B002Xf237z7 diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class index d1759cf92ad3f595b71d525c136ce70d21351b66..09c27a7c753f40354200852b54a7f35916c4c323 100644 GIT binary patch delta 127 zcmX>jdq$Sy)W2Q(7#J9AHgcTci4Fnpu}*NL7CwKgDS&i1~rBo4C;(544RDm3|fpr3_6UW47!XG4El^p f3`UG<491f+d7m?yO%~)!W3^)7Vz8cE!xsPm99I^6 delta 127 zcmX>jdq$Sy)W2Q(7#J9AH*%cdi49WDsKzWDsXiWRPGmWRPU=WRPM=WRPLV zVvuEMV~}H*z@Wge1t@!#L5bl4g9^iC233X|3~G!l3>u9544RB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R24L%ugs#(90|AGvB=xVszQ_FSyA&lR}(a&Ds_UWBP;usoO_4&bQdKH p=_Zy{d5(*MQ8H#A))}ZV_9HQp|0`a>2V*}XY#(WA-TYI0+Ha^T-5me` diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class index fd38f027ff1bd27d5b16552c99dd8824201047dd..26d90d1065f9c2e5fd1d0f89628fb2679cba5c4b 100644 GIT binary patch delta 17 ZcmZ3?Y!DUH)Y>#{AR3yQgjShxI;WeH=D>Ehv)K^J zAMkg0?}d&ZI6A`}H~s_vg4bRzt*t6&3eV+IG{qx`7UlP$WeKkP=3Pvat zqcDvzntIHi@|4M~{Zw)9u`palW6RQ#?h2z|BDo!*aYh%6dg^(dw^9aoxs@tQQ8k6L zW^<=HK@kc@=?#iS=v0i}q)A4z1I6$01HmY~r%;S876uAw&a@&u9izB1Fm5=4yCNr_ zDT105CUl;qa}k=3(F~nubWXd_bfuZf+NKE~q-`}AMa99PdsL7O_!Lhh3$Ml0U7FEM zuK2LDTPf}qH#c@GrOf)qZZVhJC^2GrMyIl1fxGTDH=81e=!FmwOThn6b`f~UW}A*9tmAetn(u@5sA4qN3oeO< z-E<65c5UMcqbrFXJ>nH9r7c)2{eP~R5x|W=ID&8eWbk{N=MXzaM|S!h$3pg zVF4R;>yF)8mxijfM83P`AMis}Mpe9NAx1`@z=$;WbkGp#PMlYCT}S$sik@ehi8{eq&u(8S`;H1R7<{fMUkln@4W2g!=*5MzjPAHodR4eLx@j z9IN=N{PuG^*BoB@+S(Pz9l8sQ+I>VHV`cOSrAM-TJA`ey!}ck5ifx5H!+#zcI{x)V z=DQ*Ot?JV9Qj`JL8fAUUI$V9R`e_K4=O?4}6L7p5!Lf0I2>o^92<7PB$aw!fgzdhr z0F}Kwb}HVVpP&-|(QID#wQGUV7o#J?LPH``(0LEg16@g*RK!0Hd$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class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class index 50b3008ccbd52a872ad8a498800786b7129d62dc..064c70d60828d7a4384f85d8d86b2dd9c4a59b42 100644 GIT binary patch delta 17 ZcmdllxL=Ut)W2Q(7#J9AHgas|002TM2Au!^ delta 17 ZcmdllxL=Ut)W2Q(7#J9AH*##}002TR2A%)_ diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class index 54b55a6018c5c241225ea1f2bc50d808f5cef6a3..c212f56dfbb74bb24fc3dab4a53e704eb7cfc170 100644 GIT binary patch delta 17 Zcmewv`!kl~)W2Q(7#J9AHgbH_0{~L%2nhfH delta 17 Zcmewv`!kl~)W2Q(7#J9AH*$Q`0{~L+2nqlI diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class index d987cad504653507643f6993f19be18b860f1b89..9904f75d53df6123bc2d5ba3cae6853767877e7b 100644 GIT binary patch delta 17 ZcmZ4Ou-bv+)W2Q(7#J9AHgYH{002ZA23G(8 delta 17 ZcmZ4Ou-bv+)W2Q(7#J9AH*zQ|002ZF23P<9 diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class index 3dd5342468f73a225021be99f765b9a921438683..85f914830010a10f0d03bf5bf51d31549fa8f97e 100644 GIT binary patch delta 17 Zcmcc2d6|>r)W2Q(7#J9AHgcS10RThY2E_mX delta 17 Zcmcc2d6|>r)W2Q(7#J9AH*%b20RThd2F3sY diff --git a/src/ch/zhaw/catan/Road.java b/src/ch/zhaw/catan/Road.java new file mode 100644 index 0000000..24025c5 --- /dev/null +++ b/src/ch/zhaw/catan/Road.java @@ -0,0 +1,13 @@ +package ch.zhaw.catan; + +import java.util.HashMap; + +public class Road { + HashMap buildCost; + + public Road() { + buildCost = new HashMap<>(); + buildCost.put(Config.Resource.BRICK,1); + buildCost.put(Config.Resource.LUMBER,1); + } +} From 456ea5356f0b8e71ec4dee95433493ecf36af2e3 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 10:43:04 +0100 Subject: [PATCH 02/68] Settlement.java and changes SiedlerGame buildRoad Method --- src/ch/zhaw/catan/Road.java | 6 +++++- src/ch/zhaw/catan/Settlement.java | 20 ++++++++++++++++++++ src/ch/zhaw/catan/SiedlerGame.java | 13 ++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/ch/zhaw/catan/Settlement.java diff --git a/src/ch/zhaw/catan/Road.java b/src/ch/zhaw/catan/Road.java index 24025c5..92ac502 100644 --- a/src/ch/zhaw/catan/Road.java +++ b/src/ch/zhaw/catan/Road.java @@ -3,11 +3,15 @@ package ch.zhaw.catan; import java.util.HashMap; public class Road { - HashMap buildCost; + private HashMap buildCost; public Road() { buildCost = new HashMap<>(); buildCost.put(Config.Resource.BRICK,1); buildCost.put(Config.Resource.LUMBER,1); } + + public HashMap getBuildCost() { + return buildCost; + } } diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java new file mode 100644 index 0000000..289e9e8 --- /dev/null +++ b/src/ch/zhaw/catan/Settlement.java @@ -0,0 +1,20 @@ +package ch.zhaw.catan; + +import java.util.HashMap; + +public class Settlement { + private HashMap buildCost; + + public Settlement() { + buildCost = new HashMap<>(); + buildCost.put(Config.Resource.LUMBER,1); + buildCost.put(Config.Resource.BRICK,1); + buildCost.put(Config.Resource.GRAIN,1); + buildCost.put(Config.Resource.WOOL,1); + } + + public HashMap getBuildCost() { + return buildCost; + } + +} diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 48405eb..695b23a 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -212,7 +212,18 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildRoad(Point roadStart, Point roadEnd) { - // TODO: Implement + //1. Check if Edge + if(!board.hasEdge(roadStart,roadEnd)){ + // TODO: Error message + } + //2. Check if Edge is empty + if(board.getEdge(roadStart,roadEnd) != null) { + // TODO: Error message + } + //3. Can Player build road + // TODO + + return false; } From 5e8db04f0da10907c24efdc6042f0f62ed6fadb3 Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Fri, 26 Nov 2021 10:58:19 +0100 Subject: [PATCH 03/68] Added new class player. --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Player.java | 20 ++++++++++++++++++++ src/ch/zhaw/hexboard/HexBoardTextView.java | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/ch/zhaw/catan/Player.java diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..6bc01a8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java new file mode 100644 index 0000000..63490f3 --- /dev/null +++ b/src/ch/zhaw/catan/Player.java @@ -0,0 +1,20 @@ +package ch.zhaw.catan; + +import java.util.ArrayList; + +/** + * New Class PLayer + * This class is here to add players to the game. + * @author: Stefan Amador + */ +public class Player { + + private String name; + private Config.Faction faction; + private Config.Resource resource; + + public Player (String name, Config.Faction faction){ + this.name = new name(" "); + + } +} diff --git a/src/ch/zhaw/hexboard/HexBoardTextView.java b/src/ch/zhaw/hexboard/HexBoardTextView.java index 97c51af..b3eeb98 100644 --- a/src/ch/zhaw/hexboard/HexBoardTextView.java +++ b/src/ch/zhaw/hexboard/HexBoardTextView.java @@ -98,7 +98,7 @@ import java.util.Map; public class HexBoardTextView { private static final String ONE_SPACE = " "; - private static final String TWO_SPACES = " "; + private static final String TWO_SPACES = " "; private static final String FOUR_SPACES = " "; private static final String FIVE_SPACES = " "; private static final String SIX_SPACES = " "; From 3adec5bd43c20470d1890558e80f8cd360a9bbc2 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 26 Nov 2021 11:25:56 +0100 Subject: [PATCH 04/68] changed Datatype of Road and Settlement in SiedlerBoard --- .idea/misc.xml | 2 +- .../ch/zhaw/catan/Dummy$1.class | Bin 702 -> 702 bytes .../ch/zhaw/catan/Dummy$Actions.class | Bin 1113 -> 1113 bytes .../ch/zhaw/catan/Dummy.class | Bin 3788 -> 0 bytes .../ch/zhaw/catan/SiedlerBoard.class | Bin 5365 -> 5365 bytes .../ch/zhaw/catan/SiedlerGame.class | Bin 2740 -> 2740 bytes src/ch/zhaw/catan/Dummy.java | 5 ++--- src/ch/zhaw/catan/Road.java | 4 +++- src/ch/zhaw/catan/Settlement.java | 4 +++- src/ch/zhaw/catan/SiedlerBoard.java | 2 +- 10 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class diff --git a/.idea/misc.xml b/.idea/misc.xml index 6bc01a8..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class index 8567a9baf96bfafe29eaf344e89d39a5ee1dcf7d..f4062e0543dd7a05698bdfc914692770f987eff1 100644 GIT binary patch delta 23 fcmdnTx{sCP)W2Q(7#J9AH*%yiF{({2VDbY1X~qYr delta 23 fcmdnTx{sCP)W2Q(7#J9AHgcphF{)24VDbY1X}|}l diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$Actions.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$Actions.class index 0d99f9f2a2000f589248dd6620c2a76c84bb5e38..3410db753ca6458025bf856739f3d98ae36bec03 100644 GIT binary patch delta 17 Zcmcb~ag&4N)W2Q(7#J9AH*y5B002Xf237z7 delta 17 Zcmcb~ag&4N)W2Q(7#J9AHgW{A002Xa22}t6 diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class deleted file mode 100644 index 09c27a7c753f40354200852b54a7f35916c4c323..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3788 zcmb7H`F9&v75<*Jj4V&$Eq0=;imN1+Q%6ZlO>LPtt`{mQ+r>5xPH15)P2@?W88aTm zaamfREiG%<2}{`tP?k0nJFZC@plk)sfzx03TR0rT_hzJ6@=}V@`foIVs?4k57dWLalUO~}wYP8h9-NM?2m1lm)n_*5=duq7G$qy1;!~VBX^-D7{b&0e# zqvyluMz74%+hm>w2I5n7=))-m{VE>7fWWpjOyW_>b44oq{!%QJtZt+uzHv&ykU(46 zmyLpwik~v{g)j#3cInrH0tedH$)Hk!Os4es9V#9|no7`3$6lP!>0=|+z2-cpl64rx zn1Y8@yc6S9p}7k}hNIgWtB-6|txc8Y2{4IwDVS1m8t-Nv*5Jz~O!%xeKguZFsy`!F zoKbNW?-B5u?(~i_b|rZV9u;U_!z0(RAsI>?9>M!mXc8dE3Vuj;r!p$Caw^2BDJ@^r zC1K}O0`RG*nB1jMm~jE-1*WD8LkGDI0qE8Y~tHi?I^| zhhq~9hLe#(i)ChGvPZ;RlbC1HpOMm>r+&|-6i_^SHUlbIg<)e}fuo{`i{xSxQvsFX z4w=P*8?r!e`<897LV5#vZGJvkDMksw24dloibXueq*->>>xpdDDaqvrReT5^Cc%z1 z;n;?m6R1v{H%m!8fsZKosEUu_Nr8Qvw%>9;)Spj&eOtwMBsD&}$Tax} ztSp;%ecCYf(PDuo_M|qG=S)-D%4qp1%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epuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class index 4b09bb65402dd24f0cfd33458b3c5225c21edf2f..f7ba4520ee5d7b545b75ff95dac0d51cdc8721f3 100644 GIT binary patch delta 17 ZcmeyW`BjtS)W2Q(7#J9AH*&lc0RT)k2Ydhk delta 17 ZcmeyW`BjtS)W2Q(7#J9AHgdcb0RT)f2YUbj diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class index 984b723de228b39a84169066dc321ebf4c79e9df..ff2127d863743b275b372464eff3463c4572bb64 100644 GIT binary patch delta 45 zcmV+|0Mh@o6|@xy%Ko~(0000zu?Uw50oaqE2~7d%lQ0MulLZPk0rQhQ3ONA-lXeO| Dd<_oL delta 45 zcmV+|0Mh@o6|@xy%Ko~(0000yu?Uw50ojwF2~7d&lQ0MulLZPk0rZnR3ONA;lXeO| Dd@K&t diff --git a/src/ch/zhaw/catan/Dummy.java b/src/ch/zhaw/catan/Dummy.java index fdcab53..e9eb5db 100644 --- a/src/ch/zhaw/catan/Dummy.java +++ b/src/ch/zhaw/catan/Dummy.java @@ -15,15 +15,14 @@ public class Dummy { SHOW, QUIT } - private void run() { TextIO textIO = TextIoFactory.getTextIO(); TextTerminal textTerminal = textIO.getTextTerminal(); SiedlerBoard board = new SiedlerBoard(); board.addField(new Point(2, 2), Land.FOREST); - board.setCorner(new Point(3, 3), "RR"); - board.setEdge(new Point(2, 0), new Point(3, 1), "r"); + board.setCorner(new Point(3, 3), new Settlement(Config.Faction.RED)); + board.setEdge(new Point(2, 0), new Point(3, 1), new Road(Config.Faction.BLUE)); board.addFieldAnnotation(new Point(2, 2), new Point(3, 1), "AA"); Map lowerFieldLabel = new HashMap<>(); diff --git a/src/ch/zhaw/catan/Road.java b/src/ch/zhaw/catan/Road.java index 92ac502..360e794 100644 --- a/src/ch/zhaw/catan/Road.java +++ b/src/ch/zhaw/catan/Road.java @@ -4,8 +4,10 @@ import java.util.HashMap; public class Road { private HashMap buildCost; + private Config.Faction faction; - public Road() { + public Road(Config.Faction faction) { + this.faction = faction; buildCost = new HashMap<>(); buildCost.put(Config.Resource.BRICK,1); buildCost.put(Config.Resource.LUMBER,1); diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java index 289e9e8..6e11e5d 100644 --- a/src/ch/zhaw/catan/Settlement.java +++ b/src/ch/zhaw/catan/Settlement.java @@ -4,8 +4,10 @@ import java.util.HashMap; public class Settlement { private HashMap buildCost; + private Config.Faction faction; - public Settlement() { + public Settlement(Config.Faction faction) { + this.faction = faction; buildCost = new HashMap<>(); buildCost.put(Config.Resource.LUMBER,1); buildCost.put(Config.Resource.BRICK,1); diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index b073e13..502d852 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -8,7 +8,7 @@ import java.awt.*; import java.util.*; import java.util.List; -public class SiedlerBoard extends HexBoard { +public class SiedlerBoard extends HexBoard { Map lowerFieldLabel = new HashMap<>(); From aef0479cf57d126eb8fb35a226d18b0d77b32ef2 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 11:41:00 +0100 Subject: [PATCH 05/68] Player created --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Player.java | 47 ++++++++++++++++++++++++++++-- src/ch/zhaw/catan/Siedler.java | 2 ++ src/ch/zhaw/catan/SiedlerGame.java | 9 +++++- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 63490f3..965f7fd 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -1,6 +1,6 @@ package ch.zhaw.catan; -import java.util.ArrayList; +import java.util.HashMap; /** * New Class PLayer @@ -11,10 +11,51 @@ public class Player { private String name; private Config.Faction faction; - private Config.Resource resource; + private HashMap resources; + private int roadsToUse; + private int settlementsToUse; public Player (String name, Config.Faction faction){ - this.name = new name(" "); + //Datenfelder + this.name = name; + this.faction = faction; + roadsToUse = Config.Structure.ROAD.getStockPerPlayer(); + settlementsToUse = Config.Structure.SETTLEMENT.getStockPerPlayer(); + //Ressourcen initialisiern + resources = new HashMap<>(); + for(Config.Resource resource : Config.Resource.values()) { + resources.put(resource,0); + } } + + /** + * This method returns all the resources the player has at the moment + * @return HashMap + */ + public HashMap getResources() { + return resources; + } + + + public boolean buildRoad() { + if (roadsToUse > 0) { + roadsToUse--; + return true; + } + return false; + + } + + + public boolean buildSettlement() { + if (settlementsToUse > 0) { + settlementsToUse--; + return true; + } + return false; + } + + + } diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 9c3ea12..7610db4 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -16,5 +16,7 @@ public class Siedler { TextTerminal textTerminal = textIO.getTextTerminal(); textTerminal.println(game.getBoard().getTextView()); + + } } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 695b23a..b76c075 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -24,7 +24,9 @@ public class SiedlerGame { static final int FOUR_TO_ONE_TRADE_OFFER = 4; static final int FOUR_TO_ONE_TRADE_WANT = 1; - SiedlerBoard board; + private SiedlerBoard board; + private Player[] allPlayers; + private int winPoints; /** * Constructs a SiedlerGame game state object. @@ -38,6 +40,8 @@ public class SiedlerGame { public SiedlerGame(int winPoints, int numberOfPlayers) { board = new SiedlerBoard(); board.createFixGamefield(); + allPlayers = new Player[numberOfPlayers]; + this.winPoints = winPoints; } /** @@ -69,6 +73,9 @@ public class SiedlerGame { */ public List getPlayerFactions() { // TODO: Implement + Faction[] factions = new Faction[allPlayers.length]; + + return Collections.emptyList(); } From fcf8c842fbf0ee239e896ce1879a3a9f66dd7a2a Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 26 Nov 2021 11:41:06 +0100 Subject: [PATCH 06/68] getLandsForCorner method created. --- src/ch/zhaw/catan/SiedlerBoard.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index b073e13..cb52d1e 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -94,7 +94,22 @@ public class SiedlerBoard extends HexBoard { * @return the list with the adjacent {@link Land}s */ public List getLandsForCorner(Point corner) { - //TODO: Implement. - return Collections.emptyList(); + Point above = new Point(corner.x, corner.y + 2); + Point below = new Point(corner.x, corner.y -2); + Land[] lands = new Land[3]; + if (hasField(above)) { + lands[0] = getField(above); + lands[1] = getField(new Point(corner.x + 1, corner.y - 1)); + lands[2] = getField(new Point(corner.x - 1, corner.y - 1)); + } + else if (hasField(below)) { + lands[0] = getField(below); + lands[1] = getField(new Point(corner.x + 1, corner.y + 1)); + lands[2] = getField(new Point(corner.x - 1, corner.y + 1)); + } + else { + return Collections.emptyList(); + } + return Collections.unmodifiableList(Arrays.asList(lands)); } } From 98316bb566e9c4616b677216bd94e4668d6d47b9 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 26 Nov 2021 11:44:22 +0100 Subject: [PATCH 07/68] changed Datatype of Road and Settlement in SiedlerBoardTextView --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/SiedlerBoardTextView.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/SiedlerBoardTextView.java b/src/ch/zhaw/catan/SiedlerBoardTextView.java index 68836b1..11a4ed5 100644 --- a/src/ch/zhaw/catan/SiedlerBoardTextView.java +++ b/src/ch/zhaw/catan/SiedlerBoardTextView.java @@ -6,7 +6,7 @@ import ch.zhaw.hexboard.Label; import java.awt.*; -public class SiedlerBoardTextView extends HexBoardTextView { +public class SiedlerBoardTextView extends HexBoardTextView { public SiedlerBoardTextView(SiedlerBoard board) { super(board); From bfb1433fd244d5b1a817e95775a3e4392253fa2c Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 12:15:18 +0100 Subject: [PATCH 08/68] Player added methods and javadoc --- src/ch/zhaw/catan/Player.java | 73 +++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 965f7fd..9dc99f1 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -1,6 +1,7 @@ package ch.zhaw.catan; import java.util.HashMap; +import java.util.List; /** * New Class PLayer @@ -31,31 +32,79 @@ public class Player { /** * This method returns all the resources the player has at the moment - * @return HashMap + * @return HashMap with the count of every resource */ public HashMap getResources() { return resources; } + /** + * This method adds a specific resource to resourcess + * @param resource to add + * @param numberToAdd how much to add + */ + public void addResource(Config.Resource resource, int numberToAdd) { + resources.put(resource, resources.get(resource) + numberToAdd); + } + /** + * This method substracts a specific resource from resourcess but check first if player has enough resources. + * @param resource to substract + * @param numberToTake how much to substract + * @return true if resource has been substracted false if player has not enough resources + */ + public boolean substractResource(Config.Resource resource, int numberToTake) { + int inPossesion = resources.get(resource); + if(inPossesion - numberToTake < 0) { + return false; + } + resources.put(resource,inPossesion - numberToTake); + return true; + } + + /** + * This method has to be used when a player wants to build a road. It checks if a player has enough roads + * and resources to build one more. If player is able to build, the method substract the buildcost from the resources + * in possesion by the player. + * @return true if road can be created false if road can't be created + */ public boolean buildRoad() { - if (roadsToUse > 0) { - roadsToUse--; - return true; + List costs = Config.Structure.ROAD.getCosts(); + if ( roadsToUse == 0 || !checkRessourceToBuild(costs)) { + return false; } - return false; - + for (Config.Resource resource : costs) { + resources.put(resource,resources.get(resource)-1); + } + return true; } - + /** + * This method has to be used when a player wants to build a settlement. It checks if a player has enough roads + * and resources to build one more. If player is able to build, the method substract the buildcost from the resources + * in possesion by the player. + * @return true if road can be created false if road can't be created + */ public boolean buildSettlement() { - if (settlementsToUse > 0) { - settlementsToUse--; - return true; + List costs = Config.Structure.SETTLEMENT.getCosts(); + if ( settlementsToUse == 0 || !checkRessourceToBuild(costs)) { + return false; } - return false; + for (Config.Resource resource : costs) { + resources.put(resource,resources.get(resource)-1); + } + return true; } - + //returns true if player has enough resources else false + private boolean checkRessourceToBuild(List liste) { + for (Config.Resource resource : liste) { + int possesion = resources.get(resource); + if (possesion == 0) { + return false; + } + } + return true; + } } From 5e0ebedfeabd15768f17e734dfdb7aa05d568d2e Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 12:21:57 +0100 Subject: [PATCH 09/68] Player added methods and javadoc --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Player.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 9dc99f1..7fafac1 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -6,7 +6,6 @@ import java.util.List; /** * New Class PLayer * This class is here to add players to the game. - * @author: Stefan Amador */ public class Player { From 9a79bf0cf4c59df4b7a228fcaa9334bb3ea65720 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 26 Nov 2021 12:32:26 +0100 Subject: [PATCH 10/68] Player added methods and javadoc --- src/ch/zhaw/catan/Player.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 7fafac1..4eb49b8 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -37,6 +37,19 @@ public class Player { return resources; } + /** + * This method returns player faction + * @return + */ + public Config.Faction getFaction() { return faction; } + + /** + * This method returns for specific resource how much player possesess. + * @param resource + * @return + */ + public int getSpecificResource(Config.Resource resource) { return resources.get(resource); } + /** * This method adds a specific resource to resourcess * @param resource to add From e99e6ec87e67549cf570a20b983ada4c2164118f Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 26 Nov 2021 15:27:25 +0100 Subject: [PATCH 11/68] modified createFixGamefield method and deleted now depreciated method that where used by it --- .../ch/zhaw/catan/SiedlerBoard.class | Bin 5365 -> 5103 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class index f7ba4520ee5d7b545b75ff95dac0d51cdc8721f3..6c4569cce1198fe84429bca1e8ffcd858ed1ad9d 100644 GIT binary patch literal 5103 zcmb7IiGNhp75?6AFPS{Z0*MSzMVi25fgoUz1Os6JGi4Gfp}`Qfyv#h3fyul$^Fk7> zwY6&ZMZ40)TDqi*ZLwlVM5v{9(YAK8YHR88U-+{X`rZ59yqU=atiNRP?%aFMx#xW6 zJLkTe7cM=09>C4`cMu+URroac5l|3{kF?%BqEEDr7?VS$o=LQJ8#gHfGS%9xXGePUu^?1<%TWPM#Uc%hQK?{g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PTKldn8n$2~K|!?MBuJkRp_C`TcD19cqp)Xcw+(Q+%o(kI?| z4o2riSh;hke-W|gr1#_eE6&5H$>?oHa=598b8+O8=K{F}91lc?<(v#LXJKZh!K$db>ZvQavmx(Bl+8u;Tpc+s>ERSv-!LCiIm*TN(DUQG+HQ5dzUM63dEb>Z)nG$1q6Rl5qiV1zX>l;W3P)|i{IR&G@zYCBR}mGNZgA$$u@ z!7#3bPT<=dg+l$te=)~VIP|FT2)@IS8E!LHxw5bL^tEg}2_JBC>J&htn;%_kv7@VC(Q+=y?GxUN;R^cKqbcp5)o%w@#; z41UO22A;)ko#hg}O-4yy#J(K2>2yY z3|$WR)k#=qanIZv|6p^9&oY=Pfwl5Y0Cc0CAJ<*jz>n2l?BQqi8CnI%E<$?_&r7&z z4YwY<@FToHa4*tJybYAsS$dtLWf?-R;VKLJER4U(XCd*sf-dDTzAG&HZ0R2ExxCp7 zZ;rG?TFfWV(bE#y*cavd$IT_9;f-feN=8j_Ifn`%AA2BT%)RkPw6~%S=h4hmOcZdug=DQJ3}F-94N0(#2)&Ma3ojYQE94<0euPk1jZNxp zhPee;Prnt`WHdtL_npQ2`>dpO**t@dqG3zcb`d*r@f(v?c+)w2UJ#$QnzlO*(r93&#gLxShpB`X?*UDe|66bwoP{R4pulqX=T~{QPwcV%Ep8K zcd-hwp2V6N2r3!CPw_Ltt0MzHhk)kGS6O~Zi;!;spb=cZqA>aXz| z-iuSyR^EwI5l;$V72wn|7iTJ9LIP=3&x7 Date: Sat, 27 Nov 2021 01:45:14 +0100 Subject: [PATCH 12/68] =?UTF-8?q?Bank=20Klasse=20erstellt=20(wird=20warsch?= =?UTF-8?q?einlich=20wieder=20entfernt=20da=20Funktionalit=C3=A4t=20in=20S?= =?UTF-8?q?iedlerGame=20sein=20soll)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ch/zhaw/catan/Bank.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ch/zhaw/catan/Bank.java diff --git a/src/ch/zhaw/catan/Bank.java b/src/ch/zhaw/catan/Bank.java new file mode 100644 index 0000000..6b498c4 --- /dev/null +++ b/src/ch/zhaw/catan/Bank.java @@ -0,0 +1,36 @@ +package ch.zhaw.catan; + +import java.util.Map; + +public class Bank { + private Map resources; + + public Bank(){ + resources = Config.INITIAL_RESOURCE_CARDS_BANK; + + } + + public boolean getResourceFromBank(Config.Resource resource,int numberOfResources) { + if(resources.get(resource) >= numberOfResources) { + Integer newResourceNumber = resources.get(resource) - numberOfResources; + resources.put(resource, newResourceNumber); + return true; + } + else { + return false; + } + } + + public boolean tradeWithBank(Config.Resource resourceToReceive, Config.Resource resourceToGive) { + if(resources.get(resourceToReceive) >= 1){ + Integer newResourceReceived = resources.get(resourceToReceive) + 4; + Integer newResourcesGiven = resources.get(resourceToGive) - 1; + resources.put(resourceToReceive, newResourceReceived); + resources.put(resourceToGive, newResourcesGiven); + return true; + } + else{ + return false; + } + } +} From c4c30670b411774a813c90b0be96099251648412 Mon Sep 17 00:00:00 2001 From: leobr Date: Sat, 27 Nov 2021 02:13:55 +0100 Subject: [PATCH 13/68] finished Method tradeWithBankFourToOne Modified Class Bank to work with mentioned Method --- src/ch/zhaw/catan/Bank.java | 8 ++++---- src/ch/zhaw/catan/SiedlerGame.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ch/zhaw/catan/Bank.java b/src/ch/zhaw/catan/Bank.java index 6b498c4..0eedb95 100644 --- a/src/ch/zhaw/catan/Bank.java +++ b/src/ch/zhaw/catan/Bank.java @@ -21,10 +21,10 @@ public class Bank { } } - public boolean tradeWithBank(Config.Resource resourceToReceive, Config.Resource resourceToGive) { - if(resources.get(resourceToReceive) >= 1){ - Integer newResourceReceived = resources.get(resourceToReceive) + 4; - Integer newResourcesGiven = resources.get(resourceToGive) - 1; + public boolean tradeWithBank(Config.Resource resourceToReceive, Config.Resource resourceToGive, int toWant, int toGive) { + if(resources.get(resourceToReceive) >= toWant){ + Integer newResourceReceived = resources.get(resourceToReceive) + toGive; + Integer newResourcesGiven = resources.get(resourceToGive) - toWant; resources.put(resourceToReceive, newResourceReceived); resources.put(resourceToGive, newResourcesGiven); return true; diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index b76c075..a0d6431 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -27,7 +27,7 @@ public class SiedlerGame { private SiedlerBoard board; private Player[] allPlayers; private int winPoints; - + private Bank bank; /** * Constructs a SiedlerGame game state object. * @@ -38,6 +38,7 @@ public class SiedlerGame { * three or players is not between two and four */ public SiedlerGame(int winPoints, int numberOfPlayers) { + bank = new Bank(); board = new SiedlerBoard(); board.createFixGamefield(); allPlayers = new Player[numberOfPlayers]; @@ -248,7 +249,7 @@ public class SiedlerGame { */ public boolean tradeWithBankFourToOne(Resource offer, Resource want) { // TODO: Implement - return false; + return bank.tradeWithBank(want,offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); } /** From 30617ff6558bc7ef1ddb21af2b38b3a86785711d Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 26 Nov 2021 15:27:25 +0100 Subject: [PATCH 14/68] createFixGamefield method finished and removed depreciated code --- .../ch/zhaw/catan/SiedlerBoard.class | Bin 5103 -> 6030 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class index 6c4569cce1198fe84429bca1e8ffcd858ed1ad9d..8224b170d2079d65be8977729532b87612123adc 100644 GIT binary patch literal 6030 zcmb7Idwd*K75-*-b|=|PnoZgSHl;jjTJmTKl+r@dSDL2nN|Hi0q-=}YNp{+7yV(u9 zlQu;WAD|WAib@5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M-cSNYu1 z(!1__o6p%WyPBGTe{d#IPIBV=sP-m_)goz=W|3 z=SdA8B@g1KWSF1w`|vYdAcS!o!O!I?0d#WUqmAceX_w&_{HY||fcpa}Id5|JsL!QCq!L$D>}o5A}JPG5elC0{?+1N!?9+Z)7#f$hoUCR|y8JYYd{=gX#YbCsI;u;ke z+&W!ypl=bmb+SFvS4)@>MR~U z74psEi?jHeK;5o=o4LnWswsBpQSv9vmSvK|W6Z-{?9N$YYvEyxlYz&H Date: Sun, 28 Nov 2021 01:12:08 +0100 Subject: [PATCH 15/68] createFixGamefield method finished and removed depreciated code --- .../ch/zhaw/catan/SiedlerBoard.class | Bin 6030 -> 4543 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class index 8224b170d2079d65be8977729532b87612123adc..dc80280007e69ffe96ef86cda869944592454fec 100644 GIT binary patch literal 4543 zcma)9`*&Pb75>h=ZZf%fwn;msQiy4qNzx8tK$^t1$&}EMNm81ck_53gGdIaJlbLwu zrb&?cKtb@0Z+s#m@qtpbtiY5mT>LT9+DtLmi zJffEz!>OJs+=QDIG^=mYS;1`rHI}WmXogOv6Dd=geL%$>(yW4Jqgrx7SI}LcAUoT3ep+No{FFtn zO3_h56*#g-FWOr**@Rqv%%=#&Ker=@HXNq^O4C znC)2#X#jUAIH4kf4++#+5m{i_ZB=GEJfj(XhM_H!zqa5+SZ<1{7{n0yNb0F+bH-vi zqTnR+mK9^JTr3g$F^p5PqDBO~ZQ*cmRLbbXDn@aJyXO~}tvj5s3&SiEcyn&Dj`B%l9+|Hk!~E z{m>AX@#+Hm+M?TU=n0NW+i4XuNKnuj-HdLn|Bg~UWC4p=cEI`-uxk`(*-BqDkum+4 zg>4Ts!Kgvm*q z?;i)gK6_m5O~g%dz2Ld2IK<`oY?%G!eA}MZl1|+tneG1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Fcdl+*AotPK674^YJGz4$PX~7o|(*tPKBbcw(;S7B~7U)elQ(ua+^c7erTh)Nu zj@(wI-5IzECvXy)_HbYl4|5aBOC<-w`#ZGD;(*;Mr{GU%29}RZpYU+3e(zZ zJj#*5X2=u1YMxi}SCF1Iv_61H+cB&R5NvfH17CX--FI^)fMN?>%tm~!^y_SQm1?0} zkFVn!#GFHaAHz4fO2fCXURgOoZJk*0ytZh=dAtT_#|B+l_Xm(G2UTH^C4kH%}>*8?)1-iWV`j9sD@{^)M zg3|Fi$;fiLcM;uP&dZaP(&<*p8_dL&!vS1Jc=Q1YSa=fgfwy z^W-5Qu6JBtwdL;H3{%s5J@{(A#=;?be$8RLvBQWNC-p;ECK5JlY{#)W89hH{1eYJd zTaV%TAhu57f>Wvs<(Q!t7f5b)7P(m{sveh+hYoVX>m&Zx&HBw_Ee=tB7b{C7csY~5 ziuVnV;R%M?fE)1>#oCn5+LX`Q6rS{1i$V8Tdl91sq6VJ&7nVLxK#iOBXXH_wEgt1l z)K}MW9N@9y#y+=h->vGlpQS15b|D9{ZtV`eRdk8>%|C?55;6MF)~T1DUQ#UBMw!*i z8Q}m+E5Ym!GKL{Ww$;yn8>0~WN$i;}Kawu|oLhw7y=35N{DQ7|Rh*w&Sfw3!m z;vo8CdQc2M`3Pc(n6Ar`7YOj5g>9|utR5tXuLLRF@@Hp2mds9p zFM&_r6XW^k^G9*7VBOtqD|qw+EMC+M^Okgkn!#(8_!Bh)_%r?@R|I&M`d9pYU5vM67vmq{%KrlBu;T&% From b30a01956616c9f1dafcf4b1c36194ebc1fbdad7 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Sun, 28 Nov 2021 01:14:34 +0100 Subject: [PATCH 16/68] createFixGamefield method finished and removed depreciated code --- src/ch/zhaw/catan/SiedlerBoard.java | 51 +++++++++-------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 1466d52..361df74 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -13,24 +13,22 @@ public class SiedlerBoard extends HexBoard { Map lowerFieldLabel = new HashMap<>(); public void createFixGamefield(){ - Integer[][] waterCoordinates = {{4,2},{6,2},{8,2},{10,2},{3,5},{11,5},{2,8},{12,8},{1,11}, - {13,11},{2,14},{12,14},{3,17},{11,17},{4,20},{6,20},{8,20},{10,20}}; - Integer[][] desertCoordinates = {{7,11}}; - Integer[][] forestCoordinates = {{5,5,6},{10,8,10},{3,11,5},{8,14,3}}; - Integer[][] hillCoordinates = {{5,11,9},{5,17,8},{9,17,11}}; - Integer[][] fieldCoordinates = {{4,8,2},{8,8,5},{11,11,9},{4,14,10}}; - Integer[][] pastureCoordinates = {{7,5,3},{9,5,8},{10,14,12},{7,17,4}}; - Integer[][] mountainCoordinates = {{6,8,4},{9,11,6},{6,14,11}}; - - placeFieldWithoutLabel(Land.WATER, waterCoordinates); - placeFieldWithoutLabel(Land.DESERT, desertCoordinates); - placeFieldWithLabel(Land.FOREST, forestCoordinates); - placeFieldWithLabel(Land.HILLS, hillCoordinates); - placeFieldWithLabel(Land.FIELDS, fieldCoordinates); - placeFieldWithLabel(Land.PASTURE, pastureCoordinates); - placeFieldWithLabel(Land.MOUNTAIN, mountainCoordinates); - + Map resourcePlacement = Config.getStandardLandPlacement(); + Map dicePlacement = Config.getStandardDiceNumberPlacement(); + for (Map.Entry resourceField : resourcePlacement.entrySet()) { + addField(resourceField.getKey(),resourceField.getValue()); + } + for (Map.Entry diceField : dicePlacement.entrySet()) { + String numberAsString = diceField.getValue().toString(); + char[] numbersInChar = numberAsString.toCharArray(); + if (numberAsString.length() < 2) { + lowerFieldLabel.put(diceField.getKey(), new Label('0', numbersInChar[0])); + } + else { + lowerFieldLabel.put(diceField.getKey(), new Label(numbersInChar[0],numbersInChar[1])); + } + } } @@ -48,23 +46,6 @@ public class SiedlerBoard extends HexBoard { return view.toString(); } - private void placeFieldWithoutLabel(Land fieldType, Integer[][] fieldCoordinates) { - for(Integer[] coordinates : fieldCoordinates) { - addField(new Point(coordinates[0], coordinates[1]), fieldType); - } - } - private void placeFieldWithLabel(Land fieldType, Integer[][] fieldInformation) { - for(Integer[] information : fieldInformation) { - addField(new Point(information[0], information[1]), fieldType); - char[] label = information[2].toString().toCharArray(); - if (label.length == 1) { - lowerFieldLabel.put(new Point(information[0], information[1]), new ch.zhaw.hexboard.Label('0', label[0])); - } else { - lowerFieldLabel.put(new Point(information[0], information[1]), new Label(label[0], label[1])); - } - } - } - //TODO: Add fields, constructors and methods as you see fit. Do NOT change the signature // of the methods below. @@ -110,6 +91,6 @@ public class SiedlerBoard extends HexBoard { else { return Collections.emptyList(); } - return Collections.unmodifiableList(Arrays.asList(lands)); + return List.of(lands); } } From 8fb406bea0f7aa336408f5a473f738130ce51ee8 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Sun, 28 Nov 2021 01:42:33 +0100 Subject: [PATCH 17/68] Delete out directory --- .../ch/zhaw/catan/Config$Faction.class | Bin 1465 -> 0 bytes .../ch/zhaw/catan/Config$Land.class | Bin 2136 -> 0 bytes .../ch/zhaw/catan/Config$Resource.class | Bin 1530 -> 0 bytes .../ch/zhaw/catan/Config$Structure.class | Bin 2969 -> 0 bytes .../ch/zhaw/catan/Config.class | Bin 3892 -> 0 bytes .../ch/zhaw/catan/Dummy$1.class | Bin 702 -> 0 bytes .../ch/zhaw/catan/Dummy$Actions.class | Bin 1113 -> 0 bytes .../ch/zhaw/catan/SiedlerBoard.class | Bin 4543 -> 0 bytes .../ch/zhaw/catan/SiedlerBoardTextView.class | Bin 681 -> 0 bytes .../ch/zhaw/catan/SiedlerGame.class | Bin 2740 -> 0 bytes .../ch/zhaw/hexboard/Edge.class | Bin 2689 -> 0 bytes .../zhaw/hexboard/FieldAnnotationPosition.class | Bin 2239 -> 0 bytes .../ch/zhaw/hexboard/HexBoard.class | Bin 12025 -> 0 bytes .../ch/zhaw/hexboard/HexBoardTextView.class | Bin 8235 -> 0 bytes .../ch/zhaw/hexboard/Label.class | Bin 1235 -> 0 bytes 15 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$Actions.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class delete mode 100644 out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class deleted file mode 100644 index a9c9a44e6bb763d39b275dcbf6f35d961bad970d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1465 zcmah|X-^Yj5PsfXyDW=fITYlOLut!VKv1!Wg;FjnBvfk}KbUP@%9658+ARiul@=AE z(eT+HWt@4tY6XJ(VP|LdnP=`FKfinjuz)QE9)aHcUi96b@iv+_9K((#O7^Z*7+E#) zj#aXoAmG#CM?k>4lUxz#PhEwNv4g6ki5+~)sTWB$H0#jW;9uKGCb!sfO-CzR0@-9L zwf&M!*L4KZE})ELmdGzHF!1W?SQs=2)@Fc)g@P85wwCDvd_J7vo*#2O z+B>IIZ}Ryaa9dA^g?!PSjW-k~m#K!%@f;Vf&T%m&pruRIa^76ExX$MKxlHmp5&f1~ zan?%}N5NCd;j%*!&^K(`EX&0*sW8R8wD>fQqlfM?5bx%D14z;tNlDiuCEW}mJiIzU zTMr)$dl2ps=E*-s+7L;8v>MtzqvH&n?@1GM?~LSsgM{zHV;4V5d~DT%B65oEGYH0e z{=qMjMX#gkvFSf;BfUA|I=t{PA~M!{f`Q1yCk%i1!*PxNg7OVu6wL^Mxw^=c8K1~{ z_=_v@B2HEhmMGFP5^jD`lANDE@)5)5QyZ6b_0;@zx;Bkh+I60ji2;4eH;Ama25&m+ zt3gR;{WY3oHc&%L`eJ`ntRU%9yryaJllV#u!BKB8bb`n+yi%R;1t+DdNOj5|oR+F4 z)q8>9tW;Z0asL=?+?4ttG}(Y5YVsgu7$>_2t5}nA9UD?^B1Mv~RA3X&;@!Uh6Lck1 diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class deleted file mode 100644 index a0e3700d37eb7ebebe102891270c75592f6aa796..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2136 zcmaJ>Yg1cg5PnXshw!$9v|wo|wG?ZTnnr4?)*x~VB{qwGk)mL z@ONmarK6+M&;BUKXWxX25J@IyvwL=*z3<=u{Qeh!2{iq185k;V$A8+ke~cIHrtQRM zYtB}sJeIbd%^n!=D0tyB;G556lUB~ajr9NOC&a*1=n(_|vuP`r&n89ItDxE-sbqT2 z647OaJ`tIVnfy|2I<+Lieua<-y$h*yTB}`E7|@c{>0B}^I`1f4(^zv!E1AuS=(@rU z4AbS<%5*xPvFn*&<-T3rD`mC}JPMz(o~_!AM&gvfYSt@GIdR&901!Wds2}$f zK0wUC&91f0mKwFadXX`j%~~7jY`7i#0ILyK_z>gl*hIytG$##&Pe;~KOm&HEMQZtx z!b3cwr~0weTit7U6qT;gC*t%|1B2asMKtnf3JFYbq8xjdsf5l)V8YwOdVHZUB_a6I z`Nf%JR&tsV_}Mc>K2GJrq9r0LCVB*SUg3%0dR8-;v?E<5N{!}1t-+)AJ-4GK8vj>p!nrX@lrYX;sro2>|@;+(Gt3*qetdFJ~b|83NP7`^~Ailvm@xLWE zN-Cc~3q!AQ^DRbxA!pzPpFaI=nfiBOck~|;S1bY{Bl-rTZ()eO>p%J%l&H3rESi4L zrJC)v5N zNvR7Z{&;FS9+oK=5B>CTh>xQN(Z$8%6Bi+^uuiZ%dRdMjLpyQPf9$4TCvfCui%Ic1 zc1jT^l~Q=4ukiS66^a_JT?KCk&OjO4U5p=`HQqgM91O@hcZ^dydSE>0{}V>R-GbXH zcv|pV1#gR^S@5-R$tw6;2wDZRg)3GeNYS8mzPBbS*y+Ij%t@2a{vQMleNNcPLrfpQ zt@$}RNNV1%`31U4X+EI&G(9Y8{*vaO(fzXKgPPBop*(wifGe6^4f;Y~X@2kxo*!UH sn$w=UcK@^NsD&DqnQXhu-=Rt!7k1%jTEh>dAxaGD)wv-N(#F)#zhuO)3IG5A diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class deleted file mode 100644 index 82c496d4a344d4551e973a178c0d2b1feb11773f..0000000000000000000000000000000000000000 GIT binary patch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{Qv@LVdT~e`4x3!z2EIwFmo(1P@0}4`z%wN8AbAH}nco`eA?zS7(t4iOZ_|2#*6)n;d;%lG Bnv?(l diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy$1.class deleted file mode 100644 index f4062e0543dd7a05698bdfc914692770f987eff1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmaJ;+iuf95Ivi?abjF*(w3$zg+Sdj;Q@q__!RNWK=7RF z;LU70{pi0Ixk_}#P`TjoOp?=VcTRgZq&};mikc0_#VxoDtJmc|WoY@~rOHLr=O26# z`G(mqnEn5lOQ+o$DZTAt2_AzL9u7|!wrq6Uj1>kuNykd_n4#S6bZy*a*qHDO z9>iRq1%o7G5;ygvl%w@<5pzPSJuVhLj5K zYY``z(r0~{N6FYmi(&biu9BvK%<{t|BYAFDYnkrFJj=|~?D-(QCQWC9=Fhx_nUC=( zat~W%?-QD!Odinw0e1Dv`3C!|`4_+Ajy3!Y>umwo2rd-x3-zmp6|7+u4Q!)Dwu}c< zp;FXop-Fy;)LPbD7Y!C=ySh7G&VTSnWt=3V}waM0D^siD# zglIH;_Kz~&_g2FUWLvVEci%bpo_pWf??2yv0ocGx6)}bh`^5Zw!atfe54mr?>NK05 z3fp$*27WsQhPaLd1}Iv42X7gss(tV!K}hOINy3|>%ArWy)1hOKK`qp_t4F&Q!}Pnp zRWxKUq+(FVFtQ8@+Y5Y$Ay+i2r~HhY9`_sOLH*RR!;*#^?yDHpF@^^W=^MbV-)U0Q zGwyYqgAWYr#UA#K$J^~vPr?dYuHPv2b`S+*{k)C|Ofn3VUEd8i8Af|cMa+s(OCq7s zy!j+jBF^fV!@QVVYG^ae6pj9qQ;&bx_)hSihR#%7-`Vdp>rU&C*FDOt+|k_VyHAE} zHL$r?<1JUzhziAh-lTfj+gqU54o_SXoU+`8&%;iOa7xjr(d(9NFWQ3HLlnCz_Z6{O zV$iIh)3Tk{u9!oUR$CSiMrHS%cDNU`LltWbBX@X=L9h6}(~>XekTx|k>DCJEI!BIH zw#J230gB{6U??w)M>h#N7cft_M|7H_C_dUbv~NgXBlCq$43Ft|K;ESZKZYj}eho31 z)v|2i3M1EG0w4PiU!;uQMZv&=yeH2PN_1R-LSH~#Se(4X_*Z$|+wO+0Vo^xPQ;As` z(u9X1AqL`<1%?wp!H$)4DAsZO9IAC&e-g`Bif9`VZT1JTvQx?>rZ1q#!^5~ds8^V| ofF^Wx*PxMb(7!N`G?BYnOgy7pjD~qG<0{rE3ZpZu;>FhZU-on4ng9R* diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class deleted file mode 100644 index dc80280007e69ffe96ef86cda869944592454fec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4543 zcma)9`*&Pb75>h=ZZf%fwn;msQiy4qNzx8tK$^t1$&}EMNm81ck_53gGdIaJlbLwu zrb&?cKtb@0Z+s#m@qtpbtiY5mT>LT9+DtLmi zJffEz!>OJs+=QDIG^=mYS;1`rHI}WmXogOv6Dd=geL%$>(yW4Jqgrx7SI}LcAUoT3ep+No{FFtn zO3_h56*#g-FWOr**@Rqv%%=#&Ker=@HXNq^O4C znC)2#X#jUAIH4kf4++#+5m{i_ZB=GEJfj(XhM_H!zqa5+SZ<1{7{n0yNb0F+bH-vi zqTnR+mK9^JTr3g$F^p5PqDBO~ZQ*cmRLbbXDn@aJyXO~}tvj5s3&SiEcyn&Dj`B%l9+|Hk!~E z{m>AX@#+Hm+M?TU=n0NW+i4XuNKnuj-HdLn|Bg~UWC4p=cEI`-uxk`(*-BqDkum+4 zg>4Ts!Kgvm*q z?;i)gK6_m5O~g%dz2Ld2IK<`oY?%G!eA}MZl1|+tneG1nK=NJGY01`R=dgEAY5B9e ziq9@}z5J=wyaB{!DIqJ}3Z7=2Iq9pj5%Z$rQqsO~?9QoSOMellVxeW59P62~@|JDvwkM`ml|^64L>6fEVm za$qZGsDnzdb;E%ro8eVVtz7$O$12WUB$%DCCNeD9sze8WI?>1PKgV$>=VS+6yF|`q zkP*k-O6K$htkOBjv=qB-wMHw+Wer^KV7CH|{9WOiz&aJ~vIu*HpYp`MP0X^6<_7IZ zQd?`FIVmzkX2g2>v;!VyNyBgQgTNbh!mET zLI(vY8I~;e3aHb?vdz&;a*UTu{(u{r>qsIOTRS@fX_KIeCr!Ko;HW_!~bPI12Gg P%p1N+rnnw&9t->rYAc?o diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class deleted file mode 100644 index 26d90d1065f9c2e5fd1d0f89628fb2679cba5c4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 681 zcma)4+fD*85IyC#f+&iJqDF(^!As(P0E8Gxj3ygjAiNi-yESV!=`NS}S3a5e;0O3o z#wiG15aTwP_MD!a&dkp1+w%*68g?^?A#Nd&MG`57a@VsTJU+BNG3o?d_v|Y%x-f^9 z7)5O>oJ`<<;Z1g(Zf=siMmxuI#21JzwY_jt8Gc^D=T`NHl_;V8}UA ziJSg?N9Y#s_{8L$pv(O>*V5n*G7)()WT?#2n|Ga-Q)Nhw3uV~*Lr$`EQ@V;reNC?p zX3~Xys?8*m#~XpVm2So1s#kUH_<-9!SFYWRv{dfDm^vkqX$F1W6_?V~Uiz(@XU3Z$ zd##kv4WEah2rX=p`um^wl8=QFL*ch;YP?ApWmq&P=3}&yNK?!ZsuOGY)XC`+*dv`{ uSf*&E3NSOZLJ=rVRD@Ouksdj$kw+Zsgks2JW4srzNqdHFirB`^dFdU$X}GWe diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class deleted file mode 100644 index ff2127d863743b275b372464eff3463c4572bb64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2740 zcma)6U2_vv7=BManx+O@0<;t?Y!DUHl-f2;AR3yQgjShxI;WeH=D>Ehv)K^J zAMkg0?}d&ZFgoL%H~s?ug4fzt*t6&3eV+IG{qx^neWto zjKVa=XzB@n##1J@_EW{ZC&F+UjV(({x+{!=iR5;K#u;5O>ZuoX-bxwVlO`F>4ivx74+Nv|otbd2K4z_{TE?uwjz zt_W&Un9zBa&P8ZCMl*Dt(K+ox)0Ji_W1A*?khaxe6cq=D?omND;8Q%2EW8#|cWFj5 zx#FYJZl$Pu2HYpo8r0a-NM%P<(4C!NxRu-Kb+ndzEF;Lf>oCL7I&Kt zti0V9tmPit5Sp6YU-04S6&N@UQk^|Umw^AD>>}`x%`_cHSjX*PG~Wm9QN?Jk7hDnz zyXhFB?ApdtMpqI&%6*2mSUQR1jypbx(d7~12;`y34UtDvNN$#e>zd*KrZYO5@QRAJ z+>}mE`f>6x$PeuXWNi!W)hmGZI^;)o6KDp}sc!0$&CwZG`$&5^l#Zwa;j+se5Jl8J zYXKW|>yF*pkcO(YM83P`AM!(0Mpe9NAx1`@z=$;WbkGp#PMlYCT})d*pL#8Ws(Sm<#qw+i=uS#jyuGNHthHatGp%vCiYffmD-iX7MGl#os9M)k}*0OcRSg(Znw_^#h&)P(m2gA*|Q1 zUI$HrrYT8Ra5L}0=_)PY1R{Dzt5v&e*ae{II*s}2Za{*m?=`V{BD$r?V&0=q#-L^- z@a{lh67C0J8_^Odm4eVKI`cjLo;RM-2VK~ZuXIt%+yLe#y^D1o=akP8R#E9CDR+^C zJC-kLkOJTI!2#Bb{JIMn=pb*=d%oH`_^aFog5RlCr@=E^YUH%{>LZoJZF*m8`+z?5 zIacvk`R(U;p*g(twY4jbJ9HNqwfl%Z#>(guN{?jwW(eDIhwUDAifx5H#eW_eI{x)V z=G!6ut?JV9QnUuHb;|gbb-4Os_2UpO&re1hC*b&F1V{D+5&G-I5z5j1k@5a}2-^c) z0V;cW>{PrzJ3%G>quIRfYu5s!&qqgw1&2hYpz|J}hq{tBsfd3Z_H0p!Dyy^f2>+ec G+5Z6UMi%7& diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class deleted file mode 100644 index 3a582a18388680144a30585fe8d6e8e53916a91a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2689 zcmah~TT@e46#jN@Cxkz~M)6*VRZ$BTyc8N0wR(~qk^|u!dd|T@e@XSp znO=PHp`B@!(V4bSI@90M_r5sVZ=VxL0H>WvcGg~d?RELqw|4$|_wsiDV_1wKfS`hq ziZCJqZ425%EnC&ha`swbK`*)jkuk$G+_M6~!J&K%Q8X!tsc42OkSJEN-&VA5vK4)` zU}<(Kd#O~`dB<>kVgKNi=TZB{&0e<*(;eNuADU}I9IXo4RD6VXf%w)70%DclNom!o zA|Xx0T8z70GUwd_9XnzS<(rsiw~9UJ5ePf3X0wpC?V+VnpNf8I6x7XIh6$ zt9n_hp0~>@OSj)g*k=FM3 zL%za8d&ad5vpgC@3Lne51_^G>LF2jXKpGhZ!zvEput0K02PX8@3$hgg?S?aM*`{uf zTb5liOwDC$K7iI-3`cNO!H9}uIKI&VFYL7DRtSz(U_qh5$)QOJ{7Dt3aGG7#zh2R* zJlT?|&zsR9dX3`~6{8pvh*mU*;FOpEX+$ppoK^8D&he^Op`VVyMo2v6XgdV< z^Yi~`=9!`&qIJqJ^{XpO1>K(23RMPepR$TtHLux*+}D&Lw_-5ruBjauO7e~h1eTA= zWkjH5#?^|8)7ouZFyRED^|&Ajo@w!_wbd1`;yfU1P;_g8|Fi6QP28*eWG91imqj^ z34GVc(3+v|bV4&rRoyu-Wm$_W%eA3zByvM>TQ1J7E$bgJztdp9L9hl@&BeG@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qs|4>RMA`|cM8A$uyF8>swFz^i8_h`!(o}f8D@C4b%X#W+RHwy#L@fPqD-M|0L;3VNe5j60# zivWk9<1o{7)9OJ#j^bVJ7!feu!x>sk5f&oCl`18Hvs`D9*x)ff=Peox{(_YYzSQr> z6%L0z08RN{kS(mEca5hKVFjuc@L^EdI_YE3R<qA2N=PHGB}MN!V?_L3#k3<=6+TgoBOHl zey@ZgyviP~fs*E+KSML-D6h|{qZ{bO7dVNVIE8r%^h*rmHa@~vn7|!OL-JIao(es8 z>o}5IbC)RbUj#v%F`hjWbJPM&OY8rjgS@o1wsL=jsL>TT&lshn7S$F1vd@_uKhaaK mvRar;k0Q4wav_WwWiBP#1ZO8O8Ge4kYJm*xtC(SrUH<|5H1OvD diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class deleted file mode 100644 index c212f56dfbb74bb24fc3dab4a53e704eb7cfc170..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12025 zcmb_id3;>eb^fkqMl+V4Em@K+OTzYG3)@<3VQdVtWMd&D>|hxa8H0dOo;71@?D32` zGXk3gXm-+tgg{zEN&_j4+lDkD1-u19o5o>F8XB6Cl7x_^=|UD7(k1~X^gH*yZ5Ctk z`{kcE@7;Iqy=VE(a?hKmesk`=0LJYH_sIgEBOQB_aqUXj5`-Yy0`lazr)78c7ujh)G43w9xu&D3!C zObbh}lpLh;!?J?MKjBXW}ydXN3q(%Ia;-v8;@OT{y+`Z z;@l|KSvU{pQ~8=guR3BECddGdMdhy8vZaGo>cM&oeX^7~DB9UzVIwY}AQUTK$W4tG zhN#Z`rMtDR6qb~0C}5tgseGZY76Z62ia`q(VaR1bTUuT##8QQ1&Mstg3iDTV1ZHn> z#<{}9*c`T@r=pgq`1(Jizq`RvPJIj9A!)O9_CC9&U2i4r(-t%S5(P zD2t3D{iuZlq|?bgc6uPUX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dRo17qtoI8 zp;8X!B39LaHg7z4WorNguu{g-TQ@VJiflQDSUiyS&(hr&NZmow|wN z#Gkh_8GKPPb7`wb_pYj1$Ve+%_$!PURkX4cm7b}^(-}@2GtN+{vX-0Pe%X% diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class deleted file mode 100644 index 9904f75d53df6123bc2d5ba3cae6853767877e7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8235 zcma)B3t(K;aXnZ2_NymLUR%bCEVKS#OR{WX2NW#%C(Dv8uq+43@+T1dqto7q#~iTPJ`uOha_zpL(`^dOUQ@x|4B$8pC%;~{87)`_x5A0 z?8Mf-`|iDS=g!QXGc$MhYZp&{5x@quID|5I{4h*-;Zvx(!@ARIN?6IErk;U2?7^&p zZ$ms8&u&ui)YbR<5l~n#INWsCuyv$q*d8B9S?O5QPHVtUgy2U=_>?Pn>)PAv`-7;! z96u^eRAH{dl9F{h?D4I_pwAx9_Q&lb3L$%BG<#I@Q&_mOWQCq-6~^;S%onbUV)h|x zERo$7w}w(lE71`fvbUv$lU{_@Kj26Zx@7 zVXijNST>$$+F@meyRFd>YT%K5t}zkC5{2qR@o_u0Gj+sHcgF2ROfSwTRPHRS2F( zh(DKR>bAz)Q>k<;p0u*|K0n^0Fh`4(cg_%Q!$I*JOJYb@m&B0UFlZtMTS1NU(oGOqskrEFQt_6nL0Rs3n zYP5?uu%d&hbka^o6Y-=ivSdtT1)f1duw75d=$$5xfYJxa%NbQzULx3K1i8z^dqt2r z`NggfzfN=1N!a}j6TgXjczD_X=?qVv(YjrZ@LoB>_cKh^wHLF$#0Pj#etf{hG2tO1 z_S%D~WGsLWa)bH+K14?nuL$6`Il$(3cseq`*AFX{MWeFQR#Eg36Tgd(Dfp?rL}G5gf=h4={*pAdUG3N!o&^(RgIA&wWhfhO01 zSfQarjLV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$-NS#8sVha&kA-_~rP>8YsD)~1}r*=m?&Ioha zG|OU*K|!)mF6Ez476wTygCsr=lT=&O1$Y%Vcn`|;1{}+UfgH#Q-M8UAkChzQ!iZ6+ z1oG#xfKPdwMjF22#XR3K`5MXrUfI30Z;)16A+S1yKkHU4-kKr=Hv1dHpA!%BGzY2$ zDmt&?jcWe{Zqg742n2{q=GlN`P7NwUXPm;IWUNB3D18#O9WEQavcO2P;=QBdlOfw)m?3k7IeGPHH-%NjiL=JnlP<=Rp6F+_vP(1j54!K+S$psyQ$@ z?Y%UY?P5vJ3krXBT+QDVn-EcJ5moE>!_+%)y}BNo)eQ{T&3Lc65%;V0{OY*{&#Mi1 zQEkH4)n;a?Hf5@IwNR}iE;=+4M(NF)8JNZYJ#>;r?f(YL{t0*NWB8Ce_9FIcO!$~n zFKS=srG|)dFDra=d_ABR)8QoVloOY45glI2TESbYB$E6kL9fjDbqb+r0#dt;I4cR6 zZnmh4luxO1*gK6j1l@e19Z?bvr+{f(S31KU^pm6-I*KtUuc!MGW z+r`%!S*J1_-;jHM^en2iXUW8)5|5cCYHKERogJRkv9(&pBu1MpM#Lz@v#TM|;3me2 zomi;4(V%u?lj`Ny<9oFAcTk0uw7XQ>1`}rPjiThNitXBNBJy^9B9b__>l5){TYg2} zs(NM4s+I6Iganetd3d$GvP;v>g5p^hC4kQ7dc@2!g2JkYFIRdFNy1}VxZQo zjC^Irh;gu#%FD5{#dM2&2RBYme~Pz&qRMO?t01V`>CFdGtt?!l2C$Nq%~}=1de%-I ztarNA5PxzT<}Y9e8D|e`o5?ja#PB4(Cbk%HEfwHzU_pAFb47Hnp)!}V1#c}Eq-yC= pZ?mE?oRUC=m}%$?#6<;Lmj0~bl$x)f3z%8t=Rl<*s)m^*^8cI=t0Mpa diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class deleted file mode 100644 index 85f914830010a10f0d03bf5bf51d31549fa8f97e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1235 zcmaJ=+iuf95IviFjFYsXS9&3owxj{-mWzax3aOZeA_b6|5QKO@n`CL+x^`u63gt`q z2p&M9Lh1t_z(*lwZ9_vF@!;K=@tiqx#^ayAPJaN{zr)PZZ@%Khgd}zDe>l$_57B)ljo#pui zW~M^qbre*3$`>8i=@yB4R7Vk)872?-zA#;)jccf3X%ci+fKkKI(9kb8Cko_XpVGc3;GaphQim3N40&>2?J}p>8?idHkN6S8L!{ZxIpHfkUnh%fB&s4%VJ_Pvg%S*kZJnB=O`PoL$H>q=jG{P3BOJ-6!@QYdR!K_!iwYLd4Y7SBdy zIY;ikFhaU;xHaC9u6NAvsXQ>#C^0O$&7H0-{KdNK?)ML?18LFd2O|Ffo5zP@Ncx+B z{BW77gR-L%Cb#W|B}FxZRfZU24Ej^Y5uRyt-xq!w>kLa5v<+)Hjk^r<|4*eQ4E151 z7BfbR62~;gpo3wYyci~EoV46z7uD9%ouqe3Owu_;-fQ*8&|Ro}2dm7SAYGX~LGCMs zVpK}O5_FEyIgTuq%M Date: Mon, 29 Nov 2021 15:55:36 +0100 Subject: [PATCH 18/68] overworked Settlement --- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 10 ---------- src/ch/zhaw/catan/Settlement.java | 16 +--------------- 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..6bc01a8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java index 6e11e5d..773324c 100644 --- a/src/ch/zhaw/catan/Settlement.java +++ b/src/ch/zhaw/catan/Settlement.java @@ -1,22 +1,8 @@ package ch.zhaw.catan; -import java.util.HashMap; - public class Settlement { - private HashMap buildCost; - private Config.Faction faction; public Settlement(Config.Faction faction) { - this.faction = faction; - buildCost = new HashMap<>(); - buildCost.put(Config.Resource.LUMBER,1); - buildCost.put(Config.Resource.BRICK,1); - buildCost.put(Config.Resource.GRAIN,1); - buildCost.put(Config.Resource.WOOL,1); + super(faction); } - - public HashMap getBuildCost() { - return buildCost; - } - } From ce31d0f4393b5acf05438db9c22918065eedbb02 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Mon, 29 Nov 2021 15:56:52 +0100 Subject: [PATCH 19/68] Added superclass structure to roads and settlement --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Road.java | 15 ++------------- src/ch/zhaw/catan/Structure.java | 9 +++++++++ 3 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 src/ch/zhaw/catan/Structure.java diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Road.java b/src/ch/zhaw/catan/Road.java index 360e794..5131770 100644 --- a/src/ch/zhaw/catan/Road.java +++ b/src/ch/zhaw/catan/Road.java @@ -1,19 +1,8 @@ package ch.zhaw.catan; -import java.util.HashMap; - -public class Road { - private HashMap buildCost; - private Config.Faction faction; +public class Road extends Structure { public Road(Config.Faction faction) { - this.faction = faction; - buildCost = new HashMap<>(); - buildCost.put(Config.Resource.BRICK,1); - buildCost.put(Config.Resource.LUMBER,1); - } - - public HashMap getBuildCost() { - return buildCost; + super(faction); } } diff --git a/src/ch/zhaw/catan/Structure.java b/src/ch/zhaw/catan/Structure.java new file mode 100644 index 0000000..fc085a2 --- /dev/null +++ b/src/ch/zhaw/catan/Structure.java @@ -0,0 +1,9 @@ +package ch.zhaw.catan; + +public abstract class Structure { + private Config.Faction faction; + + public Structure(Config.Faction faction) { + this.faction = faction; + } +} From c2d2f11d2acf6732ed10a4745ae5433db3087110 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Mon, 29 Nov 2021 16:02:38 +0100 Subject: [PATCH 20/68] Added superclass structure to roads and settlement --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Settlement.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 6bc01a8..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java index 773324c..c70734c 100644 --- a/src/ch/zhaw/catan/Settlement.java +++ b/src/ch/zhaw/catan/Settlement.java @@ -1,6 +1,6 @@ package ch.zhaw.catan; -public class Settlement { +public class Settlement extends Structure { public Settlement(Config.Faction faction) { super(faction); From 3ddd86e4e1845eba185747021d6ab2dd9f57900b Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Mon, 29 Nov 2021 16:21:13 +0100 Subject: [PATCH 21/68] activePlayer Datafield added --- src/ch/zhaw/catan/SiedlerGame.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index a0d6431..e282078 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -28,6 +28,8 @@ public class SiedlerGame { private Player[] allPlayers; private int winPoints; private Bank bank; + private Player activePlayer; + /** * Constructs a SiedlerGame game state object. * From cf94a835fc7ec2e4b4560b0df6c3729ad1281ef2 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Mon, 29 Nov 2021 16:39:29 +0100 Subject: [PATCH 22/68] Fixed display error toString in structure --- src/ch/zhaw/catan/Structure.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ch/zhaw/catan/Structure.java b/src/ch/zhaw/catan/Structure.java index fc085a2..04add42 100644 --- a/src/ch/zhaw/catan/Structure.java +++ b/src/ch/zhaw/catan/Structure.java @@ -6,4 +6,8 @@ public abstract class Structure { public Structure(Config.Faction faction) { this.faction = faction; } + + public String toString() { + return faction.toString(); + } } From 971cfe88683673002d2ced391c769800a93557ab Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Mon, 29 Nov 2021 16:47:02 +0100 Subject: [PATCH 23/68] SiedlerGame.java added few methodes --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Player.java | 4 +- src/ch/zhaw/catan/SiedlerGame.java | 537 +++++++++++++++-------------- src/ch/zhaw/catan/Structure.java | 4 + 4 files changed, 290 insertions(+), 257 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 4eb49b8..d7b7bc3 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -9,15 +9,13 @@ import java.util.List; */ public class Player { - private String name; private Config.Faction faction; private HashMap resources; private int roadsToUse; private int settlementsToUse; - public Player (String name, Config.Faction faction){ + public Player (Config.Faction faction){ //Datenfelder - this.name = name; this.faction = faction; roadsToUse = Config.Structure.ROAD.getStockPerPlayer(); settlementsToUse = Config.Structure.SETTLEMENT.getStockPerPlayer(); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index e282078..fe9a1ca 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -7,277 +7,308 @@ import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; import java.awt.Point; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; /** - * This class performs all actions related to modifying the game state. - * + * This class performs all actions related to modifying the game state. + *

* TODO: (your documentation) * * @author TODO - * */ public class SiedlerGame { - static final int FOUR_TO_ONE_TRADE_OFFER = 4; - static final int FOUR_TO_ONE_TRADE_WANT = 1; + static final int FOUR_TO_ONE_TRADE_OFFER = 4; + static final int FOUR_TO_ONE_TRADE_WANT = 1; - private SiedlerBoard board; - private Player[] allPlayers; - private int winPoints; - private Bank bank; - private Player activePlayer; - - /** - * Constructs a SiedlerGame game state object. - * - * @param winPoints the number of points required to win the game - * @param numberOfPlayers the number of players - * - * @throws IllegalArgumentException if winPoints is lower than - * three or players is not between two and four - */ - public SiedlerGame(int winPoints, int numberOfPlayers) { - bank = new Bank(); - board = new SiedlerBoard(); - board.createFixGamefield(); - allPlayers = new Player[numberOfPlayers]; - this.winPoints = winPoints; - } + private SiedlerBoard board; + private ArrayList allPlayers; + private int winPoints; + private Bank bank; + private int activePlayer; - /** - * Switches to the next player in the defined sequence of players. - */ - public void switchToNextPlayer() { - // TODO: Implement - } - - /** - * Switches to the previous player in the defined sequence of players. - */ - public void switchToPreviousPlayer() { - // TODO: Implement - } - - /** - * Returns the {@link Faction}s of the active players. - * - *

The order of the player's factions in the list must - * correspond to the oder in which they play. - * Hence, the player that sets the first settlement must be - * at position 0 in the list etc. - * - * Important note: The list must contain the - * factions of active players only.

- * - * @return the list with player's factions - */ - public List getPlayerFactions() { - // TODO: Implement - Faction[] factions = new Faction[allPlayers.length]; - - - return Collections.emptyList(); - } - - - /** - * Returns the game board. - * - * @return the game board - */ - public SiedlerBoard getBoard() { - // TODO: Implement - return board; - } - - /** - * Returns the {@link Faction} of the current player. - * - * @return the faction of the current player - */ - public Faction getCurrentPlayerFaction() { - // TODO: Implement - return null; - } - - /** - * Returns how many resource cards of the specified type - * the current player owns. - * - * @param resource the resource type - * @return the number of resource cards of this type - */ - public int getCurrentPlayerResourceStock(Resource resource) { - // TODO: Implement - return 0; - } - - /** - * Places a settlement in the founder's phase (phase II) of the game. - * - *

The placement does not cost any resource cards. If payout is - * set to true, for each adjacent resource-producing field, a resource card of the - * type of the resource produced by the field is taken from the bank (if available) and added to - * the players' stock of resource cards.

- * - * @param position the position of the settlement - * @param payout if true, the player gets one resource card per adjacent resource-producing field - * @return true, if the placement was successful - */ - public boolean placeInitialSettlement(Point position, boolean payout) { - // TODO: Implement - return false; - } - - /** - * Places a road in the founder's phase (phase II) of the game. - * The placement does not cost any resource cards. - * - * @param roadStart position of the start of the road - * @param roadEnd position of the end of the road - * @return true, if the placement was successful - */ - public boolean placeInitialRoad(Point roadStart, Point roadEnd) { - // TODO: Implement - return false; - } - - /** - * This method takes care of actions depending on the dice throw result. - * - * A key action is the payout of the resource cards to the players - * according to the payout rules of the game. This includes the - * "negative payout" in case a 7 is thrown and a player has more than - * {@link Config#MAX_CARDS_IN_HAND_NO_DROP} resource cards. - * - * If a player does not get resource cards, the list for this players' - * {@link Faction} is an empty list (not null)!. - * - *

- * The payout rules of the game take into account factors such as, the number - * of resource cards currently available in the bank, settlement types - * (settlement or city), and the number of players that should get resource - * cards of a certain type (relevant if there are not enough left in the bank). - *

- * - * @param dicethrow the resource cards that have been distributed to the players - * @return the resource cards added to the stock of the different players - */ - public Map> throwDice(int dicethrow) { - // TODO: Implement - return null; - } - - /** - * Builds a settlement at the specified position on the board. - * - *

The settlement can be built if: - *

    - *
  • the player possesses the required resource cards
  • - *
  • a settlement to place on the board
  • - *
  • the specified position meets the build rules for settlements
  • - *
- * - * @param position the position of the settlement - * @return true, if the placement was successful - */ - public boolean buildSettlement(Point position) { - // TODO: Implement - return false; - } - - /** - * Builds a city at the specified position on the board. - * - *

The city can be built if: - *

    - *
  • the player possesses the required resource cards
  • - *
  • a city to place on the board
  • - *
  • the specified position meets the build rules for cities
  • - *
- * - * @param position the position of the city - * @return true, if the placement was successful - */ - public boolean buildCity(Point position) { - // TODO: OPTIONAL task - Implement - return false; - } - - /** - * Builds a road at the specified position on the board. - * - *

The road can be built if: - *

    - *
  • the player possesses the required resource cards
  • - *
  • a road to place on the board
  • - *
  • the specified position meets the build rules for roads
  • - *
- * - * @param roadStart the position of the start of the road - * @param roadEnd the position of the end of the road - * @return true, if the placement was successful - */ - public boolean buildRoad(Point roadStart, Point roadEnd) { - //1. Check if Edge - if(!board.hasEdge(roadStart,roadEnd)){ - // TODO: Error message + /** + * Constructs a SiedlerGame game state object. + * + * @param winPoints the number of points required to win the game + * @param numberOfPlayers the number of players + * @throws IllegalArgumentException if winPoints is lower than + * three or players is not between two and four + */ + public SiedlerGame(int winPoints, int numberOfPlayers) { + if(winPoints < 3 || numberOfPlayers < 2 || numberOfPlayers > 4) { + throw new IllegalArgumentException(); + } + bank = new Bank(); + board = new SiedlerBoard(); + board.createFixGamefield(); + allPlayers = new ArrayList<>(); + createPlayer(numberOfPlayers); + activePlayer = 0; + this.winPoints = winPoints; } - //2. Check if Edge is empty - if(board.getEdge(roadStart,roadEnd) != null) { - // TODO: Error message + + private void createPlayer(int numberOfPlayers) { + for (int i = 0; i < numberOfPlayers; i++) { + allPlayers.add(new Player(Config.Faction.values()[i])); + } + } + + /** + * Switches to the next player in the defined sequence of players. + */ + public void switchToNextPlayer() { + // TODO: Implement + } + + /** + * Switches to the previous player in the defined sequence of players. + */ + public void switchToPreviousPlayer() { + // TODO: Implement + } + + /** + * Returns the {@link Faction}s of the active players. + * + *

The order of the player's factions in the list must + * correspond to the oder in which they play. + * Hence, the player that sets the first settlement must be + * at position 0 in the list etc. + * + * Important note: The list must contain the + * factions of active players only.

+ * + * @return the list with player's factions + */ + public List getPlayerFactions() { + // TODO: Implement + List factions = new ArrayList<>(); + for (Player player: allPlayers ) { + factions.add(player.getFaction()); + } + + return factions; } - //3. Can Player build road - // TODO - return false; - } + /** + * Returns the game board. + * + * @return the game board + */ + public SiedlerBoard getBoard() { + return board; + } - - /** - * Trades in {@link #FOUR_TO_ONE_TRADE_OFFER} resource cards of the - * offered type for {@link #FOUR_TO_ONE_TRADE_WANT} resource cards of the wanted type. - * - * The trade only works when bank and player possess the resource cards - * for the trade before the trade is executed. - * - * @param offer offered type - * @param want wanted type - * @return true, if the trade was successful - */ - public boolean tradeWithBankFourToOne(Resource offer, Resource want) { - // TODO: Implement - return bank.tradeWithBank(want,offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); - } + /** + * Returns the {@link Faction} of the current player. + * + * @return the faction of the current player + */ + public Faction getCurrentPlayerFaction() { + return allPlayers.get(activePlayer).getFaction(); + } - /** - * Returns the winner of the game, if any. - * - * @return the winner of the game or null, if there is no winner (yet) - */ - public Faction getWinner() { - // TODO: Implement - return null; - } - - - /** - * Places the thief on the specified field and steals a random resource card (if - * the player has such cards) from a random player with a settlement at that - * field (if there is a settlement) and adds it to the resource cards of the - * current player. - * - * @param field the field on which to place the thief - * @return false, if the specified field is not a field or the thief cannot be - * placed there (e.g., on water) - */ - public boolean placeThiefAndStealCard(Point field) { - //TODO: Implement (or longest road functionality) - return false; - } + /** + * Returns how many resource cards of the specified type + * the current player owns. + * + * @param resource the resource type + * @return the number of resource cards of this type + */ + public int getCurrentPlayerResourceStock(Resource resource) { + int ressourceInStock = allPlayers.get(activePlayer).getSpecificResource(resource); + return ressourceInStock; + } + + /** + * Places a settlement in the founder's phase (phase II) of the game. + * + *

The placement does not cost any resource cards. If payout is + * set to true, for each adjacent resource-producing field, a resource card of the + * type of the resource produced by the field is taken from the bank (if available) and added to + * the players' stock of resource cards.

+ * + * @param position the position of the settlement + * @param payout if true, the player gets one resource card per adjacent resource-producing field + * @return true, if the placement was successful + */ + public boolean placeInitialSettlement(Point position, boolean payout) { + // TODO: Implement + return false; + } + + /** + * Places a road in the founder's phase (phase II) of the game. + * The placement does not cost any resource cards. + * + * @param roadStart position of the start of the road + * @param roadEnd position of the end of the road + * @return true, if the placement was successful + */ + public boolean placeInitialRoad(Point roadStart, Point roadEnd) { + // TODO: Implement + return false; + } + + /** + * This method takes care of actions depending on the dice throw result. + *

+ * A key action is the payout of the resource cards to the players + * according to the payout rules of the game. This includes the + * "negative payout" in case a 7 is thrown and a player has more than + * {@link Config#MAX_CARDS_IN_HAND_NO_DROP} resource cards. + *

+ * If a player does not get resource cards, the list for this players' + * {@link Faction} is an empty list (not null)!. + * + *

+ * The payout rules of the game take into account factors such as, the number + * of resource cards currently available in the bank, settlement types + * (settlement or city), and the number of players that should get resource + * cards of a certain type (relevant if there are not enough left in the bank). + *

+ * + * @param dicethrow the resource cards that have been distributed to the players + * @return the resource cards added to the stock of the different players + */ + public Map> throwDice(int dicethrow) { + // TODO: Implement + return null; + } + + /** + * Builds a settlement at the specified position on the board. + * + *

The settlement can be built if: + *

    + *
  • the player possesses the required resource cards
  • + *
  • a settlement to place on the board
  • + *
  • the specified position meets the build rules for settlements
  • + *
+ * + * @param position the position of the settlement + * @return true, if the placement was successful + */ + public boolean buildSettlement(Point position) { + //1. Check if Edge + if (!board.hasCorner(position)) { + // TODO: Error message + return false; + } + //2. Check if Edge is empty + if (board.getCorner(position) != null) { + // TODO: Error message + return false; + } + //3. Can Player build road + if (!allPlayers.get(activePlayer).buildSettlement()) { + // TODO: Error message + return false; + } + //4. Insert Road to map + board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction())); + return true; + } + + /** + * Builds a city at the specified position on the board. + * + *

The city can be built if: + *

    + *
  • the player possesses the required resource cards
  • + *
  • a city to place on the board
  • + *
  • the specified position meets the build rules for cities
  • + *
+ * + * @param position the position of the city + * @return true, if the placement was successful + */ + public boolean buildCity(Point position) { + // TODO: OPTIONAL task - Implement + return false; + } + + /** + * Builds a road at the specified position on the board. + * + *

The road can be built if: + *

    + *
  • the player possesses the required resource cards
  • + *
  • a road to place on the board
  • + *
  • the specified position meets the build rules for roads
  • + *
+ * + * @param roadStart the position of the start of the road + * @param roadEnd the position of the end of the road + * @return true, if the placement was successful + */ + public boolean buildRoad(Point roadStart, Point roadEnd) { + //1. Check if Edge + if (!board.hasEdge(roadStart, roadEnd)) { + // TODO: Error message + return false; + } + //2. Check if Edge is empty + if (board.getEdge(roadStart, roadEnd) != null) { + // TODO: Error message + return false; + } + //3. Can Player build road + if (!allPlayers.get(activePlayer).buildRoad()) { + // TODO: Error message + return false; + } + //4. Insert Road to map + board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction())); + return true; + } + + + /** + * Trades in {@link #FOUR_TO_ONE_TRADE_OFFER} resource cards of the + * offered type for {@link #FOUR_TO_ONE_TRADE_WANT} resource cards of the wanted type. + *

+ * The trade only works when bank and player possess the resource cards + * for the trade before the trade is executed. + * + * @param offer offered type + * @param want wanted type + * @return true, if the trade was successful + */ + public boolean tradeWithBankFourToOne(Resource offer, Resource want) { + // TODO: Implement + return bank.tradeWithBank(want, offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); + } + + /** + * Returns the winner of the game, if any. + * + * @return the winner of the game or null, if there is no winner (yet) + */ + public Faction getWinner() { + // TODO: Implement + return null; + } + + + /** + * Places the thief on the specified field and steals a random resource card (if + * the player has such cards) from a random player with a settlement at that + * field (if there is a settlement) and adds it to the resource cards of the + * current player. + * + * @param field the field on which to place the thief + * @return false, if the specified field is not a field or the thief cannot be + * placed there (e.g., on water) + */ + public boolean placeThiefAndStealCard(Point field) { + //TODO: Implement (or longest road functionality) + return false; + } } diff --git a/src/ch/zhaw/catan/Structure.java b/src/ch/zhaw/catan/Structure.java index fc085a2..0f12092 100644 --- a/src/ch/zhaw/catan/Structure.java +++ b/src/ch/zhaw/catan/Structure.java @@ -6,4 +6,8 @@ public abstract class Structure { public Structure(Config.Faction faction) { this.faction = faction; } + + public Config.Faction getFaction() { + return faction; + } } From 54b1d794f84c687e8d2d5613aa2bad9efa7a34d9 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Mon, 29 Nov 2021 17:23:55 +0100 Subject: [PATCH 24/68] new Class Parser and corresponding enums created --- src/ch/zhaw/catan/Command.java | 11 +++++++++++ src/ch/zhaw/catan/CommandWords.java | 4 ++++ src/ch/zhaw/catan/Parser.java | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/ch/zhaw/catan/Command.java create mode 100644 src/ch/zhaw/catan/CommandWords.java create mode 100644 src/ch/zhaw/catan/Parser.java diff --git a/src/ch/zhaw/catan/Command.java b/src/ch/zhaw/catan/Command.java new file mode 100644 index 0000000..013698e --- /dev/null +++ b/src/ch/zhaw/catan/Command.java @@ -0,0 +1,11 @@ +package ch.zhaw.catan; + +public enum Command { + NEXTPLAYER ("next Player"), QUIT("quit"); + + private String CommandWord; + + Command(String commandWord) { + this.CommandWord = commandWord; + } +} diff --git a/src/ch/zhaw/catan/CommandWords.java b/src/ch/zhaw/catan/CommandWords.java new file mode 100644 index 0000000..d67b327 --- /dev/null +++ b/src/ch/zhaw/catan/CommandWords.java @@ -0,0 +1,4 @@ +package ch.zhaw.catan; + +public class CommandWords { +} diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java new file mode 100644 index 0000000..15a4cd0 --- /dev/null +++ b/src/ch/zhaw/catan/Parser.java @@ -0,0 +1,25 @@ +package ch.zhaw.catan; +import org.beryx.textio.TextIO; +import org.beryx.textio.TextIoFactory; +import org.beryx.textio.TextTerminal; + +public class Parser { + TextIO textIO = TextIoFactory.getTextIO(); + TextTerminal textTerminal; + + + public Parser() { + textTerminal = textIO.getTextTerminal(); + run(); + } + + public void run() { + boolean running = true; + while (running) { + } + } + + + +} + From 3830cf65941edb08ea9d984c0a8854ee8951e8f4 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Tue, 30 Nov 2021 20:20:48 +0100 Subject: [PATCH 25/68] implemented Method getWinner and getWinPoints added Class City for later use. --- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 10 ++++++ src/ch/zhaw/catan/City.java | 8 +++++ src/ch/zhaw/catan/Siedler.java | 7 +++- src/ch/zhaw/catan/SiedlerBoard.java | 2 +- src/ch/zhaw/catan/SiedlerBoardTextView.java | 2 +- src/ch/zhaw/catan/SiedlerGame.java | 39 +++++++++++++++++---- src/ch/zhaw/catan/Structure.java | 4 +++ 8 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 .idea/runConfigurations.xml create mode 100644 src/ch/zhaw/catan/City.java diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..6bc01a8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/ch/zhaw/catan/City.java b/src/ch/zhaw/catan/City.java new file mode 100644 index 0000000..ea6d41a --- /dev/null +++ b/src/ch/zhaw/catan/City.java @@ -0,0 +1,8 @@ +package ch.zhaw.catan; + +public class City extends Structure { + + public City(Config.Faction faction) { + super(faction); + } +} diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 7610db4..5d5deb6 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -4,12 +4,14 @@ import org.beryx.textio.TextIO; import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; +import java.awt.*; + public class Siedler { public static void main(String[] args) { //Spiel erstellen - SiedlerGame game = new SiedlerGame(0, 0); + SiedlerGame game = new SiedlerGame(3, 2); //Spielfeld ausgeben TextIO textIO = TextIoFactory.getTextIO(); @@ -18,5 +20,8 @@ public class Siedler { + + + } } diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 361df74..30910f7 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -8,7 +8,7 @@ import java.awt.*; import java.util.*; import java.util.List; -public class SiedlerBoard extends HexBoard { +public class SiedlerBoard extends HexBoard { Map lowerFieldLabel = new HashMap<>(); diff --git a/src/ch/zhaw/catan/SiedlerBoardTextView.java b/src/ch/zhaw/catan/SiedlerBoardTextView.java index 11a4ed5..97f6401 100644 --- a/src/ch/zhaw/catan/SiedlerBoardTextView.java +++ b/src/ch/zhaw/catan/SiedlerBoardTextView.java @@ -6,7 +6,7 @@ import ch.zhaw.hexboard.Label; import java.awt.*; -public class SiedlerBoardTextView extends HexBoardTextView { +public class SiedlerBoardTextView extends HexBoardTextView { public SiedlerBoardTextView(SiedlerBoard board) { super(board); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index fe9a1ca..a02c74d 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -7,10 +7,7 @@ import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; import java.awt.Point; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; /** @@ -26,7 +23,7 @@ public class SiedlerGame { private SiedlerBoard board; private ArrayList allPlayers; - private int winPoints; + private int winPointsForWin; private Bank bank; private int activePlayer; @@ -48,7 +45,7 @@ public class SiedlerGame { allPlayers = new ArrayList<>(); createPlayer(numberOfPlayers); activePlayer = 0; - this.winPoints = winPoints; + this.winPointsForWin = winPoints; } private void createPlayer(int numberOfPlayers) { @@ -292,9 +289,39 @@ public class SiedlerGame { */ public Faction getWinner() { // TODO: Implement + HashMap winPoints = getWinPoints(); + for(Faction faction : winPoints.keySet()){ + if(winPoints.get(faction) >= winPointsForWin){ + return faction; + } + } return null; } + private HashMap getWinPoints(){ + HashMap winPoints = new HashMap<>(); + List structures = board.getCorners(); + for(Structure structure : structures) { + + int newWinPoints = 0; + if(structure instanceof Settlement){ + newWinPoints = 1; + } else if(structure instanceof City) { + newWinPoints = 2; + } + + Faction faction = structure.getFaction(); + if(winPoints.containsKey(faction)) { + winPoints.put(faction, winPoints.get(faction) + newWinPoints); + } + else { + winPoints.put(faction, newWinPoints); + } + + } + return winPoints; + } + /** * Places the thief on the specified field and steals a random resource card (if diff --git a/src/ch/zhaw/catan/Structure.java b/src/ch/zhaw/catan/Structure.java index 04add42..54e589f 100644 --- a/src/ch/zhaw/catan/Structure.java +++ b/src/ch/zhaw/catan/Structure.java @@ -10,4 +10,8 @@ public abstract class Structure { public String toString() { return faction.toString(); } + + public Config.Faction getFaction() { + return faction; + } } From 9e347e879277a7b759d1260d3e700f486b3f84dd Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Wed, 1 Dec 2021 23:24:16 +0100 Subject: [PATCH 26/68] implementing part of Parser class --- .gitignore | 77 +++++++++++++++++++++++++++++++++- .idea/.gitignore | 2 + src/ch/zhaw/catan/Command.java | 19 +++++++-- src/ch/zhaw/catan/Parser.java | 11 +++++ src/ch/zhaw/catan/Siedler.java | 2 - 5 files changed, 104 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6a3417b..ed8c940 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,76 @@ -/out/ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +misc.xml +SiedlerBoard.class + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore index 73f69e0..2367661 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -6,3 +6,5 @@ /dataSources.local.xml # Editor-based HTTP Client requests /httpRequests/ +/misc.xml +/out/ \ No newline at end of file diff --git a/src/ch/zhaw/catan/Command.java b/src/ch/zhaw/catan/Command.java index 013698e..6abf2b5 100644 --- a/src/ch/zhaw/catan/Command.java +++ b/src/ch/zhaw/catan/Command.java @@ -1,11 +1,22 @@ package ch.zhaw.catan; -public enum Command { - NEXTPLAYER ("next Player"), QUIT("quit"); +import org.beryx.textio.TextIO; + +public enum Command { + NEXTPLAYER ("next Player"), QUIT("quit"), UNKNOWN ("unknown"); + + private String commandWord; + + + public static > T getEnumValue(TextIO textIO, Class commands) { + return textIO.newEnumInputReader(commands).read("What would you like to do?"); + } - private String CommandWord; Command(String commandWord) { - this.CommandWord = commandWord; + this.commandWord = commandWord; + } + public String toString() { + return commandWord; } } diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 15a4cd0..b131458 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -8,6 +8,7 @@ public class Parser { TextTerminal textTerminal; + public Parser() { textTerminal = textIO.getTextTerminal(); run(); @@ -16,6 +17,16 @@ public class Parser { public void run() { boolean running = true; while (running) { + switch(Command.getEnumValue(textIO, Command.class)){ + case QUIT: + running = false; + break; + case UNKNOWN: + break; + + + } + } } diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 5d5deb6..8f62515 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -4,8 +4,6 @@ import org.beryx.textio.TextIO; import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; -import java.awt.*; - public class Siedler { public static void main(String[] args) { From d6c225a5aac1c19a002cd0baced13f8a94d98a0c Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Thu, 2 Dec 2021 14:12:12 +0100 Subject: [PATCH 27/68] created method storeResourceToBank in Bank.java adapted method buildRoad and buildSettlement in SiedlerGame.java --- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 10 ---------- src/ch/zhaw/catan/Bank.java | 7 +++++++ src/ch/zhaw/catan/Dummy.java | 1 - src/ch/zhaw/catan/SiedlerGame.java | 10 +++++++--- 5 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 6bc01a8..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/ch/zhaw/catan/Bank.java b/src/ch/zhaw/catan/Bank.java index 0eedb95..2bb84d7 100644 --- a/src/ch/zhaw/catan/Bank.java +++ b/src/ch/zhaw/catan/Bank.java @@ -1,5 +1,6 @@ package ch.zhaw.catan; +import java.util.List; import java.util.Map; public class Bank { @@ -10,6 +11,12 @@ public class Bank { } + public void storeResourceToBank(List resourceToGive) { + for (Config.Resource resource : resourceToGive) { + resources.put(resource,resources.get(resource)+1); + } + } + public boolean getResourceFromBank(Config.Resource resource,int numberOfResources) { if(resources.get(resource) >= numberOfResources) { Integer newResourceNumber = resources.get(resource) - numberOfResources; diff --git a/src/ch/zhaw/catan/Dummy.java b/src/ch/zhaw/catan/Dummy.java index e9eb5db..ca1bbe2 100644 --- a/src/ch/zhaw/catan/Dummy.java +++ b/src/ch/zhaw/catan/Dummy.java @@ -18,7 +18,6 @@ public class Dummy { private void run() { TextIO textIO = TextIoFactory.getTextIO(); TextTerminal textTerminal = textIO.getTextTerminal(); - SiedlerBoard board = new SiedlerBoard(); board.addField(new Point(2, 2), Land.FOREST); board.setCorner(new Point(3, 3), new Settlement(Config.Faction.RED)); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index a02c74d..4ce4675 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -192,23 +192,25 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildSettlement(Point position) { - //1. Check if Edge + //1. Check if Corner if (!board.hasCorner(position)) { // TODO: Error message return false; } - //2. Check if Edge is empty + //2. Check if Corner is empty if (board.getCorner(position) != null) { // TODO: Error message return false; } - //3. Can Player build road + //3. Can Player build Settlement if (!allPlayers.get(activePlayer).buildSettlement()) { // TODO: Error message return false; } //4. Insert Road to map board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction())); + //5. Give Resoure to bank + bank.storeResourceToBank(Config.Structure.SETTLEMENT.getCosts()); return true; } @@ -262,6 +264,8 @@ public class SiedlerGame { } //4. Insert Road to map board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction())); + //5. Give Resource to bank + bank.storeResourceToBank(Config.Structure.ROAD.getCosts()); return true; } From 3c67d62e42794dc7086498ee0825c2bcac8d6202 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 15:15:39 +0100 Subject: [PATCH 28/68] Several new methods added in Parser class --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Command.java | 3 -- src/ch/zhaw/catan/Parser.java | 52 +++++++++++++++++++++++----------- src/ch/zhaw/catan/Siedler.java | 2 ++ 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 6bc01a8..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Command.java b/src/ch/zhaw/catan/Command.java index 6abf2b5..d8157dc 100644 --- a/src/ch/zhaw/catan/Command.java +++ b/src/ch/zhaw/catan/Command.java @@ -8,9 +8,6 @@ public enum Command { private String commandWord; - public static > T getEnumValue(TextIO textIO, Class commands) { - return textIO.newEnumInputReader(commands).read("What would you like to do?"); - } Command(String commandWord) { diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index b131458..9da799a 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -3,34 +3,54 @@ import org.beryx.textio.TextIO; import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; +import java.awt.*; + +import static ch.zhaw.catan.Command.QUIT; +import static ch.zhaw.catan.Command.UNKNOWN; + public class Parser { TextIO textIO = TextIoFactory.getTextIO(); TextTerminal textTerminal; - - public Parser() { textTerminal = textIO.getTextTerminal(); - run(); + } + public Point getPoint() { + return null; } - public void run() { - boolean running = true; - while (running) { - switch(Command.getEnumValue(textIO, Command.class)){ - case QUIT: - running = false; - break; - case UNKNOWN: - break; + public int gameStart(){ + return 2; + } + public void giveCoordinatesForStructures(Config.Structure structure) { - } + } + public void thrownDices(int number){ + + } + + public void playerTurn(Config.Faction faction) { + + } + + public void errorMessage(){ + + } + + public Command getAction() { + + switch (textIO.newEnumInputReader(Command.class).read("What would you like to do?")) { + case QUIT: + System.out.println("quit"); + return QUIT; + + case UNKNOWN: + return UNKNOWN; + default: + return null; } } - - - } diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 8f62515..d3bd7d9 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -15,6 +15,8 @@ public class Siedler { TextIO textIO = TextIoFactory.getTextIO(); TextTerminal textTerminal = textIO.getTextTerminal(); textTerminal.println(game.getBoard().getTextView()); + Parser parser = new Parser(); + parser.getAction(); From cba5a6b22c4cb2cdc5bc48e7b483582290dcbaa8 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 15:20:30 +0100 Subject: [PATCH 29/68] gameStart method now returns HashMap --- src/ch/zhaw/catan/Parser.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 9da799a..921f5c0 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -4,6 +4,7 @@ import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; import java.awt.*; +import java.util.HashMap; import static ch.zhaw.catan.Command.QUIT; import static ch.zhaw.catan.Command.UNKNOWN; @@ -19,8 +20,8 @@ public class Parser { return null; } - public int gameStart(){ - return 2; + public HashMap gameStart(){ + return null; } public void giveCoordinatesForStructures(Config.Structure structure) { From 684bf9e553b99ce4ed8d4b7be34157dc2a9071ef Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 15:22:33 +0100 Subject: [PATCH 30/68] gameStart method now returns HashMap --- src/ch/zhaw/catan/Parser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 921f5c0..1e440d1 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -22,6 +22,8 @@ public class Parser { public HashMap gameStart(){ return null; + //Anzahlspieler,int + //Siegespunkte,int } public void giveCoordinatesForStructures(Config.Structure structure) { From 68cc2402b4064485d0fad67fd281d4f5a341fe16 Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Thu, 2 Dec 2021 15:28:00 +0100 Subject: [PATCH 31/68] Added player switches --- src/ch/zhaw/catan/SiedlerGame.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 4ce4675..4ab205d 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -59,6 +59,12 @@ public class SiedlerGame { */ public void switchToNextPlayer() { // TODO: Implement + if (activePlayer < allPlayers.size()){ + activePlayer++; + } + else if (activePlayer == allPlayers.size()){ + activePlayer = 0; + } } /** @@ -66,6 +72,12 @@ public class SiedlerGame { */ public void switchToPreviousPlayer() { // TODO: Implement + if (activePlayer > 0){ + activePlayer--; + } + else if (activePlayer == 0){ + activePlayer = allPlayers.size()-1; + } } /** From 014b8381874e06603f37fc7d7681956357d72aba Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 15:37:27 +0100 Subject: [PATCH 32/68] displayGameboard method added. --- src/ch/zhaw/catan/Parser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 1e440d1..b86019b 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -20,6 +20,10 @@ public class Parser { return null; } + public void displayGameboard(String gameboard) { + textTerminal.println(gameboard); + } + public HashMap gameStart(){ return null; //Anzahlspieler,int @@ -27,10 +31,11 @@ public class Parser { } public void giveCoordinatesForStructures(Config.Structure structure) { - + textTerminal.println("Please insert coordinates for " + structure); } public void thrownDices(int number){ + textTerminal.println("Dices are being thrown "); } From b1ba5636ceac0ceb431869c8a27798f5b289b718 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Thu, 2 Dec 2021 16:25:38 +0100 Subject: [PATCH 33/68] Removed TODO comments of finished methods and removed unnecessary variable --- src/ch/zhaw/catan/Siedler.java | 2 -- src/ch/zhaw/catan/SiedlerBoard.java | 3 +-- src/ch/zhaw/catan/SiedlerGame.java | 22 +++++++--------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index d3bd7d9..53a0f3c 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -21,7 +21,5 @@ public class Siedler { - - } } diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 30910f7..e27f855 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -5,8 +5,8 @@ import ch.zhaw.hexboard.HexBoard; import ch.zhaw.hexboard.Label; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class SiedlerBoard extends HexBoard { @@ -58,7 +58,6 @@ public class SiedlerBoard extends HexBoard { * @return the fields associated with the dice value */ public List getFieldsForDiceValue(int dice) { - //TODO: Implement. ArrayList fields = new ArrayList<>(); for(Point field : lowerFieldLabel.keySet()){ if(getDiceNumber(field) == dice){ diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 4ab205d..9245724 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -2,12 +2,12 @@ package ch.zhaw.catan; import ch.zhaw.catan.Config.Faction; import ch.zhaw.catan.Config.Resource; -import org.beryx.textio.TextIO; -import org.beryx.textio.TextIoFactory; -import org.beryx.textio.TextTerminal; -import java.awt.Point; -import java.util.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** @@ -58,7 +58,6 @@ public class SiedlerGame { * Switches to the next player in the defined sequence of players. */ public void switchToNextPlayer() { - // TODO: Implement if (activePlayer < allPlayers.size()){ activePlayer++; } @@ -71,7 +70,6 @@ public class SiedlerGame { * Switches to the previous player in the defined sequence of players. */ public void switchToPreviousPlayer() { - // TODO: Implement if (activePlayer > 0){ activePlayer--; } @@ -94,7 +92,6 @@ public class SiedlerGame { * @return the list with player's factions */ public List getPlayerFactions() { - // TODO: Implement List factions = new ArrayList<>(); for (Player player: allPlayers ) { factions.add(player.getFaction()); @@ -130,8 +127,7 @@ public class SiedlerGame { * @return the number of resource cards of this type */ public int getCurrentPlayerResourceStock(Resource resource) { - int ressourceInStock = allPlayers.get(activePlayer).getSpecificResource(resource); - return ressourceInStock; + return allPlayers.get(activePlayer).getSpecificResource(resource); } /** @@ -204,19 +200,17 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildSettlement(Point position) { + //TODO Errors should be caught after this method is executed and returns false //1. Check if Corner if (!board.hasCorner(position)) { - // TODO: Error message return false; } //2. Check if Corner is empty if (board.getCorner(position) != null) { - // TODO: Error message return false; } //3. Can Player build Settlement if (!allPlayers.get(activePlayer).buildSettlement()) { - // TODO: Error message return false; } //4. Insert Road to map @@ -294,7 +288,6 @@ public class SiedlerGame { * @return true, if the trade was successful */ public boolean tradeWithBankFourToOne(Resource offer, Resource want) { - // TODO: Implement return bank.tradeWithBank(want, offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); } @@ -304,7 +297,6 @@ public class SiedlerGame { * @return the winner of the game or null, if there is no winner (yet) */ public Faction getWinner() { - // TODO: Implement HashMap winPoints = getWinPoints(); for(Faction faction : winPoints.keySet()){ if(winPoints.get(faction) >= winPointsForWin){ From a7a20856326742fbf671ee88f18e7dc9c1b0da51 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 16:49:44 +0100 Subject: [PATCH 34/68] Implemented the functionality of all methods in Parser.java and created missing Enum Instances in Command.java. --- src/ch/zhaw/catan/Command.java | 3 ++- src/ch/zhaw/catan/Parser.java | 47 +++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/ch/zhaw/catan/Command.java b/src/ch/zhaw/catan/Command.java index d8157dc..7e7b24e 100644 --- a/src/ch/zhaw/catan/Command.java +++ b/src/ch/zhaw/catan/Command.java @@ -3,7 +3,8 @@ package ch.zhaw.catan; import org.beryx.textio.TextIO; public enum Command { - NEXTPLAYER ("next Player"), QUIT("quit"), UNKNOWN ("unknown"); + NEXTPLAYER ("next player"), BUILDSETTLEMENT ("build settlement"), BUILDCITY("build city"), + BUILDROAD("build road"), TRADEWITHBANK("trade with bank"),QUIT("quit"); private String commandWord; diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index b86019b..9d78a3a 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -6,8 +6,7 @@ import org.beryx.textio.TextTerminal; import java.awt.*; import java.util.HashMap; -import static ch.zhaw.catan.Command.QUIT; -import static ch.zhaw.catan.Command.UNKNOWN; +import static ch.zhaw.catan.Command.*; public class Parser { TextIO textIO = TextIoFactory.getTextIO(); @@ -16,8 +15,10 @@ public class Parser { public Parser() { textTerminal = textIO.getTextTerminal(); } + public Point getPoint() { - return null; + return new Point(textIO.newIntInputReader().withMinVal(0).read("x coordinate:"), + textIO.newIntInputReader().withMinVal(0).read("y coordinate:")); } public void displayGameboard(String gameboard) { @@ -25,39 +26,49 @@ public class Parser { } public HashMap gameStart(){ - return null; - //Anzahlspieler,int - //Siegespunkte,int + HashMap gameStartValues = new HashMap<>(); + gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:")); + gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoint needed for Victory:")); + return gameStartValues; } public void giveCoordinatesForStructures(Config.Structure structure) { textTerminal.println("Please insert coordinates for " + structure); + if(structure == Config.Structure.ROAD) { + textTerminal.println("You are building a road, please first insert the start coordinate and when prompted again the coordinate of the end of the road."); + } } public void thrownDices(int number){ - textTerminal.println("Dices are being thrown "); + textTerminal.println ("Dices have been thrown, the combined value is: " + number); + } public void playerTurn(Config.Faction faction) { - + textTerminal.println("It is" + faction + "'s turn."); } public void errorMessage(){ - + textTerminal.print("The command was not excecuted successfully!"); } public Command getAction() { - switch (textIO.newEnumInputReader(Command.class).read("What would you like to do?")) { - case QUIT: - System.out.println("quit"); - return QUIT; - - case UNKNOWN: - return UNKNOWN; - default: - return null; + case NEXTPLAYER: + return NEXTPLAYER; + case BUILDSETTLEMENT: + return BUILDSETTLEMENT; + case BUILDCITY: + return BUILDCITY; + case BUILDROAD: + return BUILDROAD; + case TRADEWITHBANK: + return TRADEWITHBANK; + case QUIT: + return QUIT; + default: + return null; } } } From c4a3346fad222229199e521eb0ed1111e0ff1fb7 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 17:01:53 +0100 Subject: [PATCH 35/68] eroorMessage method prinln added --- src/ch/zhaw/catan/Parser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 9d78a3a..6cf7edf 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -50,7 +50,7 @@ public class Parser { } public void errorMessage(){ - textTerminal.print("The command was not excecuted successfully!"); + textTerminal.println("The command was not excecuted successfully!"); } public Command getAction() { From 9916d380737c84a02b375c137864a7662650934b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 17:13:43 +0100 Subject: [PATCH 36/68] first draft of foundigPhase Method --- src/ch/zhaw/catan/City.java | 2 +- src/ch/zhaw/catan/Siedler.java | 69 +++++++++++++++++++++++++++--- src/ch/zhaw/catan/SiedlerGame.java | 29 ++++++++++--- 3 files changed, 88 insertions(+), 12 deletions(-) diff --git a/src/ch/zhaw/catan/City.java b/src/ch/zhaw/catan/City.java index ea6d41a..5e16c18 100644 --- a/src/ch/zhaw/catan/City.java +++ b/src/ch/zhaw/catan/City.java @@ -1,6 +1,6 @@ package ch.zhaw.catan; -public class City extends Structure { +public class City extends Settlement { public City(Config.Faction faction) { super(faction); diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 53a0f3c..2b24797 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -4,22 +4,79 @@ import org.beryx.textio.TextIO; import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; +import java.util.HashMap; + public class Siedler { public static void main(String[] args) { //Spiel erstellen - SiedlerGame game = new SiedlerGame(3, 2); + Parser parser = new Parser(); + SiedlerGame game = foundingPhase(parser); + + parser.getAction(); + //Spielfeld ausgeben - TextIO textIO = TextIoFactory.getTextIO(); - TextTerminal textTerminal = textIO.getTextTerminal(); - textTerminal.println(game.getBoard().getTextView()); - Parser parser = new Parser(); - parser.getAction(); + + + } + + + + private static SiedlerGame foundingPhase(Parser parser) { + HashMap gameInfo = parser.gameStart(); + SiedlerGame game = new SiedlerGame(gameInfo.get("NumberOfWinPoints"), gameInfo.get("NumberOfPlayers")); + for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){ + buildStructuresInFoundingPhase(game, parser, false); + if(player < gameInfo.get("NumberOfPlayers")){ + game.switchToPreviousPlayer(); + } + } + for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){ + buildStructuresInFoundingPhase(game, parser, true); + game.switchToNextPlayer(); + } + return game; + } + + + private static void buildStructuresInFoundingPhase(SiedlerGame game, Parser parser, Boolean payout){ + + parser.displayGameboard(game.getBoard().getTextView()); + parser.playerTurn(game.getCurrentPlayerFaction()); + + + //build Settlement + parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); + boolean sucessful = false; + do{ + if(game.placeInitialSettlement(parser.getPoint(), payout)) { + sucessful = true; + } + else{ + parser.errorMessage(); + } + } while(!sucessful); + + //build Road + parser.displayGameboard(game.getBoard().getTextView()); + parser.giveCoordinatesForStructures(Config.Structure.ROAD); + sucessful = false; + do{ + if(game.placeInitialRoad(parser.getPoint(), parser.getPoint())) { + sucessful = true; + } + else{ + parser.errorMessage(); + } + } while(!sucessful); + } + + } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9245724..2fa7aec 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -144,7 +144,7 @@ public class SiedlerGame { */ public boolean placeInitialSettlement(Point position, boolean payout) { // TODO: Implement - return false; + return true; } /** @@ -157,7 +157,7 @@ public class SiedlerGame { */ public boolean placeInitialRoad(Point roadStart, Point roadEnd) { // TODO: Implement - return false; + return true; } /** @@ -220,6 +220,11 @@ public class SiedlerGame { return true; } + public boolean buildSettlementFoundation(Point position) { + //todo implement + return true; + } + /** * Builds a city at the specified position on the board. * @@ -276,6 +281,19 @@ public class SiedlerGame { } + + + + private boolean validPositionForRoad(Point position){ + //todo implement + return true; + } + + private boolean validPositionForSettlement(Point position){ + //todo implement + return true; + } + /** * Trades in {@link #FOUR_TO_ONE_TRADE_OFFER} resource cards of the * offered type for {@link #FOUR_TO_ONE_TRADE_WANT} resource cards of the wanted type. @@ -312,10 +330,10 @@ public class SiedlerGame { for(Structure structure : structures) { int newWinPoints = 0; - if(structure instanceof Settlement){ - newWinPoints = 1; - } else if(structure instanceof City) { + if(structure instanceof City){ newWinPoints = 2; + } else if(structure instanceof Settlement) { + newWinPoints = 1; } Faction faction = structure.getFaction(); @@ -327,6 +345,7 @@ public class SiedlerGame { } } + //todo add points for longest road return winPoints; } From f65449df56ac7ca854229af17e49eb29af6a2e98 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 17:23:48 +0100 Subject: [PATCH 37/68] eroorMessage method prinlText Output minorly changed --- src/ch/zhaw/catan/Parser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 6cf7edf..5507656 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -28,14 +28,14 @@ public class Parser { public HashMap gameStart(){ HashMap gameStartValues = new HashMap<>(); gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:")); - gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoint needed for Victory:")); + gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoints needed for Victory:")); return gameStartValues; } public void giveCoordinatesForStructures(Config.Structure structure) { textTerminal.println("Please insert coordinates for " + structure); if(structure == Config.Structure.ROAD) { - textTerminal.println("You are building a road, please first insert the start coordinate and when prompted again the coordinate of the end of the road."); + textTerminal.println("Please first insert the start coordinate and when prompted again the coordinate of the end of the road."); } } @@ -46,7 +46,7 @@ public class Parser { } public void playerTurn(Config.Faction faction) { - textTerminal.println("It is" + faction + "'s turn."); + textTerminal.println("It is " + faction.name() + "'s turn."); } public void errorMessage(){ From 9294cbc3e340a4198a3e91cd6a11de03eb2e0ffc Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 17:39:33 +0100 Subject: [PATCH 38/68] fix bug in switchToPreviousPlayer --- src/ch/zhaw/catan/SiedlerGame.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 2fa7aec..9041b88 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -58,10 +58,10 @@ public class SiedlerGame { * Switches to the next player in the defined sequence of players. */ public void switchToNextPlayer() { - if (activePlayer < allPlayers.size()){ + if (activePlayer < allPlayers.size() -1){ activePlayer++; } - else if (activePlayer == allPlayers.size()){ + else if (activePlayer == allPlayers.size() -1){ activePlayer = 0; } } From fb38fc07b070642238a5f31ed4f4e16aafc9144b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 17:57:28 +0100 Subject: [PATCH 39/68] completed founding Phase --- src/ch/zhaw/catan/Siedler.java | 33 +++++++++++++++++++++++++----- src/ch/zhaw/catan/SiedlerGame.java | 5 ----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 2b24797..9798c46 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -6,6 +6,9 @@ import org.beryx.textio.TextTerminal; import java.util.HashMap; +import static ch.zhaw.catan.Command.*; +import static ch.zhaw.catan.Command.QUIT; + public class Siedler { public static void main(String[] args) { @@ -14,11 +17,29 @@ public class Siedler { Parser parser = new Parser(); SiedlerGame game = foundingPhase(parser); - parser.getAction(); - - - //Spielfeld ausgeben - + boolean running = true; + while (running){ + parser.playerTurn(game.getCurrentPlayerFaction()); + switch (parser.getAction()) { + case NEXTPLAYER: + game.switchToNextPlayer(); + break; + case BUILDSETTLEMENT: + game. + break; + case BUILDCITY: + break; + case BUILDROAD: + break; + case TRADEWITHBANK: + break; + case QUIT: + running = false; + break; + default: + parser.errorMessage(); + } + } @@ -32,12 +53,14 @@ public class Siedler { private static SiedlerGame foundingPhase(Parser parser) { HashMap gameInfo = parser.gameStart(); SiedlerGame game = new SiedlerGame(gameInfo.get("NumberOfWinPoints"), gameInfo.get("NumberOfPlayers")); + for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){ buildStructuresInFoundingPhase(game, parser, false); if(player < gameInfo.get("NumberOfPlayers")){ game.switchToPreviousPlayer(); } } + for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){ buildStructuresInFoundingPhase(game, parser, true); game.switchToNextPlayer(); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9041b88..23dbe75 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -220,11 +220,6 @@ public class SiedlerGame { return true; } - public boolean buildSettlementFoundation(Point position) { - //todo implement - return true; - } - /** * Builds a city at the specified position on the board. * From 474864316360f614700d1710adfcd9ebfc33f428 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 18:07:02 +0100 Subject: [PATCH 40/68] added method trade to Parser --- src/ch/zhaw/catan/Parser.java | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 5507656..eb15669 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -54,22 +54,15 @@ public class Parser { } public Command getAction() { - switch (textIO.newEnumInputReader(Command.class).read("What would you like to do?")) { - case NEXTPLAYER: - return NEXTPLAYER; - case BUILDSETTLEMENT: - return BUILDSETTLEMENT; - case BUILDCITY: - return BUILDCITY; - case BUILDROAD: - return BUILDROAD; - case TRADEWITHBANK: - return TRADEWITHBANK; - case QUIT: - return QUIT; - default: - return null; + return textIO.newEnumInputReader(Command.class).read("What would you like to do?"); + } + + public Config.Resource trade(boolean give) { + String output = "give"; + if (!give){ + output = "receive"; } + return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + give ); } } From 7b23ed5380bc8862ac392772ae7343ab9cb63b4c Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 18:12:04 +0100 Subject: [PATCH 41/68] changes in mainMethod --- src/ch/zhaw/catan/Siedler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 9798c46..7bafff8 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -25,16 +25,24 @@ public class Siedler { game.switchToNextPlayer(); break; case BUILDSETTLEMENT: - game. + parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); + game.buildSettlement(parser.getPoint()); break; case BUILDCITY: + parser.giveCoordinatesForStructures(Config.Structure.CITY); + game.buildCity(parser.getPoint()); break; case BUILDROAD: + parser.giveCoordinatesForStructures(Config.Structure.ROAD); + game.buildRoad(parser.getPoint(), parser.getPoint()); break; case TRADEWITHBANK: + Config.Resource toGive = parser.trade(true); + Config.Resource toGet = parser.trade(false); break; case QUIT: running = false; + //todo clone windows break; default: parser.errorMessage(); From 7c84f7f600c9e0271edde71832ea94e8048ef28d Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 18:47:00 +0100 Subject: [PATCH 42/68] changes in mainMethod --- src/ch/zhaw/catan/Siedler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 7bafff8..7f21096 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -20,6 +20,7 @@ public class Siedler { boolean running = true; while (running){ parser.playerTurn(game.getCurrentPlayerFaction()); + switch (parser.getAction()) { case NEXTPLAYER: game.switchToNextPlayer(); @@ -37,8 +38,11 @@ public class Siedler { game.buildRoad(parser.getPoint(), parser.getPoint()); break; case TRADEWITHBANK: - Config.Resource toGive = parser.trade(true); - Config.Resource toGet = parser.trade(false); + Config.Resource offer = parser.trade(true); + Config.Resource want = parser.trade(false); + if(!game.tradeWithBankFourToOne(offer, want)){ + parser.errorMessage(); + } break; case QUIT: running = false; From 0c635406169d7ae0b590d2dd16c357eb805a0a75 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 19:05:14 +0100 Subject: [PATCH 43/68] changes in mainMethod added Method displayPlayerResourceStock to Parser --- src/ch/zhaw/catan/Parser.java | 7 +++++++ src/ch/zhaw/catan/Siedler.java | 4 ++-- src/ch/zhaw/catan/SiedlerGame.java | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index eb15669..933532d 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -25,6 +25,13 @@ public class Parser { textTerminal.println(gameboard); } + public void displayPlayerResourceStock(HashMap curruntPlayerResource){ + textTerminal.println("You own the follwing Resources"); + for(Config.Resource resource : curruntPlayerResource.keySet()){ + textTerminal.println(resource.name() + ":" + curruntPlayerResource.get(resource)); + } + } + public HashMap gameStart(){ HashMap gameStartValues = new HashMap<>(); gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:")); diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 7f21096..6c39048 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -16,11 +16,11 @@ public class Siedler { //Spiel erstellen Parser parser = new Parser(); SiedlerGame game = foundingPhase(parser); - boolean running = true; while (running){ + parser.displayGameboard(game.getBoard().getTextView()); parser.playerTurn(game.getCurrentPlayerFaction()); - + parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); switch (parser.getAction()) { case NEXTPLAYER: game.switchToNextPlayer(); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 23dbe75..9559984 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -130,6 +130,10 @@ public class SiedlerGame { return allPlayers.get(activePlayer).getSpecificResource(resource); } + public HashMap getCurruntPlayerResource() { + return allPlayers.get(activePlayer).getResources(); + } + /** * Places a settlement in the founder's phase (phase II) of the game. * From 1362850570b63bab60a130b235e9c02abd350c7f Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 19:13:16 +0100 Subject: [PATCH 44/68] changes in mainMethod --- src/ch/zhaw/catan/Siedler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 6c39048..f5dd522 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -5,6 +5,7 @@ import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextTerminal; import java.util.HashMap; +import java.util.Random; import static ch.zhaw.catan.Command.*; import static ch.zhaw.catan.Command.QUIT; @@ -17,13 +18,22 @@ public class Siedler { Parser parser = new Parser(); SiedlerGame game = foundingPhase(parser); boolean running = true; + boolean diceThrown = false; while (running){ parser.displayGameboard(game.getBoard().getTextView()); parser.playerTurn(game.getCurrentPlayerFaction()); + if(!diceThrown) { + Random random = new Random(); + int thrownDices = random.nextInt(6) + random.nextInt(6); + parser.thrownDices(thrownDices); + //todo resourcen auszahlen + diceThrown = true; + } parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); switch (parser.getAction()) { case NEXTPLAYER: game.switchToNextPlayer(); + diceThrown = false; break; case BUILDSETTLEMENT: parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); From 1c90d185109c69abab9bc72d8ee6cffbe1b24ba0 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 2 Dec 2021 19:16:28 +0100 Subject: [PATCH 45/68] created Method throwDice in Siedler --- src/ch/zhaw/catan/Siedler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index f5dd522..f46161f 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -23,10 +23,7 @@ public class Siedler { parser.displayGameboard(game.getBoard().getTextView()); parser.playerTurn(game.getCurrentPlayerFaction()); if(!diceThrown) { - Random random = new Random(); - int thrownDices = random.nextInt(6) + random.nextInt(6); - parser.thrownDices(thrownDices); - //todo resourcen auszahlen + throwDice(game, parser); diceThrown = true; } parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); @@ -70,6 +67,12 @@ public class Siedler { } + private static void throwDice(SiedlerGame game, Parser parser) { + Random random = new Random(); + int thrownDices = random.nextInt(6) + random.nextInt(6); + parser.thrownDices(thrownDices); + game.throwDice(thrownDices); + } private static SiedlerGame foundingPhase(Parser parser) { From 2de44a1b99bc57245ffb860c5cd67db092cbb4a4 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 07:56:38 +0100 Subject: [PATCH 46/68] change Method throwDice in Siedler --- src/ch/zhaw/catan/Siedler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index f46161f..5279482 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -69,7 +69,8 @@ public class Siedler { private static void throwDice(SiedlerGame game, Parser parser) { Random random = new Random(); - int thrownDices = random.nextInt(6) + random.nextInt(6); + //sum of two integers from 0-5 + 2 --> sum of two integers from 1-6 + int thrownDices = random.nextInt(6) + random.nextInt(6) + 2; parser.thrownDices(thrownDices); game.throwDice(thrownDices); } From 060310aebc8195a6a8f1d8b0d7a5d47218e9b1b9 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 08:12:21 +0100 Subject: [PATCH 47/68] change in Main Method --- src/ch/zhaw/catan/Parser.java | 4 ++++ src/ch/zhaw/catan/Siedler.java | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 933532d..0632d9d 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -32,6 +32,10 @@ public class Parser { } } + public void displayWinnertext(Config.Faction winner){ + textTerminal.println(winner.name() + "won the game!"); + } + public HashMap gameStart(){ HashMap gameStartValues = new HashMap<>(); gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(2).withMaxVal(4).read("Number of players:")); diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 5279482..df3fc8d 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -29,9 +29,15 @@ public class Siedler { parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); switch (parser.getAction()) { case NEXTPLAYER: - game.switchToNextPlayer(); - diceThrown = false; - break; + Config.Faction winner = game.getWinner(); + if(winner == null) { + game.switchToNextPlayer(); + diceThrown = false; + break; + } else { + parser.displayWinnertext(winner); + running = false; + } case BUILDSETTLEMENT: parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); game.buildSettlement(parser.getPoint()); @@ -53,18 +59,12 @@ public class Siedler { break; case QUIT: running = false; - //todo clone windows + //todo close window break; default: parser.errorMessage(); } } - - - - - - } private static void throwDice(SiedlerGame game, Parser parser) { From d749838600fca6d99e4908b1c31a3a92a8c37ef1 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 08:28:58 +0100 Subject: [PATCH 48/68] fixed Error in trade method in Parser --- src/ch/zhaw/catan/Parser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 0632d9d..86d9f9a 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -73,7 +73,7 @@ public class Parser { if (!give){ output = "receive"; } - return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + give ); + return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + output ); } } From 57649df6baba4218d2a34216ba0ead453d5f5053 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 08:32:51 +0100 Subject: [PATCH 49/68] Fixed grammar error in method displayPlayerResource Stock. --- src/ch/zhaw/catan/Parser.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 86d9f9a..6421d23 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -25,10 +25,10 @@ public class Parser { textTerminal.println(gameboard); } - public void displayPlayerResourceStock(HashMap curruntPlayerResource){ + public void displayPlayerResourceStock(HashMap currentPlayerResource){ textTerminal.println("You own the follwing Resources"); - for(Config.Resource resource : curruntPlayerResource.keySet()){ - textTerminal.println(resource.name() + ":" + curruntPlayerResource.get(resource)); + for(Config.Resource resource : currentPlayerResource.keySet()){ + textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource)); } } @@ -52,8 +52,6 @@ public class Parser { public void thrownDices(int number){ textTerminal.println ("Dices have been thrown, the combined value is: " + number); - - } public void playerTurn(Config.Faction faction) { From f60b65af83f537374bedd20cf280a167984f488a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 08:34:48 +0100 Subject: [PATCH 50/68] fixed Error in Main Method --- src/ch/zhaw/catan/Siedler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index df3fc8d..ca591ef 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -30,14 +30,14 @@ public class Siedler { switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); - if(winner == null) { + if(winner == null && false) { //todo remove false game.switchToNextPlayer(); diceThrown = false; - break; } else { - parser.displayWinnertext(winner); + parser.displayWinnertext(game.getCurrentPlayerFaction());//todo replace with winner running = false; } + break; case BUILDSETTLEMENT: parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); game.buildSettlement(parser.getPoint()); From 1e49424b9ce03bd518ac28396b85c106ef62498f Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 08:35:37 +0100 Subject: [PATCH 51/68] fixed Error in Main Method --- src/ch/zhaw/catan/Siedler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index ca591ef..d97cdb8 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -30,11 +30,11 @@ public class Siedler { switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); - if(winner == null && false) { //todo remove false + if(winner == null) { game.switchToNextPlayer(); diceThrown = false; } else { - parser.displayWinnertext(game.getCurrentPlayerFaction());//todo replace with winner + parser.displayWinnertext(winner); running = false; } break; From ff734bce2355949630f6fd8b47ef92a51d38679e Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 08:48:26 +0100 Subject: [PATCH 52/68] Delected CommandWords.java added quit Method in Parser Fixed minor grammar mistakes in Siedler Game --- src/ch/zhaw/catan/CommandWords.java | 4 ---- src/ch/zhaw/catan/Parser.java | 17 ++++++++++++++--- src/ch/zhaw/catan/SiedlerGame.java | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) delete mode 100644 src/ch/zhaw/catan/CommandWords.java diff --git a/src/ch/zhaw/catan/CommandWords.java b/src/ch/zhaw/catan/CommandWords.java deleted file mode 100644 index d67b327..0000000 --- a/src/ch/zhaw/catan/CommandWords.java +++ /dev/null @@ -1,4 +0,0 @@ -package ch.zhaw.catan; - -public class CommandWords { -} diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 6421d23..1a4c6dd 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -25,15 +25,16 @@ public class Parser { textTerminal.println(gameboard); } - public void displayPlayerResourceStock(HashMap currentPlayerResource){ - textTerminal.println("You own the follwing Resources"); + public void displayPlayerInfo(HashMap currentPlayerResource, int winpoints){ + textTerminal.println("You are currently holding" + winpoints + " winpoints."); + textTerminal.println("You own the follwing resources:"); for(Config.Resource resource : currentPlayerResource.keySet()){ textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource)); } } public void displayWinnertext(Config.Faction winner){ - textTerminal.println(winner.name() + "won the game!"); + textTerminal.println(winner.name() + " won the game!"); } public HashMap gameStart(){ @@ -66,6 +67,11 @@ public class Parser { return textIO.newEnumInputReader(Command.class).read("What would you like to do?"); } + /** + * + * @param give if true ask for resource to give if false for resource to receive + * @return + */ public Config.Resource trade(boolean give) { String output = "give"; if (!give){ @@ -73,5 +79,10 @@ public class Parser { } return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + output ); } + public void quit(){ + textTerminal.dispose(); + textIO.dispose(); + } + } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9559984..ff80402 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -130,7 +130,7 @@ public class SiedlerGame { return allPlayers.get(activePlayer).getSpecificResource(resource); } - public HashMap getCurruntPlayerResource() { + public HashMap getCurrentPlayerResource() { return allPlayers.get(activePlayer).getResources(); } From c387420ca8c98f9d94d6c2e50555ca7b24e8d3bd Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 08:52:26 +0100 Subject: [PATCH 53/68] Siedler Class minor bug fixes --- src/ch/zhaw/catan/Siedler.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index d97cdb8..3149132 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -1,15 +1,8 @@ package ch.zhaw.catan; -import org.beryx.textio.TextIO; -import org.beryx.textio.TextIoFactory; -import org.beryx.textio.TextTerminal; - import java.util.HashMap; import java.util.Random; -import static ch.zhaw.catan.Command.*; -import static ch.zhaw.catan.Command.QUIT; - public class Siedler { public static void main(String[] args) { @@ -26,7 +19,7 @@ public class Siedler { throwDice(game, parser); diceThrown = true; } - parser.displayPlayerResourceStock(game.getCurruntPlayerResource()); + parser.displayPlayerInfo(game.getCurrentPlayerResource(),1); switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); From 7d1a326dc016e19b3865776e8564a49ccaae3be9 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 08:54:27 +0100 Subject: [PATCH 54/68] change in Main Method --- src/ch/zhaw/catan/Siedler.java | 3 ++- src/ch/zhaw/catan/SiedlerGame.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 3149132..c446197 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -19,7 +19,7 @@ public class Siedler { throwDice(game, parser); diceThrown = true; } - parser.displayPlayerInfo(game.getCurrentPlayerResource(),1); + parser.displayPlayerInfo(game.getCurrentPlayerResource(),game.getWinPoints().get(game.getCurrentPlayerFaction())); switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); @@ -64,6 +64,7 @@ public class Siedler { Random random = new Random(); //sum of two integers from 0-5 + 2 --> sum of two integers from 1-6 int thrownDices = random.nextInt(6) + random.nextInt(6) + 2; + //todo check if 7 parser.thrownDices(thrownDices); game.throwDice(thrownDices); } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index ff80402..8298fd9 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -323,7 +323,7 @@ public class SiedlerGame { return null; } - private HashMap getWinPoints(){ + public HashMap getWinPoints(){ HashMap winPoints = new HashMap<>(); List structures = board.getCorners(); for(Structure structure : structures) { From 8a494b247bb500208dae8a15f8344fc18b1ae406 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 09:01:24 +0100 Subject: [PATCH 55/68] change in Main Method --- src/ch/zhaw/catan/Siedler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index c446197..5088591 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -52,7 +52,7 @@ public class Siedler { break; case QUIT: running = false; - //todo close window + parser.quit(); break; default: parser.errorMessage(); From 8811410e442ada497f6c493d977cc75714dab8e8 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 09:37:19 +0100 Subject: [PATCH 56/68] change in Main Method changed Method getWinner and getCurrentPlayerWinpoints --- src/ch/zhaw/catan/Siedler.java | 18 +++++++++++++----- src/ch/zhaw/catan/SiedlerGame.java | 21 ++++++--------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 5088591..8549296 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -13,13 +13,15 @@ public class Siedler { boolean running = true; boolean diceThrown = false; while (running){ + Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction(); parser.displayGameboard(game.getBoard().getTextView()); - parser.playerTurn(game.getCurrentPlayerFaction()); + parser.playerTurn(currentPlayerFaction); if(!diceThrown) { throwDice(game, parser); diceThrown = true; } - parser.displayPlayerInfo(game.getCurrentPlayerResource(),game.getWinPoints().get(game.getCurrentPlayerFaction())); + + parser.displayPlayerInfo(game.getCurrentPlayerResource(), game.getCurrentPlayerWinpoints()); switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); @@ -33,15 +35,21 @@ public class Siedler { break; case BUILDSETTLEMENT: parser.giveCoordinatesForStructures(Config.Structure.SETTLEMENT); - game.buildSettlement(parser.getPoint()); + if(!game.buildSettlement(parser.getPoint())){ + parser.errorMessage(); + } break; case BUILDCITY: parser.giveCoordinatesForStructures(Config.Structure.CITY); - game.buildCity(parser.getPoint()); + if(!game.buildCity(parser.getPoint())){ + parser.errorMessage(); + } break; case BUILDROAD: parser.giveCoordinatesForStructures(Config.Structure.ROAD); - game.buildRoad(parser.getPoint(), parser.getPoint()); + if(game.buildRoad(parser.getPoint(), parser.getPoint())){ + parser.errorMessage(); + } break; case TRADEWITHBANK: Config.Resource offer = parser.trade(true); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 8298fd9..4df7ee6 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -314,17 +314,14 @@ public class SiedlerGame { * @return the winner of the game or null, if there is no winner (yet) */ public Faction getWinner() { - HashMap winPoints = getWinPoints(); - for(Faction faction : winPoints.keySet()){ - if(winPoints.get(faction) >= winPointsForWin){ - return faction; - } + if(getCurrentPlayerWinpoints() >= winPointsForWin){ + return getCurrentPlayerFaction(); } return null; } - public HashMap getWinPoints(){ - HashMap winPoints = new HashMap<>(); + public int getCurrentPlayerWinpoints(){ + int winPoints = 0; List structures = board.getCorners(); for(Structure structure : structures) { @@ -334,15 +331,9 @@ public class SiedlerGame { } else if(structure instanceof Settlement) { newWinPoints = 1; } - - Faction faction = structure.getFaction(); - if(winPoints.containsKey(faction)) { - winPoints.put(faction, winPoints.get(faction) + newWinPoints); + if(structure.getFaction() == getCurrentPlayerFaction()){ + winPoints ++; } - else { - winPoints.put(faction, newWinPoints); - } - } //todo add points for longest road return winPoints; From a5f856313dea0d1685dd359f0ad199c8216325be Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 3 Dec 2021 09:42:29 +0100 Subject: [PATCH 57/68] created method in SiedlerGame: -checkAdjacentCornerList -checkAdjacentEdgesList -validPositionForSettlement -validPositionForRoad updated method in SiedlerGame: -buildRoad -buildSettlement --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/SiedlerBoard.java | 2 +- src/ch/zhaw/catan/SiedlerBoardTextView.java | 3 +- src/ch/zhaw/catan/SiedlerGame.java | 103 +++++++++++++++----- 4 files changed, 83 insertions(+), 27 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index e27f855..5a36dc7 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -8,7 +8,7 @@ import java.awt.*; import java.util.List; import java.util.*; -public class SiedlerBoard extends HexBoard { +public class SiedlerBoard extends HexBoard { Map lowerFieldLabel = new HashMap<>(); diff --git a/src/ch/zhaw/catan/SiedlerBoardTextView.java b/src/ch/zhaw/catan/SiedlerBoardTextView.java index 97f6401..ce2ca66 100644 --- a/src/ch/zhaw/catan/SiedlerBoardTextView.java +++ b/src/ch/zhaw/catan/SiedlerBoardTextView.java @@ -5,8 +5,9 @@ import ch.zhaw.hexboard.HexBoardTextView; import ch.zhaw.hexboard.Label; import java.awt.*; +import java.util.Set; -public class SiedlerBoardTextView extends HexBoardTextView { +public class SiedlerBoardTextView extends HexBoardTextView { public SiedlerBoardTextView(SiedlerBoard board) { super(board); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9559984..df260e2 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -204,20 +204,19 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildSettlement(Point position) { - //TODO Errors should be caught after this method is executed and returns false - //1. Check if Corner - if (!board.hasCorner(position)) { + //1. Check if position is corner && is empty && neighbour Corners are empty + if(!validPositionForSettlement(position)) { return false; } - //2. Check if Corner is empty - if (board.getCorner(position) != null) { + //2. Check if neighbourEdge are Roads belong to active Player + if(!checkAdjacentEdgesList(position)) { return false; } //3. Can Player build Settlement if (!allPlayers.get(activePlayer).buildSettlement()) { return false; } - //4. Insert Road to map + //4. Insert Settlement to map board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction())); //5. Give Resoure to bank bank.storeResourceToBank(Config.Structure.SETTLEMENT.getCosts()); @@ -257,39 +256,95 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildRoad(Point roadStart, Point roadEnd) { - //1. Check if Edge - if (!board.hasEdge(roadStart, roadEnd)) { - // TODO: Error message + //1. Check if is edge && is empty && if neighbour Edge or Corners belong to Settlement of active Player + if (!validPositionForRoad(roadStart,roadEnd)){ return false; } - //2. Check if Edge is empty - if (board.getEdge(roadStart, roadEnd) != null) { - // TODO: Error message - return false; - } - //3. Can Player build road + //2. Can Player build road if (!allPlayers.get(activePlayer).buildRoad()) { // TODO: Error message return false; } - //4. Insert Road to map + //3. Insert Road to map board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction())); - //5. Give Resource to bank + //4. Give Resource to bank bank.storeResourceToBank(Config.Structure.ROAD.getCosts()); return true; } + /** + * Can be used for both initial Settlement and normal Phase. + * @param roadStart + * @param roadEnd + * @return + */ + private boolean validPositionForRoad(Point roadStart, Point roadEnd){ + //1. Check if Edge + if (!board.hasEdge(roadStart, roadEnd)) { + return false; + } + //2. Check if Edge is empty + if (board.getEdge(roadStart, roadEnd) != null) { + return false; + } + //3. Check if NeighbourEdge are Roads + boolean hasNeighbourRoad = (checkAdjacentEdgesList(roadStart) || checkAdjacentEdgesList(roadEnd)); + //4.Check if roadStart or roadEnd is Settlement of current player or if 3. is valid + if(board.getCorner(roadStart).getFaction() == allPlayers.get(activePlayer).getFaction() + || board.getCorner(roadEnd).getFaction() == allPlayers.get(activePlayer).getFaction() + || hasNeighbourRoad){ + return true; + } + return false; + } - - - private boolean validPositionForRoad(Point position){ - //todo implement + /** + * Do not use for initial Settlement + * @param position + * @return + */ + private boolean validPositionForSettlement(Point position){ + //1. Check if Corner + if (!board.hasCorner(position)) { + return false; + } + //2. Check if Corner is empty + if(board.getCorner(position) != null) { + return false; + } + //3. Check if neighbourCorners are empty + if(!checkAdjacentCornerList(position)) { + return false; + } return true; } - private boolean validPositionForSettlement(Point position){ - //todo implement + /** + * This method checks if there are Roads build by active Player on adjacent edges + * @param point + * @return + */ + private boolean checkAdjacentEdgesList(Point point) { + List results = board.getAdjacentEdges(point); + for(int i = 0; i < results.size(); i++) { + if(results.get(i).getFaction() == allPlayers.get(activePlayer).getFaction()) { + return true; + } + } + return false; + } + + /** + * Checks if Adjacent Corners are empty + * @param point Corner to check + * @return true if all Neighbour Corners are emtpy + */ + private boolean checkAdjacentCornerList(Point point) { + List results = board.getNeighboursOfCorner(point); + if(results.size() > 0) { + return false; + } return true; } @@ -325,7 +380,7 @@ public class SiedlerGame { private HashMap getWinPoints(){ HashMap winPoints = new HashMap<>(); - List structures = board.getCorners(); + List structures = board.getCorners(); for(Structure structure : structures) { int newWinPoints = 0; From 70b27af0381aaabd2e51aadb5c7b9037c00aed75 Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Fri, 3 Dec 2021 09:48:30 +0100 Subject: [PATCH 58/68] Added method buildCity. --- src/ch/zhaw/catan/Player.java | 24 +++++++++++++++++++++--- src/ch/zhaw/catan/SiedlerGame.java | 17 ++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index d7b7bc3..2011fe8 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -13,6 +13,7 @@ public class Player { private HashMap resources; private int roadsToUse; private int settlementsToUse; + private int citiesToUse; public Player (Config.Faction faction){ //Datenfelder @@ -91,9 +92,9 @@ public class Player { /** * This method has to be used when a player wants to build a settlement. It checks if a player has enough roads - * and resources to build one more. If player is able to build, the method substract the buildcost from the resources - * in possesion by the player. - * @return true if road can be created false if road can't be created + * and resources to build one more. If the player is able to build, this method subtracts the buildcost from the resources + * in possession by the player. + * @return true if road can be created false if road can't be created. */ public boolean buildSettlement() { List costs = Config.Structure.SETTLEMENT.getCosts(); @@ -106,6 +107,23 @@ public class Player { return true; } + /** + * This method has to be used when a player wants to build a city. It checks if a player already has a settlement + * on that position and if he has enough resource to build one. If the player is able to build, this method subtracts + * the buildcost from the resources in possession by the player. + * @return true if road can be created false if road can't be created. + */ + public boolean buildCity() { + List costs = Config.Structure.CITY.getCosts(); + if ( citiesToUse == 0 || !checkRessourceToBuild(costs)){ + return false; + } + for (Config.Resource resource : costs){ + resources.put(resource,resources.get(resource)-1); + } + return true; + } + //returns true if player has enough resources else false private boolean checkRessourceToBuild(List liste) { for (Config.Resource resource : liste) { diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 9559984..5698f28 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -219,7 +219,7 @@ public class SiedlerGame { } //4. Insert Road to map board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction())); - //5. Give Resoure to bank + //5. Give Resources to bank bank.storeResourceToBank(Config.Structure.SETTLEMENT.getCosts()); return true; } @@ -239,6 +239,21 @@ public class SiedlerGame { */ public boolean buildCity(Point position) { // TODO: OPTIONAL task - Implement + //1. Check if Corner. + if (!board.hasCorner(position)){ + return false; + } + //2. Check if Settlement has already been built + Settlement atCurrentPosition = (Settlement) board.getCorner(position); + + //3. Can player build a City. + if(!allPlayers.get(activePlayer).buildCity()){ + return false; + } + //4.Insert City into the map. + board.setCorner(position,new City(allPlayers.get(activePlayer).getFaction())); + //5. Give resources to the bank. + bank.storeResourceToBank(Config.Structure.CITY.getCosts()); return false; } From b4783c8009c357548e8bb56646ec4e37cec55cd8 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 3 Dec 2021 09:52:42 +0100 Subject: [PATCH 59/68] changed javadoc --- src/ch/zhaw/catan/SiedlerGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index a9a9463..8dfece8 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -315,7 +315,7 @@ public class SiedlerGame { } /** - * Do not use for initial Settlement + * Can be used for both initial Settlement and normal Phase. * @param position * @return */ From c45471c3373942a7664b5b17175c27ba4562b950 Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Fri, 3 Dec 2021 09:57:42 +0100 Subject: [PATCH 60/68] Added method buildCity. --- src/ch/zhaw/catan/SiedlerGame.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 8dfece8..f9fd45b 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -243,8 +243,10 @@ public class SiedlerGame { return false; } //2. Check if Settlement has already been built - Settlement atCurrentPosition = (Settlement) board.getCorner(position); - + Settlement atCurrentPosition = board.getCorner(position); + if (atCurrentPosition == null){ + return false; + } //3. Can player build a City. if(!allPlayers.get(activePlayer).buildCity()){ return false; From 442cce67616dd74b8748ec67f8755058c0b9747d Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 10:09:17 +0100 Subject: [PATCH 61/68] solved merge problems --- .idea/misc.xml | 2 +- src/ch/zhaw/catan/Siedler.java | 3 +- src/ch/zhaw/catan/SiedlerGame.java | 47 ++++++++++++------------------ 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..c3dfb30 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 8549296..eaee90e 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -20,8 +20,7 @@ public class Siedler { throwDice(game, parser); diceThrown = true; } - - parser.displayPlayerInfo(game.getCurrentPlayerResource(), game.getCurrentPlayerWinpoints()); + parser.displayPlayerInfo(game.getCurruntPlayerResource(), game.getCurrentPlayerWinpoints()); switch (parser.getAction()) { case NEXTPLAYER: Config.Faction winner = game.getWinner(); diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index f9fd45b..af4d862 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -385,40 +385,31 @@ public class SiedlerGame { * * @return the winner of the game or null, if there is no winner (yet) */ - public Faction getWinner() { - HashMap winPoints = getWinPoints(); - for(Faction faction : winPoints.keySet()){ - if(winPoints.get(faction) >= winPointsForWin){ - return faction; + public Faction getWinner() { + if(getCurrentPlayerWinpoints() >= winPointsForWin){ + return getCurrentPlayerFaction(); } + return null; } - return null; - } - private HashMap getWinPoints(){ - HashMap winPoints = new HashMap<>(); - List structures = board.getCorners(); - for(Structure structure : structures) { + public int getCurrentPlayerWinpoints(){ + int winPoints = 0; + List settlements = board.getCorners(); + for(Structure structure : settlements) { - int newWinPoints = 0; - if(structure instanceof City){ - newWinPoints = 2; - } else if(structure instanceof Settlement) { - newWinPoints = 1; + int newWinPoints = 0; + if(structure instanceof City){ + newWinPoints = 2; + } else if(structure instanceof Settlement) { + newWinPoints = 1; + } + if(structure.getFaction() == getCurrentPlayerFaction()){ + winPoints ++; + } } - - Faction faction = structure.getFaction(); - if(winPoints.containsKey(faction)) { - winPoints.put(faction, winPoints.get(faction) + newWinPoints); - } - else { - winPoints.put(faction, newWinPoints); - } - + //todo add points for longest road + return winPoints; } - //todo add points for longest road - return winPoints; - } /** From 8cb13ce0a6b2dd62491ec76459760514c6684a7a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 10:36:53 +0100 Subject: [PATCH 62/68] change in getCurrentPlayerWinpoints --- src/ch/zhaw/catan/SiedlerGame.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index af4d862..af78ce0 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -407,10 +407,16 @@ public class SiedlerGame { winPoints ++; } } - //todo add points for longest road + if(getLongestRoadFaction() == getCurrentPlayerFaction()){ + winPoints = winPoints + 2; + } return winPoints; } + private Faction getLongestRoadFaction() { + return null; //todo implement + } + /** * Places the thief on the specified field and steals a random resource card (if From 8fc77abdd04f4c16523f86399e8adaa77f47c162 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 10:48:59 +0100 Subject: [PATCH 63/68] added Method toString in City --- src/ch/zhaw/catan/City.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ch/zhaw/catan/City.java b/src/ch/zhaw/catan/City.java index 5e16c18..499bf87 100644 --- a/src/ch/zhaw/catan/City.java +++ b/src/ch/zhaw/catan/City.java @@ -5,4 +5,8 @@ public class City extends Settlement { public City(Config.Faction faction) { super(faction); } + + public String toString() { + return super.getFaction().toString().toUpperCase(); + } } From 7c913089b50c4088e44c087fdeae179ed833617e Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 11:15:07 +0100 Subject: [PATCH 64/68] reated Class Field --- src/ch/zhaw/catan/Field.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/ch/zhaw/catan/Field.java diff --git a/src/ch/zhaw/catan/Field.java b/src/ch/zhaw/catan/Field.java new file mode 100644 index 0000000..38a4774 --- /dev/null +++ b/src/ch/zhaw/catan/Field.java @@ -0,0 +1,18 @@ +package ch.zhaw.catan; + +public class Field { + + private Config.Land land; + + public Field(Config.Land land){ + this.land = land; + } + + public Config.Resource getResource(){ + return land.getResource(); + } + + public Config.Land getLand() { + return land; + } +} From 2dfe55584ec7bc2eb1987de30a99f81a0bdddb7d Mon Sep 17 00:00:00 2001 From: Speedy Gonzalez Date: Fri, 3 Dec 2021 11:28:42 +0100 Subject: [PATCH 65/68] Added placeInitialRoad and placeInitialSettlement methods. --- src/ch/zhaw/catan/SiedlerGame.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index af4d862..d926afb 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -148,6 +148,14 @@ public class SiedlerGame { */ public boolean placeInitialSettlement(Point position, boolean payout) { // TODO: Implement + if(!validPositionForSettlement(position)){ + return false; + } + board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction())); + List lands = board.getLandsForCorner(position); + for (Config.Land land:lands){ + allPlayers.get(activePlayer).addResource(land.getResource(), 1); + } return true; } @@ -161,6 +169,10 @@ public class SiedlerGame { */ public boolean placeInitialRoad(Point roadStart, Point roadEnd) { // TODO: Implement + if (!validPositionForRoad(roadStart, roadEnd)){ + return false; + } + board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction())); return true; } From b38e24b6128ec74d5cd351d9eb39a009724cdb1e Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 11:52:32 +0100 Subject: [PATCH 66/68] changes in Siedler Board. Usage of Field Class added. --- src/ch/zhaw/catan/Field.java | 10 +++++++++- src/ch/zhaw/catan/SiedlerBoard.java | 27 +++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/ch/zhaw/catan/Field.java b/src/ch/zhaw/catan/Field.java index 38a4774..1da46c7 100644 --- a/src/ch/zhaw/catan/Field.java +++ b/src/ch/zhaw/catan/Field.java @@ -1,11 +1,15 @@ package ch.zhaw.catan; +import ch.zhaw.hexboard.Label; + public class Field { private Config.Land land; + private Label label; - public Field(Config.Land land){ + public Field(Config.Land land, Label label){ this.land = land; + this.label = label; } public Config.Resource getResource(){ @@ -15,4 +19,8 @@ public class Field { public Config.Land getLand() { return land; } + + public Label getLabel() { + return label; + } } diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 5a36dc7..64a2646 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -10,38 +10,37 @@ import java.util.*; public class SiedlerBoard extends HexBoard { - Map lowerFieldLabel = new HashMap<>(); + Map lowerFieldLabel = new HashMap<>(); public void createFixGamefield(){ Map resourcePlacement = Config.getStandardLandPlacement(); Map dicePlacement = Config.getStandardDiceNumberPlacement(); for (Map.Entry resourceField : resourcePlacement.entrySet()) { addField(resourceField.getKey(),resourceField.getValue()); - } - for (Map.Entry diceField : dicePlacement.entrySet()) { - String numberAsString = diceField.getValue().toString(); - char[] numbersInChar = numberAsString.toCharArray(); - if (numberAsString.length() < 2) { - lowerFieldLabel.put(diceField.getKey(), new Label('0', numbersInChar[0])); - } - else { - lowerFieldLabel.put(diceField.getKey(), new Label(numbersInChar[0],numbersInChar[1])); - + if(dicePlacement.get(resourceField.getKey()) != null){ + String numberAsString = dicePlacement.get(resourceField.getKey()).toString(); + char[] numbersInChar = numberAsString.toCharArray(); + if (numberAsString.length() < 2) { + lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label('0', numbersInChar[0]))); + } + else { + lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label(numbersInChar[0],numbersInChar[1]))); + } } } } private int getDiceNumber(Point field) { - Label label = lowerFieldLabel.get(field); + Label label = lowerFieldLabel.get(field).getLabel(); return Integer.parseInt(label.toString()); } public String getTextView () { SiedlerBoardTextView view = new SiedlerBoardTextView(this); - for (Map.Entry e : lowerFieldLabel.entrySet()) { - view.setLowerFieldLabel(e.getKey(), e.getValue()); + for (Map.Entry e : lowerFieldLabel.entrySet()) { + view.setLowerFieldLabel(e.getKey(), e.getValue().getLabel()); } return view.toString(); } From 8b2b9e2882ddd2d358415c80f2cee6dbc32b34ed Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 3 Dec 2021 11:54:12 +0100 Subject: [PATCH 67/68] rename variables in SiedlerBoard --- src/ch/zhaw/catan/SiedlerBoard.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 64a2646..d560b7a 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -10,7 +10,7 @@ import java.util.*; public class SiedlerBoard extends HexBoard { - Map lowerFieldLabel = new HashMap<>(); + Map fields = new HashMap<>(); public void createFixGamefield(){ Map resourcePlacement = Config.getStandardLandPlacement(); @@ -21,10 +21,10 @@ public class SiedlerBoard extends HexBoard { String numberAsString = dicePlacement.get(resourceField.getKey()).toString(); char[] numbersInChar = numberAsString.toCharArray(); if (numberAsString.length() < 2) { - lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label('0', numbersInChar[0]))); + fields.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label('0', numbersInChar[0]))); } else { - lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label(numbersInChar[0],numbersInChar[1]))); + fields.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label(numbersInChar[0],numbersInChar[1]))); } } } @@ -32,15 +32,15 @@ public class SiedlerBoard extends HexBoard { private int getDiceNumber(Point field) { - Label label = lowerFieldLabel.get(field).getLabel(); + Label label = fields.get(field).getLabel(); return Integer.parseInt(label.toString()); } public String getTextView () { SiedlerBoardTextView view = new SiedlerBoardTextView(this); - for (Map.Entry e : lowerFieldLabel.entrySet()) { - view.setLowerFieldLabel(e.getKey(), e.getValue().getLabel()); + for (Map.Entry field : fields.entrySet()) { + view.setLowerFieldLabel(field.getKey(), field.getValue().getLabel()); } return view.toString(); } @@ -58,7 +58,7 @@ public class SiedlerBoard extends HexBoard { */ public List getFieldsForDiceValue(int dice) { ArrayList fields = new ArrayList<>(); - for(Point field : lowerFieldLabel.keySet()){ + for(Point field : this.fields.keySet()){ if(getDiceNumber(field) == dice){ fields.add(field); } From 7129435feae87f1d5e6ab128675f149193524d1e Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 3 Dec 2021 16:39:11 +0100 Subject: [PATCH 68/68] SiedlerGame throwDice method implemented (for 7 not yet implemented) and method getResourcesforFaction implemented in SiedlerBoard --- src/ch/zhaw/catan/Parser.java | 2 +- src/ch/zhaw/catan/SiedlerBoard.java | 15 +++++++++++++++ src/ch/zhaw/catan/SiedlerGame.java | 15 +++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 1a4c6dd..b298b74 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -26,7 +26,7 @@ public class Parser { } public void displayPlayerInfo(HashMap currentPlayerResource, int winpoints){ - textTerminal.println("You are currently holding" + winpoints + " winpoints."); + textTerminal.println("You are currently holding " + winpoints + " winpoints."); textTerminal.println("You own the follwing resources:"); for(Config.Resource resource : currentPlayerResource.keySet()){ textTerminal.println(resource.name() + ":" + currentPlayerResource.get(resource)); diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index d560b7a..864a217 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -66,6 +66,21 @@ public class SiedlerBoard extends HexBoard { return fields; } + + public ArrayList getResourcesforFaction(Point point, Config.Faction faction){ + List possibleSettlementField = super.getCornersOfField(point); + ArrayList resourcesToPlayer = new ArrayList<>(); + for (Structure structure : possibleSettlementField) { + if (structure.getFaction() == faction) { + resourcesToPlayer.add(fields.get(point).getResource()); + if (structure instanceof City) { + resourcesToPlayer.add(fields.get(point).getResource()); + } + } + } + return resourcesToPlayer; + } + /** * Returns the {@link Land}s adjacent to the specified corner. * diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 1842179..2b8b00c 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -198,8 +198,19 @@ public class SiedlerGame { * @return the resource cards added to the stock of the different players */ public Map> throwDice(int dicethrow) { - // TODO: Implement - return null; + Map> returnMap= new HashMap<>(); + List diceValueFields = board.getFieldsForDiceValue(dicethrow); + for (Player player : allPlayers) { + returnMap.put(player.getFaction(), new ArrayList()); + for (Point field : diceValueFields) { + List resources= board.getResourcesforFaction(field,player.getFaction()); + for (Config.Resource resource : resources){ + returnMap.get(player.getFaction()).add(resource); + player.addResource(resource,1); + } + } + } + return returnMap; } /**