From cac5182b6afd543d3ec801ff6aed77aea8ca1991 Mon Sep 17 00:00:00 2001 From: blzimme000 Date: Fri, 18 Feb 2022 11:07:42 -0600 Subject: [PATCH] Sort and Scramble done, Game.java done (I think) --- .../Assignment7/com/company/Game.class | Bin 384 -> 2116 bytes .../Assignment7/com/company/GameWheel.class | Bin 2301 -> 4981 bytes .../Assignment7/com/company/Slice.class | Bin 1155 -> 1155 bytes src/com/company/Game.java | 24 +++++++++++++++--- src/com/company/GameWheel.java | 21 +++++++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/out/production/Assignment7/com/company/Game.class b/out/production/Assignment7/com/company/Game.class index 4aa9dee78b8c9ed4ec0788a40b356d64a4462ace..6208990bef5a5b2764f6b6902ee4b42c2b7ca570 100644 GIT binary patch literal 2116 zcmah~O;B4^6#gy=ybvCR1}MK`sYO&gZs&I$x#@l_2Wfu1U;UEyZm6VhizRq=rF(vrTcr7{IWO5j-alqIt?T?V><0 zb2<*T>=q4cizz*isD|@8UhuN2BgzMmD0QzSO{X1WxS-*pj+YQ?1eP6F<(a8n@-p>f z7NfPhx;(lM39=UB+YPDQMw*! z=MG7$_QgU?p6p_gxbP-JHQ9L>fBVbCjf~f+@=aL$M}hbt01SRRLk}S>VF}JqFNbvQVQTylj_>88vTsM74VfUh>LMg0I`Q>$pW(SX6G#&N^LfP+@$5Ee$!ZU_AfW z@dO&yeS1eG{HpowJ})!uI`a5UeO+rn-|04{_ zKWwo&QO!k4n&vX6A{oLCd0nwxX+}9w4^%X7TdF)29TVXY_%ATBk}E0|6;5;}nzc*p zo@kkT`7i-}!Ln2_WlG0Uj)sE3g(gN$JE#T@SepDEZ0m;@i(7?=f>ff$?3=9l53?dV`OeV`QH%&goEUU{EoL^d$oa&aDlgh}z>7JOIs+W~m zmdK#Uz|Oz~RL%e-85vj^*nlMGWH~mm1TLT$hzBCMfg}%@%?hM>fjmwIJ_de}S|D2+ dh(YQYHv$PJ282d#B#n#=0t|v+g+gFe!T>F46EXk* diff --git a/out/production/Assignment7/com/company/GameWheel.class b/out/production/Assignment7/com/company/GameWheel.class index 3b2cd13198f7318ff62b6056038cb1e4ba03f7e0..423273b044cfa441e60cd3d5c58b3995e677c400 100644 GIT binary patch literal 4981 zcmdT|TXz%J75=#P7KT!VF^=*DGgF{jcQlu6?yc;bE1E~Y zxYA@`DV7nXu2d#f=y8198^Q_>a@J^=5U(_F3sxzFlXlw94QA6R`rPAf`UNn*blWe? z6TQs_S`b&z^J9|-52guk>-1?4VZH(SXdeREv zHif`Q+Dwj%-|Gyl$JgkkIXWsKEVJATV9Wh7Z-ara;|{TMazywdq3SEf+cC*uQ6)Oj zrK8(GkDysK%OZDCAepwzoG9FAU=!{l;M{mqn*97y8HQV!+kA#!x%u5jvWd$j$LIml^oh-;64mW zfG2Y~D^u8MQ-$dll--@hNgl6n_Kzblh)X82gJ}JKDFKg)#b=qkZ;-L#n%j z8~ey-{s{^X8Za@!6i5}UoLR7QvPXHK`#gDPB}QTCIB4Jys4_B(Y;g*MGiK%otcMsJ zX6XI0;;?~n5L_+eh;K|UFTmnp#(?dlBGDvqY=-Cvays$`3PO)Ez>29Fw2n-g>3kSR zaZJZU!s6p((5zjv1SF2N<_$rJ? z3_L2eCYZA(?4zt7VLUF}of5>#^Snq~hO1&Qbtq#NCUZ=xxXbJtv!|_op(}z~sb;mD_EONNPsttW3KuEM zFpohB3&`N)_;xevX$<9)Idj6)^Ahn;M`;h|Sx^JaNt zS?mq#Z}j4Lw&;m3Ymz%GaKt(5C6jNsPsc0NmCvR!UN4D~qjQm?lUe(iMGl7~DW%Li z!I^(<$mvH!SBg)Lixg+q&Z|~SI~6BD!z4p=LgJQ_v2s?GdfEI@or`;Up8bc#3VXl8 zR$oc6I?R$YXiw&n*5;IOtg1wtHIhtBzPoI@kT2xS>~^a#W{>8pgLprTU*Xp}K9Ih6 zQDNn5MN4Il+T&K6OD?xnZZ?ywElkfB$_tn`(N(&YB`R&@SN7ZX_+++oE?Q-h8y4;+ zedd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U9(NNDf@T%h?XlyHDLx_!tcWAN5PP>av<}JFe5wX9; zM}Jdl9*Sv2Mik8G@Vtbf@JbNhPR;P&G6_NEnNaUf!K-R2D#UO+DvIBkh(^2BzX~&J zh()CUws9qt7YiL?55E>>WUu_55UjK}i^cjav0)1Q6=1WHD{P8YBvE2REMXju#NEfx iI;Gxd3@?$cvW}2-?1J|dbWy^-kp4H_DJXKwgVMj{fw)Bg diff --git a/out/production/Assignment7/com/company/Slice.class b/out/production/Assignment7/com/company/Slice.class index 9d82efbcb7cbd54a6174f9e9276ab3a46b467175..aeba2b7ee922f9daac33df4448a49b57348d80ba 100644 GIT binary patch delta 22 dcmZqXZ06jc%*-joz|FwJz`!81S%*2C5dbZ*18o2R delta 22 dcmZqXZ06jc%*@Hez|FwJz`($?S%*2C5dbW415E$` diff --git a/src/com/company/Game.java b/src/com/company/Game.java index aa68a11..cdd8df3 100644 --- a/src/com/company/Game.java +++ b/src/com/company/Game.java @@ -1,10 +1,28 @@ package com.company; +import java.util.ArrayList; + public class Game { - public static void play(GameWheel g) - { + public static void play(GameWheel g){ // Implement the play method here - String slice1 = GameWheel.spinWheel().toString(); + ArrayList slices = new ArrayList<>(); + for (int i = 0; i < 3; i++){ + slices.add(g.spinWheel()); + } + boolean sameColor = false; + if (slices.get(0).getColor().equals(slices.get(1).getColor()) && (slices.get(0).getColor().equals(slices.get(2).getColor()))){ + sameColor = true; + System.out.println("Total prize money: $" + (2*slices.get(0).getPrizeAmount() + slices.get(1).getPrizeAmount() + slices.get(2).getPrizeAmount()) + "\n"); + } else { + System.out.println("Total prize money: $" + (slices.get(0).getPrizeAmount() + slices.get(1).getPrizeAmount() + slices.get(2).getPrizeAmount()) + "\n"); + + } + for (Slice e : slices){ + System.out.println(e); + } + if (sameColor){ + System.out.println("Three " + slices.get(0).getColor() + "s = double your money"); + } } } diff --git a/src/com/company/GameWheel.java b/src/com/company/GameWheel.java index 7f5ce60..089b0ca 100644 --- a/src/com/company/GameWheel.java +++ b/src/com/company/GameWheel.java @@ -61,6 +61,27 @@ public class GameWheel - Need to use colorSplit(ArrayList) and sort(ArrayList) to sort individual lists, then combine into big list similar to scramble method. */ + ArrayList newSlices = new ArrayList<>(); + ArrayList redStuff = new ArrayList<>(sort(colorSplit(slices, "red"))); + ArrayList blueStuff = new ArrayList<>(sort(colorSplit(slices, "blue"))); + ArrayList blackStuff = new ArrayList<>(sort(colorSplit(slices, "black"))); + int blackCount = 0; + int blueCount = 0; + int redCount = 0; + for (int i = 0; i < 20; i++){ + if (i % 5 == 0){ + newSlices.add(blackStuff.get(blackCount)); + blackCount++; + } else if (i % 2 == 0){ + newSlices.add(blueStuff.get(blueCount)); + blueCount++; + } else { + newSlices.add(redStuff.get(redCount)); + redCount++; + } + } + slices.subList(0, 20).clear(); + slices.addAll(newSlices); } /* COMPLETED METHODS - YOU DO NOT NEED TO CHANGE THESE */