From e323298fd730e19b6535eadd08c03f639d9570b0 Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Wed, 19 Apr 2023 17:36:15 -0400 Subject: [PATCH 01/13] Implement undo functionality --- tictactoe/bin/RowGameApp.class | Bin 0 -> 644 bytes tictactoe/bin/TestExample.class | Bin 0 -> 1331 bytes .../bin/controller/RowGameController.class | Bin 0 -> 9283 bytes tictactoe/bin/model/Player.class | Bin 0 -> 1652 bytes tictactoe/bin/model/RowBlockModel.class | Bin 0 -> 1296 bytes tictactoe/bin/model/RowGameModel$Move.class | Bin 0 -> 781 bytes tictactoe/bin/model/RowGameModel.class | Bin 0 -> 2215 bytes tictactoe/bin/view/BlockIndex.class | Bin 0 -> 682 bytes tictactoe/bin/view/GameBoardView$1.class | Bin 0 -> 1044 bytes tictactoe/bin/view/GameBoardView.class | Bin 0 -> 2184 bytes tictactoe/bin/view/GameStatusView.class | Bin 0 -> 1638 bytes tictactoe/bin/view/RowGameGUI$1.class | Bin 0 -> 874 bytes tictactoe/bin/view/RowGameGUI$2.class | Bin 0 -> 875 bytes tictactoe/bin/view/RowGameGUI.class | Bin 0 -> 3236 bytes tictactoe/bin/view/View.class | Bin 0 -> 137 bytes tictactoe/jdoc/RowGameApp.html | 161 ++++ tictactoe/jdoc/allclasses-index.html | 102 +++ tictactoe/jdoc/allpackages-index.html | 71 ++ tictactoe/jdoc/class-use/RowGameApp.html | 58 ++ tictactoe/jdoc/constant-values.html | 80 ++ .../jdoc/controller/RowGameController.html | 231 +++++ .../class-use/RowGameController.html | 89 ++ .../jdoc/controller/package-summary.html | 83 ++ tictactoe/jdoc/controller/package-tree.html | 72 ++ tictactoe/jdoc/controller/package-use.html | 80 ++ tictactoe/jdoc/element-list | 4 + tictactoe/jdoc/help-doc.html | 187 ++++ tictactoe/jdoc/index-all.html | 299 ++++++ tictactoe/jdoc/index.html | 68 ++ tictactoe/jdoc/jquery-ui.overrides.css | 35 + tictactoe/jdoc/legal/COPYRIGHT | 1 + tictactoe/jdoc/legal/LICENSE | 1 + tictactoe/jdoc/legal/jquery.md | 72 ++ tictactoe/jdoc/legal/jqueryUI.md | 49 + tictactoe/jdoc/member-search-index.js | 1 + tictactoe/jdoc/model/Player.html | 298 ++++++ tictactoe/jdoc/model/RowBlockModel.html | 289 ++++++ tictactoe/jdoc/model/RowGameModel.html | 262 ++++++ tictactoe/jdoc/model/class-use/Player.html | 114 +++ .../jdoc/model/class-use/RowBlockModel.html | 83 ++ .../jdoc/model/class-use/RowGameModel.html | 163 ++++ tictactoe/jdoc/model/package-summary.html | 95 ++ tictactoe/jdoc/model/package-tree.html | 87 ++ tictactoe/jdoc/model/package-use.html | 112 +++ tictactoe/jdoc/module-search-index.js | 1 + tictactoe/jdoc/overview-summary.html | 26 + tictactoe/jdoc/overview-tree.html | 101 ++ tictactoe/jdoc/package-search-index.js | 1 + tictactoe/jdoc/package-summary.html | 82 ++ tictactoe/jdoc/package-tree.html | 72 ++ tictactoe/jdoc/package-use.html | 58 ++ tictactoe/jdoc/resources/glass.png | Bin 0 -> 499 bytes tictactoe/jdoc/resources/x.png | Bin 0 -> 394 bytes tictactoe/jdoc/script-dir/jquery-3.6.0.min.js | 2 + tictactoe/jdoc/script-dir/jquery-ui.min.css | 6 + tictactoe/jdoc/script-dir/jquery-ui.min.js | 6 + tictactoe/jdoc/script.js | 132 +++ tictactoe/jdoc/search.js | 354 +++++++ tictactoe/jdoc/stylesheet.css | 866 ++++++++++++++++++ tictactoe/jdoc/tag-search-index.js | 1 + tictactoe/jdoc/type-search-index.js | 1 + tictactoe/jdoc/view/BlockIndex.html | 219 +++++ tictactoe/jdoc/view/GameBoardView.html | 247 +++++ tictactoe/jdoc/view/GameStatusView.html | 201 ++++ tictactoe/jdoc/view/RowGameGUI.html | 259 ++++++ tictactoe/jdoc/view/View.html | 132 +++ tictactoe/jdoc/view/class-use/BlockIndex.html | 89 ++ .../jdoc/view/class-use/GameBoardView.html | 83 ++ .../jdoc/view/class-use/GameStatusView.html | 58 ++ tictactoe/jdoc/view/class-use/RowGameGUI.html | 83 ++ tictactoe/jdoc/view/class-use/View.html | 116 +++ tictactoe/jdoc/view/package-summary.html | 106 +++ tictactoe/jdoc/view/package-tree.html | 81 ++ tictactoe/jdoc/view/package-use.html | 103 +++ .../src/controller/RowGameController.java | 842 ++++++++++------- tictactoe/src/model/RowBlockModel.java | 37 +- tictactoe/src/model/RowGameModel.java | 97 +- tictactoe/src/view/GameBoardView.java | 60 +- tictactoe/src/view/RowGameGUI.java | 54 +- 79 files changed, 7378 insertions(+), 445 deletions(-) create mode 100644 tictactoe/bin/RowGameApp.class create mode 100644 tictactoe/bin/TestExample.class create mode 100644 tictactoe/bin/controller/RowGameController.class create mode 100644 tictactoe/bin/model/Player.class create mode 100644 tictactoe/bin/model/RowBlockModel.class create mode 100644 tictactoe/bin/model/RowGameModel$Move.class create mode 100644 tictactoe/bin/model/RowGameModel.class create mode 100644 tictactoe/bin/view/BlockIndex.class create mode 100644 tictactoe/bin/view/GameBoardView$1.class create mode 100644 tictactoe/bin/view/GameBoardView.class create mode 100644 tictactoe/bin/view/GameStatusView.class create mode 100644 tictactoe/bin/view/RowGameGUI$1.class create mode 100644 tictactoe/bin/view/RowGameGUI$2.class create mode 100644 tictactoe/bin/view/RowGameGUI.class create mode 100644 tictactoe/bin/view/View.class create mode 100644 tictactoe/jdoc/RowGameApp.html create mode 100644 tictactoe/jdoc/allclasses-index.html create mode 100644 tictactoe/jdoc/allpackages-index.html create mode 100644 tictactoe/jdoc/class-use/RowGameApp.html create mode 100644 tictactoe/jdoc/constant-values.html create mode 100644 tictactoe/jdoc/controller/RowGameController.html create mode 100644 tictactoe/jdoc/controller/class-use/RowGameController.html create mode 100644 tictactoe/jdoc/controller/package-summary.html create mode 100644 tictactoe/jdoc/controller/package-tree.html create mode 100644 tictactoe/jdoc/controller/package-use.html create mode 100644 tictactoe/jdoc/element-list create mode 100644 tictactoe/jdoc/help-doc.html create mode 100644 tictactoe/jdoc/index-all.html create mode 100644 tictactoe/jdoc/index.html create mode 100644 tictactoe/jdoc/jquery-ui.overrides.css create mode 100644 tictactoe/jdoc/legal/COPYRIGHT create mode 100644 tictactoe/jdoc/legal/LICENSE create mode 100644 tictactoe/jdoc/legal/jquery.md create mode 100644 tictactoe/jdoc/legal/jqueryUI.md create mode 100644 tictactoe/jdoc/member-search-index.js create mode 100644 tictactoe/jdoc/model/Player.html create mode 100644 tictactoe/jdoc/model/RowBlockModel.html create mode 100644 tictactoe/jdoc/model/RowGameModel.html create mode 100644 tictactoe/jdoc/model/class-use/Player.html create mode 100644 tictactoe/jdoc/model/class-use/RowBlockModel.html create mode 100644 tictactoe/jdoc/model/class-use/RowGameModel.html create mode 100644 tictactoe/jdoc/model/package-summary.html create mode 100644 tictactoe/jdoc/model/package-tree.html create mode 100644 tictactoe/jdoc/model/package-use.html create mode 100644 tictactoe/jdoc/module-search-index.js create mode 100644 tictactoe/jdoc/overview-summary.html create mode 100644 tictactoe/jdoc/overview-tree.html create mode 100644 tictactoe/jdoc/package-search-index.js create mode 100644 tictactoe/jdoc/package-summary.html create mode 100644 tictactoe/jdoc/package-tree.html create mode 100644 tictactoe/jdoc/package-use.html create mode 100644 tictactoe/jdoc/resources/glass.png create mode 100644 tictactoe/jdoc/resources/x.png create mode 100644 tictactoe/jdoc/script-dir/jquery-3.6.0.min.js create mode 100644 tictactoe/jdoc/script-dir/jquery-ui.min.css create mode 100644 tictactoe/jdoc/script-dir/jquery-ui.min.js create mode 100644 tictactoe/jdoc/script.js create mode 100644 tictactoe/jdoc/search.js create mode 100644 tictactoe/jdoc/stylesheet.css create mode 100644 tictactoe/jdoc/tag-search-index.js create mode 100644 tictactoe/jdoc/type-search-index.js create mode 100644 tictactoe/jdoc/view/BlockIndex.html create mode 100644 tictactoe/jdoc/view/GameBoardView.html create mode 100644 tictactoe/jdoc/view/GameStatusView.html create mode 100644 tictactoe/jdoc/view/RowGameGUI.html create mode 100644 tictactoe/jdoc/view/View.html create mode 100644 tictactoe/jdoc/view/class-use/BlockIndex.html create mode 100644 tictactoe/jdoc/view/class-use/GameBoardView.html create mode 100644 tictactoe/jdoc/view/class-use/GameStatusView.html create mode 100644 tictactoe/jdoc/view/class-use/RowGameGUI.html create mode 100644 tictactoe/jdoc/view/class-use/View.html create mode 100644 tictactoe/jdoc/view/package-summary.html create mode 100644 tictactoe/jdoc/view/package-tree.html create mode 100644 tictactoe/jdoc/view/package-use.html diff --git a/tictactoe/bin/RowGameApp.class b/tictactoe/bin/RowGameApp.class new file mode 100644 index 0000000000000000000000000000000000000000..8bd0e59c9d9c624a140fd8e228008c6b05fdd487 GIT binary patch literal 644 zcmaJ;+e*Vg5IxgY)5d7Et@VDtwF>3~s)7iL5>&hd)TeD->PnhOnp%HL5CsK4z>gAV zTeYC#KFlz4=A60g+xzn?fOQm2#1J=-u+W8WLjSe66}Bh*s(nztmX(Omy{3E>Z4lyx zqH7>Y7_S6=6b7CrL;EOb?ueS)`p%dz5Kpn`v0$N>kgPK9D%m6qIJfM-I6J4ir4-WW zH!xr!gDfHa1LvmIh9cw~J=dLGZz`T_Z#!hkl8Hg&4GdWr#t0$vyM$oYW#p>5DtnTU zD4gpJ#yI^s_U6qEr?-MjM$?Y+<$j}9mf?wL)n}ZbB0N`wO2?ncM0BO<1k342lvtxC zluyVPE?SeeFL)e4_Q&3v1OIm|Pb08r0~(*OVf literal 0 HcmV?d00001 diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class new file mode 100644 index 0000000000000000000000000000000000000000..9063078f2cf4d576836d8f63caa256e7d69d2504 GIT binary patch literal 1331 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 VbUXj<#@*cWa%(T{#aA%w{{TxeLSp~` literal 0 HcmV?d00001 diff --git a/tictactoe/bin/model/Player.class b/tictactoe/bin/model/Player.class new file mode 100644 index 0000000000000000000000000000000000000000..ea3433f41a759820e034ef088bd4df90fe192828 GIT binary patch literal 1652 zcmaJ>?NZY~6g}IfO$h-?MGyr=tlCzkg7{hF!wOQZf>v=De>h87A&@3anli(i_z?b3 zRB&{3`0YbE-c90=LdVP`o4tGPx!?Qy&-Y&d?&F1u2!md;SB05hH2IEj+Q6Xbh#}69 zSS-&h&%Ss&%FtO3g9;Lr(9sq~jY(m<4jml~YIFf7BJWatf31)8Pol8o-Gj&m4dh#0F3tfY}> zSjPpVDULPamL4)hGucv#l6y(VWn>uoYJ5`^ZL7-N*M_@Je|48zZk^#|rWAH4u#`Yd z(q55XT_yEa&X6|=v`JWA$8}J7)U=lgV(rdkk0hKz`*)}msnS%EvSEp5joONEUh)-_ zB*QJtWSi^8kSg0%ZZ2`hkV=83V(}Ugq>g8s`p8{3$fdT5v1W0%;Sf%tpqHq3T-%TL zXyJn_5MrWg1_hy%lFCrXf-K%dvwM>T2CZT@oT`{JWJv9PKaa?sVMso(ZMW_^eCw%j z*X`AMR~)k%=I}_xyew6TA${0hhP7>PioEZQU%feAb!}&d;e9w)0njI%=hmtz>glp= zZ#K4CG+-!%CdHRKTcQR0O$Z-MM7U!DiXu17is6bv0#B$b84YyFvV`MJfvBr^#&Gdi zXstX}u}D4se<*d6AKvsR^=sZBzN7^xr(>Ly&DTMFC%>X}6d{RS8vD`PDH~^FQNE7}RNpv5D+qmPM)BF%h zTAW7|ibUkD4D6#nH~1BUpFE7T*-58BJK5Ih+X2bdOPZ4Lt{0E|lMzL6kE9V4$Px{G z;9s6r>0d1O1%n?vz+os!kIr{37SJ(F(B11NV?0pSa(g)c9T$P4!S#d~G@l`<$*B(* zvR-IFckCzFa&#Bb%CfQxwQ@YG2~1)tP@AHf$>+ik(n@8c%06(^b literal 0 HcmV?d00001 diff --git a/tictactoe/bin/model/RowBlockModel.class b/tictactoe/bin/model/RowBlockModel.class new file mode 100644 index 0000000000000000000000000000000000000000..3f0c36869b931a385e4fd1c4fecafb442f55e779 GIT binary patch literal 1296 zcmZvcYflqF7=_RDwxw)aTnY#UEqH4epUD9q*|C1jy z5lJ-Bk0$;o^~|>J7HOKy<(--HKJS^?{`&p(JAencmqG+l1u+$IBm_ndj3c9L8&0FV zT{|%AoYt-z+qY zrdeoq+Fqe%797`Ea5}cVn1TXT=1dEW6)U0Oj@PoB#!9I=ge*oBoKvA;RA98}zBcXh z3-|3~+pWLZlrw>tR2Rrqg4J~f{Kb_N1;$j2%d+Avvu%1woEOMTs3XJf44{%Zr&Q!I zEs(6cj>nSP0@_(Vx$}aGizo;TTkVQ8VbeV#i`YwIP5=TE#X(r5DzVpyFOaQRj=9xo z*38zfQL`D*DsJ7dt47O`^IkCK?OUW63)MmkRs_;Jo@IOY`M~EDetEiALG-0dN$N_u}_-oxMVf2FY8YC|U& z{-MtwBcp#o?i2S#afR&^5^OIZMx`WkY1EkDN*-7F10RjdJ&kK9vX>*tAW-5s3-O23 zh=QyFodJRCSme8mxqyG-AOB>? zu8|tJ&Grs5SR&VQA9F5X&Y?{1E^`zj!{H6w?4|1Gocy2j;Xuw?%-Q8!WmVFjgq}af zj3nz;DgR4=HQvgTKB7cGl#t&GH3Z4;4gi_?5J+_mTOSC*FS-vzx~=Nk>@gCdmF=e-lwGo<}djfm;VC(qT`DI literal 0 HcmV?d00001 diff --git a/tictactoe/bin/model/RowGameModel$Move.class b/tictactoe/bin/model/RowGameModel$Move.class new file mode 100644 index 0000000000000000000000000000000000000000..156dc7b1429608905d21adfc162ef3496f97001b GIT binary patch literal 781 zcmZuu+iuf96r2;gabnywZ9_|GfzlR~Sb}^2mzPL@rL-VGc_|k;=~5gyHnQDT{1Xo# z5h3xw2k=pd*>xUz$;+Od<1;hIvw#2n{sZ6%?z^bKa$tK{KvmEjho@mT4wK{V%i&m! z3PJU8ltjf-fz|E|>Zqaa!1Ztqo?v~F9;vwdIz4+HPSm~zd;96B;&7Ip2_(>jhKD6R zZH>}c<7E#kSf%opIQ*(IL8D*lyfXNaV6`0t7kiz7!0ypNu+)zdb#O8ns_bnzjM-V~ zr=u_)gjuBVtZ5gYqg=2t)48%EZK}trVBh>&P{Ljs3+n8byD*V<=i(*;_f2||jnuP9 zdoQ0CeyHOU)DBc$yh!uH!7jJE8j`>Zl0;>_ILvd!Ep43|wi!-^?_%*}zPwd*a;7pd zRvW^HYVo{I6!W{y+VX!v{LLvGe`|_G|G^Z^ABMHYbBzq(kdyCF$9pvJfm$E2&aPkb zaRVDfR5HF|ZrWLI)6%cSodh?rIdkr^>Zt|)C!BA*RA>WKO>=0Zy>ehCE!dh%Uc5~H oG?#n}w<)Lp`Mh)U`z7b`9I}NwW@;OEP2IsBt4p~Wc5n~we>_8eg#Z8m literal 0 HcmV?d00001 diff --git a/tictactoe/bin/model/RowGameModel.class b/tictactoe/bin/model/RowGameModel.class new file mode 100644 index 0000000000000000000000000000000000000000..ba1c0d693cabde832d92b1bd1fc951ef8370daaa GIT binary patch literal 2215 zcmZuy-*XdH6#j0KCQaCu{-l%y35YdKfkH*JOeeG!b_K$-hGn?(0>RXHF@kP^k$d;@ReM{Slk4_Z*G#+o zctw3>qKM&01e%5(QvUTN-PNNwioOW?H4I=-K=a+#O#P{J1iIJq z3#IJ(<|TpNW;TDzOEawDm^u`$dG0FnaSfw5ArP(FPh>qWAF_6lQ#%O_C-IKJk%xw* zo9nXPFu6C7Z)4qX9mA?*B1j4x^_Cm1VNPzidiik-rw~+O-qmmx?=g%@aKos(w)0e= z-w)IFXO#B^23z3U1jR6haYb~R9H!b7w&=+yg3k$@X;+prO+1*g)eO3TfDU6wW1 zu&r)f5J=qGkx8F{WVKOulUp)r+17chVVW0Wn7~DqjSLQ_{ttG%sE~c2;W9oHh#2*3 zwdN8KulcUp`AEaZnC5rQt_cjK#ydjz+91*lk+hJuaGYHsLov)?PQyGt;WbsHORadp zb82Hj!?lBrMcY(MOB%9R=Kaz4Km>iv+9`{SqVR@>oYHESBkR&tM?X_A^CUf$%f0FE zgDhxR#hO5<)~N3YjCHcngmMTv-tF~;mF#A=u(VlNy^|{xvg-mpi?&sFb;~X4W6hV(D(fkpk!57Rl@(x9_o*nJ1;8MZPC0F>hG1(5P-n z=a#-@a%CWImvytKJBIphE(XiCNoF0zZ^+#->b$K(!ZU7XXD{-F&3Ola2icNM>IZ_*vD9jF;W}P0^+;Ze?1c% z|M-ECgZP}|6f};*2(i{)Ry@oxjy@#WEhjL-{o|Ns?x9dE2Xq{zTY95|vCQm1-vbd_uN9n8QA}P7l zQBk;6QCR(_FowW(OB*j)TNfiNkgzj*nED3OzIEjn%;YEbFgwTL>O6;uj``-*BP(hxfy1z}LQf`9^!9He6@dPjM(><)* yd7Gp)O7f;xLE1mkB5ANCzQLv-8PKaBNUC-iJ^%xcIER>a29IgQJSzqhvHt*xcDh9X literal 0 HcmV?d00001 diff --git a/tictactoe/bin/view/BlockIndex.class b/tictactoe/bin/view/BlockIndex.class new file mode 100644 index 0000000000000000000000000000000000000000..b367ee9aa967ea820555db46bc0c162cdf066208 GIT binary patch literal 682 zcmZutO;6iE5Pj=7F-aW^hPod~3-km&kRJe4s7RG8rL9z|NbRNCm=zcty9y5QbGY@= z3ldO?Lw`Vj6yl9zQG}|Mc6Z*)doyqT-roEHu!T1*Sg1L$UDVM~m^;)bx|ix~zxQc) zXyQVlv6*B^@m8U>x;AKH22BSo7f;|ScqfTD?Y&F$_$bQu%o&Tu`Kf}6q;S@SCsmC& zPbZ_SMQGlIj|D>eruZzC6pbYD)I}hPCKEelxk7z4iq-}S_D;TM*sPyq=Hp~EG~+LN zm=f{(d92fc9w!o4pj{j!#|rcPN3(4xI3r!e2Zq^F`kO*~x6tv?2mPZWw|4W%I5zJS zk@x-?TbI3Hg@an$n?)1!&z~<2`P!f+p7DOp=&LN1uNVG?3OiSD!tNE?7lbUl;O&zD zO4w+liCG>GFNrKqY3QKKhyrCBRsN)r#RlA8)uzW+a`o^M&M$tZ;*ApYOF?&9Pzfs8 zF%g;ZA-VmS9Q>F33a=~j_sU=pUSqCvPNUaY?4HB1f5NVbTCMas9i{WYTX63!xc3&6 TOSG^gUSKV5i>+k_7FO;6R{C71 literal 0 HcmV?d00001 diff --git a/tictactoe/bin/view/GameBoardView$1.class b/tictactoe/bin/view/GameBoardView$1.class new file mode 100644 index 0000000000000000000000000000000000000000..741da87c8ca46bbda3de5905e77d8f146f8b95e0 GIT binary patch literal 1044 zcmah|T~8B16g|_{E?rkz3s%H}2vz%mtW|khHIW8UQ;~@2`*b^&CEJ-~ciQ^5Oav1j zjL-fkcXtUd_h$|G8DUrg`}#*Bj;Y=+qp4=cWsI#OXMB8KJm>CFA0#s<6fcipq$;F^V5 z2YD123Wt2e-H^+^`@VZ9d`;ZX0vYHR4C!jEW21;U3-bc~)R z+{~_s^=lPVr#NpU6`>XKI2JKhsGS|qb&)C*OjiSB>3PtLNztFjU9zj>waBJTq~16J ztFIrys(-`PFG=DWjah;L0aj=%oov2``!q8!29n_c`6(30tD;7u0p6iVLRJ3?t8t9$ uKXLOIw@!iWWO)^{So;Tf9Ss7@U_F6I(xjKvPSQ}ob}nw+3zsy7=F--!ot8LtNy2SxpQdi@naUm~ z6%udx1m2N&0P%oSq>@NP;*A&H`2oZa@ES#wb&j2JLnDyv@t!?<@3Zz=d$xc3`{!Q( zOk*tqAN&RaCV~hF^gOcGtyI;r*HU+ik7UUe2wkbz75A!uKb|NUcunBM>S|WSJxw(> zDvZ1}({x?Oo(dy^E(4~CBPy(Ky&^YKH>{eRajbf|z&lneR-Mx0hJm93#||kHLAS!w z$8-(F+Hg~Im72606~~UC7ySz9fIu*w$s`IY{Dg^E5l&2eMw5<$UD}Nu+TN zG~nsHq4p;G%&`CNAS`>U&6xK-ZddRc{2@AYbt|mwM*%Zk+?gI^B5J z#Cw<$FsSO1e9A!_X!rPXq>}OircGSM`vTo8ooQs{npMp?>(rkkyP}F+Gcki%cEMuv zwpFZ3N*jo;sPqWtO&J^V_KR*P!r3}ghtn#qD5YHE65l=TGt zuckyWOL8enwqnbLX00geO9~q$$T}sfTCnOBb>DV|N=~&|vjqf?_tzc1O#$~|MUi;e zNb%_!VXLQyfFl>3krNpD?*SAzl6S4rvLvLsa6PX=$lfz###N0#DI?5|MYB^^&|^(abBU zy?r&QnB!n9$cCGfN+7arW^BH5vsJ6nkPV#S0Qn$rlV6`&eB7%6+Ckjn^)?{-Xb0(S zCbuDyq0p}|d_N)VzZwgDgQEX(U?4yvpL~vREIkm|LHF`Ddc6De4tke+Zui{Y#<49N zAKQ;hZ(;Dhce8_$<>dG_Mz`?BW!+oKExt_m6gX5TUFLQ#`{}e! zL1H-?+s4>4-PIqPKKAyzc*d+&b3-sx1zs<(xr-R&20BYSN#8kK(aj`zN|<`7X8eRX zshjcXy!~d<_!yrMmujIG!9DoI9{(2yiMa)vi=qwtOBPYECp@6fF|Gh_fuDC?^t5=NiL*06_Q)WbK5qQct9(nEgHZ-p{4kF literal 0 HcmV?d00001 diff --git a/tictactoe/bin/view/GameStatusView.class b/tictactoe/bin/view/GameStatusView.class new file mode 100644 index 0000000000000000000000000000000000000000..1dc666b1103452895f9c8e48ab75c3b9d4c67335 GIT binary patch literal 1638 zcmaJ>SyLNF5dH=ME0#5fIAm;x2*M!=!X~zp*b$Im0X`y*AR?|*r3PsV7FN5;?g-2; zN%9NwoKzxLk*d6=%0J5Gp54VI*{VEfG~L_%_3?Gj>o?c`0$9S2Iyw;3&}pCx-3$X~ z{DPY{cTUW$<1@dVeQA=ZOl7#eOF z=tDol(1j%~&8NI7ijvE^Um}q~ui5-cc(U#}49P-Uw48z)G?2g$L$5F7TE&w5*cJ?( z>BCG(#|TC>Bn{lg7(=23WScv}ri6K=!jMe|5lnt5&AeN!xsGsTF4In_<1X%L_{hLG zJ|@trTM@Ro<6f!?Hk827cOvAv<#2mP_;s85Gn|gFg02;%M_tMFU;>jGJ~1$bX$B)i z+79Ywh;J8G4%T*l`kdej&7Y|1yO=eQMuwq>BHeflP>}ZwCopGV9-k6J;^#WIeIh0* zwTZu6<}g7_n+84ug-cfXxyZXtnae#(p3=>i+>zuvnQjfxrYJ?p0|O871%pPEDCXY_ z8kL_ZsRn#y;E}5Srri4pFqj&0R9i3@;W#A2tlte(z+Ns>BBt}ybB6wc<%rFC^;mej z;RqxOZkgL9?paEXl%4X_QcWnd89E9XuL|GiCxT3dTW2l|NPVo=DqK=P$|!7hGxb46 zU4dR9v@u|~MPpt*-{7?Ak{R;+!`Fr`ext+bpA_gt7^pF<+od0D#N6~nL1^hbsv=ritAY~fE8T=%?Q%Z0Pw zJg-ff7RTMInrLHw)MOvN6E_PLfJP8`Zrepmid-B;YFRkTDVCCMO1%K7+5Oo#erWq; zYnGPgx#I{gZ*$)lzJ`5<=@0tQt~?Eg4CDWAN@RzCw*UnromTAgd)&VP9LCsK5qX(0O>MpQUbTw?)f;QsGO zg_cml(i#0;isL9-NnzA3ZScbTnX9ZxBvXXMp| k*vz0#K+j3&zzcjw|9x~TkikxH?xI9Go#Z_n;0R-H0Z{RsZ2$lO literal 0 HcmV?d00001 diff --git a/tictactoe/bin/view/RowGameGUI$1.class b/tictactoe/bin/view/RowGameGUI$1.class new file mode 100644 index 0000000000000000000000000000000000000000..c802187e64ba77a61c4bad93b6f2154a983b46f2 GIT binary patch literal 874 zcmah{+invv5Is&pcC#$qwB=4pX$d9SR-`SD0R)OlskAMKmb^O~le*g2(yo(y7ZL@D z2R?w0LX20XK>>va`;3og&Wt_tFy=`;*2<(hNkqzUKboF?OLi{r+a7#ebFkneK$W3- z#>c#sa5ZSX?VX9(P~vA&N%MlC*l2b=EMeKfbssmZdu^UJgF8}veW=I6!7YZBT$@i! zON@mwtyi&;T17H5LfJ}p8-KlQe(lXJL#d6j;7o=SVZ zAWQZW8J1@g)pyzqm18+j+>BDI$MfReiS(mRhoaB0+KB#H|DJtI+m^y8t~Sq!!8_KY zG#0O=tuUB2_=%M!W>3Y5&ZHU~3UjLa4jvOZ({9_TCc|3e|DWR?iOjsw8FkS=Q1r>2 zglCz^@PH=92g6Mis#QBU03ppDjbnjUfZK$3$m$RlEfa2@gN0k?aKf*+`YCt3OM97Q zfNk8Po#bc_P{RtLwX7t~AlU^}$y%kY&GGfQ$G-RHukSwqJi~4kC6rw_0WP7!usW4u)_$*N2Yf6JJ{~qZ z3>9-C^X3!Uj2Cvh_OutE3ZG$R%F|||mC1CPij3iIJpcP6*}K^9`Ur5v#Y%u0>J0T$ zKIQF{t5N&y;8Y}r3O|)fn&%AVu+{gmhIJQL16;G|jb+*l)lB5V*h{#$!LU(?^OD9UFx{7)w)m5_!gq zMzNCsEtIqc%Cod-OM&ugp}g8sOQeFfe6bc^eDci)fBf;mV)5E%MwVqIi^eOObMHN8 zpL5UI_uTu(|Ge`qfMfW593g}?M07;arf}0amX(Vsk)8 zN^Bx!PDpO=&~XqSR@g>}6Xv5vx#*1)osxNK(R2;Za%}1*Gg7cS>jg_0OJ3@PwP4yM zF2`{QhowFrVIav2H3jvEjx>%cXhfZ|E}05j>$O{F%<75uaUCDU#}ssGbBop`W3EV( zNb;=s9d0Gc{f2E8HJn(@w?K{-ouzT(qElviMi7o;2xAh}NrmlAo&%K$!!`=0OYa)) zZAKY$t^6uV28T6FFspt|#mBJY=1n(PkKq&58)lbezT%xn|_^3Vls3N1TO4 z$EISsiM+v?@V7sNGh#cV(0@a#zQ9ZZScB5=afPlHrti5Uj#-?QZGS@HU~;@=Jw2Xt zY|nLyMblkn`$%KP4`w$W((y1JAviZOloJ97F-_Za6?QiTXkOr!QtLGc(GCN18ge@F zUOGZhVw+5 zbX;#P-B*oOCE$8dd+I4rbzlx16z91^&Xki%ebQBNjxP6%xTfdozK{Lb6FwT5<-h?TcV_`UdO&3uULK~oQdKm{QW77|4k%~-&B7U zs=o#;n`p11V+EZYY|2)#Wd&O)Zl}0o1v@G3&L;L$v3CXgg28@&FxdY#I@>C^UA{FO z%66&0cd3V~xT}J@WiC>|u^NW5HH;AJo+?Hsf?+1x)>g%RoR}OKOiWgA|9Z6}k?sfq z_Ej)F>q~;IVPh8co>;qpSFgJNQJ4i2|S;6D|Tz#BMZ~Do7oxe68Qs5IR!nau$Hscm- z!#Ks`j*bPYXa66tp@yfki7!?0%zFghx&Ioz62hz`FzjO|7#i4kBbY)bW|+F! zCO{CzipJ3xtI4TCn(SIEB}^*&;I~0wKz`z literal 0 HcmV?d00001 diff --git a/tictactoe/bin/view/View.class b/tictactoe/bin/view/View.class new file mode 100644 index 0000000000000000000000000000000000000000..43722c2e536fdc4c9d2718a76c0a29a16c3e8fc3 GIT binary patch literal 137 zcmX^0Z`VEs1_oOOPId++Mh4EZ%+zxIFd)Isz{1ENkd;`LsGpOVm#*)hl$DxX!pOi@ zT9A@hlFG;+uHloLpOTuRACzD2o|v2J3*uO7hA}d51?QI*C8xS&<^Yv(f(+9GnZw4& az{tQ1w2Xm)5ok6m0~?6Nzz!st7&rh9mLG-y literal 0 HcmV?d00001 diff --git a/tictactoe/jdoc/RowGameApp.html b/tictactoe/jdoc/RowGameApp.html new file mode 100644 index 00000000..fe92fb10 --- /dev/null +++ b/tictactoe/jdoc/RowGameApp.html @@ -0,0 +1,161 @@ + + + + +RowGameApp (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+ +
+

类 RowGameApp

+
+
java.lang.Object +
RowGameApp
+
+
+
+
public class RowGameApp +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    构造器详细资料

    +
      +
    • +
      +

      RowGameApp

      +
      public RowGameApp()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    方法详细资料

    +
      +
    • +
      +

      main

      +
      public static void main(String[] args)
      +
      Starts a new game in the GUI.
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/tictactoe/jdoc/allclasses-index.html b/tictactoe/jdoc/allclasses-index.html new file mode 100644 index 00000000..e8cd11ab --- /dev/null +++ b/tictactoe/jdoc/allclasses-index.html @@ -0,0 +1,102 @@ + + + + +All Classes and Interfaces (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

All Classes and Interfaces

+
+
+
+
+
+
+
说明
+ +
 
+ +
+
The GameBoardView class visualizes the game board of blocks.
+
+ +
+
The GameStatusView class visualizes the game status as either in progress, + current player's turn, or finished, either win or tie.
+
+ +
 
+ +
+
The TicTacToeBlock class represents a given block in the game.
+
+ +
 
+ +
 
+ +
+
The RowGameGUI class is applying the Composite design pattern.
+
+ +
 
+ +
+
The View interfaces supports updating the visualizations of the Model.
+
+
+
+
+
+
+
+ + diff --git a/tictactoe/jdoc/allpackages-index.html b/tictactoe/jdoc/allpackages-index.html new file mode 100644 index 00000000..84d4e28f --- /dev/null +++ b/tictactoe/jdoc/allpackages-index.html @@ -0,0 +1,71 @@ + + + + +所有程序包 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

所有程序包

+
+
程序包概要
+
+
程序包
+
说明
+ +
 
+ +
 
+ +
 
+ +
 
+
+
+
+
+ + diff --git a/tictactoe/jdoc/class-use/RowGameApp.html b/tictactoe/jdoc/class-use/RowGameApp.html new file mode 100644 index 00000000..4b742da6 --- /dev/null +++ b/tictactoe/jdoc/class-use/RowGameApp.html @@ -0,0 +1,58 @@ + + + + +类 RowGameApp的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

类的使用
RowGameApp

+
+没有RowGameApp的用法
+
+
+ + diff --git a/tictactoe/jdoc/constant-values.html b/tictactoe/jdoc/constant-values.html new file mode 100644 index 00000000..cec8817f --- /dev/null +++ b/tictactoe/jdoc/constant-values.html @@ -0,0 +1,80 @@ + + + + +常量字段值 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

常量字段值

+
+

目录

+ +
+
+
+

model.*

+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/controller/RowGameController.html b/tictactoe/jdoc/controller/RowGameController.html new file mode 100644 index 00000000..939c16c3 --- /dev/null +++ b/tictactoe/jdoc/controller/RowGameController.html @@ -0,0 +1,231 @@ + + + + +RowGameController (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+ +
+
程序包 controller
+

类 RowGameController

+
+
java.lang.Object +
controller.RowGameController
+
+
+
+
public class RowGameController +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    字段详细资料

    + +
    +
  • + +
  • +
    +

    构造器详细资料

    +
      +
    • +
      +

      RowGameController

      +
      public RowGameController()
      +
      Creates a new game initializing the GUI.
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    方法详细资料

    +
      +
    • +
      +

      move

      +
      public void move(JButton block)
      +
      Moves the current player into the given block.
      +
      +
      参数:
      +
      block - The block to be moved to by the current player
      +
      +
      +
    • +
    • +
      +

      endGame

      +
      public void endGame()
      +
      Ends the game disallowing further player turns.
      +
      +
    • +
    • +
      +

      resetGame

      +
      public void resetGame()
      +
      Resets the game to be able to start playing again.
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/tictactoe/jdoc/controller/class-use/RowGameController.html b/tictactoe/jdoc/controller/class-use/RowGameController.html new file mode 100644 index 00000000..17ba4d77 --- /dev/null +++ b/tictactoe/jdoc/controller/class-use/RowGameController.html @@ -0,0 +1,89 @@ + + + + +类 controller.RowGameController的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

类的使用
controller.RowGameController

+
+
使用RowGameController的程序包
+
+
程序包
+
说明
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/controller/package-summary.html b/tictactoe/jdoc/controller/package-summary.html new file mode 100644 index 00000000..7f92bb16 --- /dev/null +++ b/tictactoe/jdoc/controller/package-summary.html @@ -0,0 +1,83 @@ + + + + +controller (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包 controller

+
+
+
package controller
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/controller/package-tree.html b/tictactoe/jdoc/controller/package-tree.html new file mode 100644 index 00000000..2d5e4cce --- /dev/null +++ b/tictactoe/jdoc/controller/package-tree.html @@ -0,0 +1,72 @@ + + + + +controller 类分层结构 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包controller的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/controller/package-use.html b/tictactoe/jdoc/controller/package-use.html new file mode 100644 index 00000000..e408a35f --- /dev/null +++ b/tictactoe/jdoc/controller/package-use.html @@ -0,0 +1,80 @@ + + + + +程序包 controller的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包的使用
controller

+
+
使用controller的程序包
+
+
程序包
+
说明
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/element-list b/tictactoe/jdoc/element-list new file mode 100644 index 00000000..0740a3af --- /dev/null +++ b/tictactoe/jdoc/element-list @@ -0,0 +1,4 @@ +未命名程序包 +controller +model +view diff --git a/tictactoe/jdoc/help-doc.html b/tictactoe/jdoc/help-doc.html new file mode 100644 index 00000000..43a4750d --- /dev/null +++ b/tictactoe/jdoc/help-doc.html @@ -0,0 +1,187 @@ + + + + +API 帮助 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+

此 API 文档的组织方式

+ +
+
+

Navigation

+Starting from the 概览 page, you can browse the documentation using the links in each page, and in the navigation bar at the top of each page. The 索引 and Search box allow you to navigate to specific declarations and summary pages, including: 所有程序包, All Classes and Interfaces + +
+
+
+

Kinds of Pages

+The following sections describe the different kinds of pages in this collection. +
+

概览

+

概览 页面是此 API 文档的首页, 提供了所有程序包的列表及其概要。此页面也可能包含这些程序包的总体说明。

+
+
+

程序包

+

每个程序包都有一页,其中包含它的类和接口的列表及其概要。这些页可以包含六个类别:

+
    +
  • 接口
  • +
  • +
  • Enum Classes
  • +
  • 异常错误
  • +
  • 错误
  • +
  • Annotation Interfaces
  • +
+
+
+

类或接口

+

每个类, 接口, 嵌套类和嵌套接口都有各自的页面。其中每个页面都由三部分 (类/接口说明, 概要表, 以及详细的成员说明) 组成:

+
    +
  • 类继承图
  • +
  • 直接子类
  • +
  • 所有已知子接口
  • +
  • 所有已知实现类
  • +
  • 类或接口声明
  • +
  • 类或接口说明
  • +
+
+
    +
  • 嵌套类概要
  • +
  • 枚举常量概要
  • +
  • 字段概要
  • +
  • 属性概要
  • +
  • 构造器概要
  • +
  • 方法概要
  • +
  • 必需元素概要
  • +
  • 可选元素概要
  • +
+
+
    +
  • 枚举常量详细资料
  • +
  • 字段详细资料
  • +
  • 属性详细资料
  • +
  • 构造器详细资料
  • +
  • 方法详细资料
  • +
  • 元素详细资料
  • +
+

Note: Annotation interfaces have required and optional elements, but not methods. Only enum classes have enum constants. The components of a record class are displayed as part of the declaration of the record class. Properties are a feature of JavaFX.

+

The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

+
+
+

Other Files

+

Packages and modules may contain pages with additional information related to the declarations nearby.

+
+
+

使用

+

每个已文档化的程序包、类和接口都有各自的“使用”页。此页介绍了使用给定类或程序包的任何部分的程序包、类、方法、构造器和字段。对于给定的类或接口 A,其“使用”页包含 A 的子类、声明为 A 的字段、返回 A 的方法以及带有类型为 A 的参数的方法和构造器。访问此页的方法是:首先转至程序包、类或接口,然后单击导航栏中的“使用”链接。

+
+
+

树 (类分层结构)

+

对于所有程序包,都有一个 类分层结构 页,以及每个程序包的分层结构。每个分层结构页都包含类的列表和接口的列表。从 java.lang.Object 开始,按继承结构对类进行排列。接口不从 java.lang.Object 继承。

+
    +
  • 查看“概览”页面时, 单击 "树" 将显示所有程序包的分层结构。
  • +
  • 查看特定程序包、类或接口页时,单击“树”将仅显示该程序包的分层结构。
  • +
+
+
+

常量字段值

+

常量字段值页面列出了静态最终字段及其值。

+
+
+

All Packages

+

The 所有程序包 page contains an alphabetic index of all packages contained in the documentation.

+
+
+

All Classes and Interfaces

+

The All Classes and Interfaces page contains an alphabetic index of all classes and interfaces contained in the documentation, including annotation interfaces, enum classes, and record classes.

+
+
+

索引

+

索引 包含所有类、接口、构造器、方法和字段的按字母顺序排列的索引,以及所有程序包和所有类的列表。

+
+
+
+此帮助文件适用于由标准 doclet 生成的 API 文档。
+
+
+ + diff --git a/tictactoe/jdoc/index-all.html b/tictactoe/jdoc/index-all.html new file mode 100644 index 00000000..9305d386 --- /dev/null +++ b/tictactoe/jdoc/index-all.html @@ -0,0 +1,299 @@ + + + + +索引 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

索引

+
+A B C E F G I M P R S T U V 
All Classes and Interfaces|常量字段值|所有程序包 +

A

+
+
addView(View) - 类中的方法 view.RowGameGUI
+
 
+
+

B

+
+
BlockIndex - view中的类
+
 
+
BlockIndex(int, int) - 类的构造器 view.BlockIndex
+
 
+
blocks - 类中的变量 view.GameBoardView
+
 
+
blocksData - 类中的变量 model.RowGameModel
+
 
+
+

C

+
+
column - 类中的变量 view.BlockIndex
+
 
+
contents - 类中的变量 model.RowBlockModel
+
+
The current value of the contents of this block
+
+
controller - 程序包 controller
+
 
+
+

E

+
+
endGame() - 类中的方法 controller.RowGameController
+
+
Ends the game disallowing further player turns.
+
+
+

F

+
+
finalResult - 类中的变量 model.RowGameModel
+
 
+
+

G

+
+
game - 类中的变量 model.RowBlockModel
+
+
The game that contains this block
+
+
GAME_END_NOWINNER - 类中的静态变量 model.RowGameModel
+
 
+
gameBoardView - 类中的变量 view.RowGameGUI
+
 
+
GameBoardView - view中的类
+
+
The GameBoardView class visualizes the game board of blocks.
+
+
GameBoardView(JPanel, RowGameController) - 类的构造器 view.GameBoardView
+
 
+
gameModel - 类中的变量 controller.RowGameController
+
 
+
gameModel - 类中的变量 view.RowGameGUI
+
 
+
GameStatusView - view中的类
+
+
The GameStatusView class visualizes the game status as either in progress, + current player's turn, or finished, either win or tie.
+
+
GameStatusView(JPanel) - 类的构造器 view.GameStatusView
+
 
+
gameView - 类中的变量 controller.RowGameController
+
 
+
getBlockIndex(JButton) - 类中的方法 view.GameBoardView
+
+
Returns the BlockIndex (pair of row and column) of the given block + if it is part of this game board and returns null otherwise.
+
+
getBlockIndex(JButton) - 类中的方法 view.RowGameGUI
+
 
+
getColumn() - 类中的方法 view.BlockIndex
+
 
+
getContents() - 类中的方法 model.RowBlockModel
+
+
Returns the non-null String value of the contents of this block.
+
+
getFinalResult() - 类中的方法 model.RowGameModel
+
 
+
getGame() - 类中的方法 model.RowBlockModel
+
 
+
getID() - enum class中的方法 model.Player
+
 
+
getIsLegalMove() - 类中的方法 model.RowBlockModel
+
 
+
getPlayer() - 类中的方法 model.RowGameModel
+
 
+
getRow() - 类中的方法 view.BlockIndex
+
 
+
gui - 类中的变量 view.RowGameGUI
+
 
+
+

I

+
+
id - enum class中的变量 model.Player
+
 
+
isLegalMove - 类中的变量 model.RowBlockModel
+
+
Whether or not it is currently legal to move into this block
+
+
+

M

+
+
main(String[]) - 类中的静态方法 RowGameApp
+
+
Starts a new game in the GUI.
+
+
matches(int, int) - 类中的方法 view.BlockIndex
+
 
+
model - 程序包 model
+
 
+
move(JButton) - 类中的方法 controller.RowGameController
+
+
Moves the current player into the given block.
+
+
movesLeft - 类中的变量 model.RowGameModel
+
 
+
+

P

+
+
player - 类中的变量 model.RowGameModel
+
+
The current player taking their turn
+
+
Player - model中的Enum Class
+
 
+
Player(int) - enum class的构造器 model.Player
+
 
+
PLAYER_1 - enum class 中的枚举常量 model.Player
+
 
+
PLAYER_2 - enum class 中的枚举常量 model.Player
+
 
+
playerturn - 类中的变量 view.GameStatusView
+
 
+
+

R

+
+
reset - 类中的变量 view.RowGameGUI
+
 
+
reset() - 类中的方法 model.RowBlockModel
+
+
Resets this block before starting a new game.
+
+
resetGame() - 类中的方法 controller.RowGameController
+
+
Resets the game to be able to start playing again.
+
+
row - 类中的变量 view.BlockIndex
+
 
+
RowBlockModel - model中的类
+
+
The TicTacToeBlock class represents a given block in the game.
+
+
RowBlockModel(RowGameModel) - 类的构造器 model.RowBlockModel
+
+
Creates a new block that will be contained in the given game.
+
+
RowGameApp - Unnamed Package中的类
+
 
+
RowGameApp() - 类的构造器 RowGameApp
+
 
+
RowGameController - controller中的类
+
 
+
RowGameController() - 类的构造器 controller.RowGameController
+
+
Creates a new game initializing the GUI.
+
+
RowGameGUI - view中的类
+
+
The RowGameGUI class is applying the Composite design pattern.
+
+
RowGameGUI(RowGameController) - 类的构造器 view.RowGameGUI
+
+
Creates a new game initializing the GUI.
+
+
RowGameModel - model中的类
+
 
+
RowGameModel() - 类的构造器 model.RowGameModel
+
 
+
+

S

+
+
setContents(String) - 类中的方法 model.RowBlockModel
+
+
Sets the contents of this block to the given value.
+
+
setFinalResult(String) - 类中的方法 model.RowGameModel
+
 
+
setIsLegalMove(boolean) - 类中的方法 model.RowBlockModel
+
 
+
setPlayer(Player) - 类中的方法 model.RowGameModel
+
 
+
+

T

+
+
toString() - enum class中的方法 model.Player
+
 
+
+

U

+
+
update(RowGameModel) - 类中的方法 view.GameBoardView
+
 
+
update(RowGameModel) - 类中的方法 view.GameStatusView
+
 
+
update(RowGameModel) - 类中的方法 view.RowGameGUI
+
 
+
update(RowGameModel) - 接口中的方法 view.View
+
 
+
updateBlock(RowGameModel, int, int) - 类中的方法 view.GameBoardView
+
+
Updates the block at the given row and column + after one of the player's moves.
+
+
+

V

+
+
valueOf(String) - enum class中的静态方法 model.Player
+
+
Returns the enum constant of this class with the specified name.
+
+
values() - enum class中的静态方法 model.Player
+
+
Returns an array containing the constants of this enum class, in +the order they are declared.
+
+
view - 程序包 view
+
 
+
View - view中的接口
+
+
The View interfaces supports updating the visualizations of the Model.
+
+
viewList - 类中的变量 view.RowGameGUI
+
+
For the Composite design pattern, the RowGameGUI is the Composite
+
+
+A B C E F G I M P R S T U V 
All Classes and Interfaces|常量字段值|所有程序包
+
+
+ + diff --git a/tictactoe/jdoc/index.html b/tictactoe/jdoc/index.html new file mode 100644 index 00000000..631f4d0d --- /dev/null +++ b/tictactoe/jdoc/index.html @@ -0,0 +1,68 @@ + + + + +概览 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+
程序包
+
+
程序包
+
说明
+ +
 
+ +
 
+ +
 
+
+
+
+
+
+ + diff --git a/tictactoe/jdoc/jquery-ui.overrides.css b/tictactoe/jdoc/jquery-ui.overrides.css new file mode 100644 index 00000000..03c010ba --- /dev/null +++ b/tictactoe/jdoc/jquery-ui.overrides.css @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { + /* Overrides the color of selection used in jQuery UI */ + background: #F8981D; + border: 1px solid #F8981D; +} diff --git a/tictactoe/jdoc/legal/COPYRIGHT b/tictactoe/jdoc/legal/COPYRIGHT new file mode 100644 index 00000000..ca74fffd --- /dev/null +++ b/tictactoe/jdoc/legal/COPYRIGHT @@ -0,0 +1 @@ +Please see ..\java.base\COPYRIGHT diff --git a/tictactoe/jdoc/legal/LICENSE b/tictactoe/jdoc/legal/LICENSE new file mode 100644 index 00000000..4ad9fe40 --- /dev/null +++ b/tictactoe/jdoc/legal/LICENSE @@ -0,0 +1 @@ +Please see ..\java.base\LICENSE diff --git a/tictactoe/jdoc/legal/jquery.md b/tictactoe/jdoc/legal/jquery.md new file mode 100644 index 00000000..f7b72e3f --- /dev/null +++ b/tictactoe/jdoc/legal/jquery.md @@ -0,0 +1,72 @@ +## jQuery v3.6.0 + +### jQuery License +``` +jQuery v 3.6.0 +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +****************************************** + +The jQuery JavaScript Library v3.6.0 also includes Sizzle.js + +Sizzle.js includes the following license: + +Copyright JS Foundation and other contributors, https://js.foundation/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/sizzle + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +********************* + +``` diff --git a/tictactoe/jdoc/legal/jqueryUI.md b/tictactoe/jdoc/legal/jqueryUI.md new file mode 100644 index 00000000..8031bdb5 --- /dev/null +++ b/tictactoe/jdoc/legal/jqueryUI.md @@ -0,0 +1,49 @@ +## jQuery UI v1.12.1 + +### jQuery UI License +``` +Copyright jQuery Foundation and other contributors, https://jquery.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-ui + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code contained within the demos directory. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +``` diff --git a/tictactoe/jdoc/member-search-index.js b/tictactoe/jdoc/member-search-index.js new file mode 100644 index 00000000..960c388d --- /dev/null +++ b/tictactoe/jdoc/member-search-index.js @@ -0,0 +1 @@ +memberSearchIndex = [{"p":"view","c":"RowGameGUI","l":"addView(View)","u":"addView(view.View)"},{"p":"view","c":"BlockIndex","l":"BlockIndex(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"view","c":"GameBoardView","l":"blocks"},{"p":"model","c":"RowGameModel","l":"blocksData"},{"p":"view","c":"BlockIndex","l":"column"},{"p":"model","c":"RowBlockModel","l":"contents"},{"p":"controller","c":"RowGameController","l":"endGame()"},{"p":"model","c":"RowGameModel","l":"finalResult"},{"p":"model","c":"RowBlockModel","l":"game"},{"p":"model","c":"RowGameModel","l":"GAME_END_NOWINNER"},{"p":"view","c":"RowGameGUI","l":"gameBoardView"},{"p":"view","c":"GameBoardView","l":"GameBoardView(JPanel, RowGameController)","u":"%3Cinit%3E(javax.swing.JPanel,controller.RowGameController)"},{"p":"controller","c":"RowGameController","l":"gameModel"},{"p":"view","c":"RowGameGUI","l":"gameModel"},{"p":"view","c":"GameStatusView","l":"GameStatusView(JPanel)","u":"%3Cinit%3E(javax.swing.JPanel)"},{"p":"controller","c":"RowGameController","l":"gameView"},{"p":"view","c":"GameBoardView","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"view","c":"RowGameGUI","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"view","c":"BlockIndex","l":"getColumn()"},{"p":"model","c":"RowBlockModel","l":"getContents()"},{"p":"model","c":"RowGameModel","l":"getFinalResult()"},{"p":"model","c":"RowBlockModel","l":"getGame()"},{"p":"model","c":"Player","l":"getID()"},{"p":"model","c":"RowBlockModel","l":"getIsLegalMove()"},{"p":"model","c":"RowGameModel","l":"getPlayer()"},{"p":"view","c":"BlockIndex","l":"getRow()"},{"p":"view","c":"RowGameGUI","l":"gui"},{"p":"model","c":"Player","l":"id"},{"p":"model","c":"RowBlockModel","l":"isLegalMove"},{"p":"","c":"RowGameApp","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"view","c":"BlockIndex","l":"matches(int, int)","u":"matches(int,int)"},{"p":"controller","c":"RowGameController","l":"move(JButton)","u":"move(javax.swing.JButton)"},{"p":"model","c":"RowGameModel","l":"movesLeft"},{"p":"model","c":"RowGameModel","l":"player"},{"p":"model","c":"Player","l":"PLAYER_1"},{"p":"model","c":"Player","l":"PLAYER_2"},{"p":"model","c":"Player","l":"Player(int)","u":"%3Cinit%3E(int)"},{"p":"view","c":"GameStatusView","l":"playerturn"},{"p":"view","c":"RowGameGUI","l":"reset"},{"p":"model","c":"RowBlockModel","l":"reset()"},{"p":"controller","c":"RowGameController","l":"resetGame()"},{"p":"view","c":"BlockIndex","l":"row"},{"p":"model","c":"RowBlockModel","l":"RowBlockModel(RowGameModel)","u":"%3Cinit%3E(model.RowGameModel)"},{"p":"","c":"RowGameApp","l":"RowGameApp()","u":"%3Cinit%3E()"},{"p":"controller","c":"RowGameController","l":"RowGameController()","u":"%3Cinit%3E()"},{"p":"view","c":"RowGameGUI","l":"RowGameGUI(RowGameController)","u":"%3Cinit%3E(controller.RowGameController)"},{"p":"model","c":"RowGameModel","l":"RowGameModel()","u":"%3Cinit%3E()"},{"p":"model","c":"RowBlockModel","l":"setContents(String)","u":"setContents(java.lang.String)"},{"p":"model","c":"RowGameModel","l":"setFinalResult(String)","u":"setFinalResult(java.lang.String)"},{"p":"model","c":"RowBlockModel","l":"setIsLegalMove(boolean)"},{"p":"model","c":"RowGameModel","l":"setPlayer(Player)","u":"setPlayer(model.Player)"},{"p":"model","c":"Player","l":"toString()"},{"p":"view","c":"GameBoardView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameStatusView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"RowGameGUI","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"View","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameBoardView","l":"updateBlock(RowGameModel, int, int)","u":"updateBlock(model.RowGameModel,int,int)"},{"p":"model","c":"Player","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"model","c":"Player","l":"values()"},{"p":"view","c":"RowGameGUI","l":"viewList"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/model/Player.html b/tictactoe/jdoc/model/Player.html new file mode 100644 index 00000000..80f6b640 --- /dev/null +++ b/tictactoe/jdoc/model/Player.html @@ -0,0 +1,298 @@ + + + + +Player (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+ +
+
程序包 model
+

Enum Class Player

+
+ +
+
+
所有已实现的接口:
+
Serializable, Comparable<Player>, Constable
+
+
+
public enum Player +extends Enum<Player>
+
+
+ +
+
+
    + +
  • +
    +

    枚举常量详细资料

    +
      +
    • +
      +

      PLAYER_1

      +
      public static final Player PLAYER_1
      +
      +
    • +
    • +
      +

      PLAYER_2

      +
      public static final Player PLAYER_2
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    字段详细资料

    +
      +
    • +
      +

      id

      +
      private int id
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    构造器详细资料

    +
      +
    • +
      +

      Player

      +
      private Player(int id)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    方法详细资料

    +
      +
    • +
      +

      values

      +
      public static Player[] values()
      +
      Returns an array containing the constants of this enum class, in +the order they are declared.
      +
      +
      返回:
      +
      an array containing the constants of this enum class, in the order they are declared
      +
      +
      +
    • +
    • +
      +

      valueOf

      +
      public static Player valueOf(String name)
      +
      Returns the enum constant of this class with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this class. (Extraneous whitespace characters are +not permitted.)
      +
      +
      参数:
      +
      name - 要返回的枚举常量的名称。
      +
      返回:
      +
      返回带有指定名称的枚举常量
      +
      抛出:
      +
      IllegalArgumentException - if this enum class has no constant with the specified name
      +
      NullPointerException - 如果参数为空值
      +
      +
      +
    • +
    • +
      +

      getID

      +
      public int getID()
      +
      +
    • +
    • +
      +

      toString

      +
      public String toString()
      +
      +
      覆盖:
      +
      toString 在类中 Enum<Player>
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/tictactoe/jdoc/model/RowBlockModel.html b/tictactoe/jdoc/model/RowBlockModel.html new file mode 100644 index 00000000..4a848a0d --- /dev/null +++ b/tictactoe/jdoc/model/RowBlockModel.html @@ -0,0 +1,289 @@ + + + + +RowBlockModel (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+ +
+
程序包 model
+

类 RowBlockModel

+
+
java.lang.Object +
model.RowBlockModel
+
+
+
+
public class RowBlockModel +extends Object
+
The TicTacToeBlock class represents a given block in the game.
+
+
+ +
+
+
    + +
  • +
    +

    字段详细资料

    +
      +
    • +
      +

      game

      +
      private RowGameModel game
      +
      The game that contains this block
      +
      +
    • +
    • +
      +

      contents

      +
      private String contents
      +
      The current value of the contents of this block
      +
      +
    • +
    • +
      +

      isLegalMove

      +
      private boolean isLegalMove
      +
      Whether or not it is currently legal to move into this block
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    构造器详细资料

    +
      +
    • +
      +

      RowBlockModel

      +
      public RowBlockModel(RowGameModel game)
      +
      Creates a new block that will be contained in the given game.
      +
      +
      参数:
      +
      game - The game that will contain the new block
      +
      抛出:
      +
      IllegalArgumentException - When the given game is null
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    方法详细资料

    +
      +
    • +
      +

      getGame

      +
      public RowGameModel getGame()
      +
      +
    • +
    • +
      +

      setContents

      +
      public void setContents(String value)
      +
      Sets the contents of this block to the given value.
      +
      +
      参数:
      +
      value - The new value for the contents of this block
      +
      抛出:
      +
      IllegalArgumentException - When the given value is null
      +
      +
      +
    • +
    • +
      +

      getContents

      +
      public String getContents()
      +
      Returns the non-null String value of the contents of this block.
      +
      +
      返回:
      +
      The non-null String value
      +
      +
      +
    • +
    • +
      +

      setIsLegalMove

      +
      public void setIsLegalMove(boolean isLegalMove)
      +
      +
    • +
    • +
      +

      getIsLegalMove

      +
      public boolean getIsLegalMove()
      +
      +
    • +
    • +
      +

      reset

      +
      public void reset()
      +
      Resets this block before starting a new game.
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/tictactoe/jdoc/model/RowGameModel.html b/tictactoe/jdoc/model/RowGameModel.html new file mode 100644 index 00000000..02da6992 --- /dev/null +++ b/tictactoe/jdoc/model/RowGameModel.html @@ -0,0 +1,262 @@ + + + + +RowGameModel (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+ +
+
程序包 model
+

类 RowGameModel

+
+
java.lang.Object +
model.RowGameModel
+
+
+
+
public class RowGameModel +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    字段详细资料

    +
      +
    • +
      +

      GAME_END_NOWINNER

      +
      public static final String GAME_END_NOWINNER
      +
      +
      另请参阅:
      +
      + +
      +
      +
      +
    • +
    • +
      +

      blocksData

      +
      public RowBlockModel[][] blocksData
      +
      +
    • +
    • +
      +

      player

      +
      private Player player
      +
      The current player taking their turn
      +
      +
    • +
    • +
      +

      movesLeft

      +
      public int movesLeft
      +
      +
    • +
    • +
      +

      finalResult

      +
      private String finalResult
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    构造器详细资料

    +
      +
    • +
      +

      RowGameModel

      +
      public RowGameModel()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    方法详细资料

    +
      +
    • +
      +

      getPlayer

      +
      public Player getPlayer()
      +
      +
    • +
    • +
      +

      setPlayer

      +
      public void setPlayer(Player player)
      +
      +
    • +
    • +
      +

      getFinalResult

      +
      public String getFinalResult()
      +
      +
    • +
    • +
      +

      setFinalResult

      +
      public void setFinalResult(String finalResult)
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/tictactoe/jdoc/model/class-use/Player.html b/tictactoe/jdoc/model/class-use/Player.html new file mode 100644 index 00000000..222a3307 --- /dev/null +++ b/tictactoe/jdoc/model/class-use/Player.html @@ -0,0 +1,114 @@ + + + + +Enum Class model.Player的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

Enum Class的使用
model.Player

+
+
使用Player的程序包
+
+
程序包
+
说明
+ +
 
+
+
+
    +
  • +
    +

    modelPlayer的使用

    +
    声明为Playermodel中的字段
    +
    +
    修饰符和类型
    +
    字段
    +
    说明
    +
    private Player
    +
    RowGameModel.player
    +
    +
    The current player taking their turn
    +
    +
    +
    返回Playermodel中的方法
    +
    +
    修饰符和类型
    +
    方法
    +
    说明
    + +
    RowGameModel.getPlayer()
    +
     
    +
    static Player
    +
    Player.valueOf(String name)
    +
    +
    Returns the enum constant of this class with the specified name.
    +
    +
    static Player[]
    +
    Player.values()
    +
    +
    Returns an array containing the constants of this enum class, in +the order they are declared.
    +
    +
    +
    参数类型为Playermodel中的方法
    +
    +
    修饰符和类型
    +
    方法
    +
    说明
    +
    void
    +
    RowGameModel.setPlayer(Player player)
    +
     
    +
    +
    +
  • +
+
+
+
+
+ + diff --git a/tictactoe/jdoc/model/class-use/RowBlockModel.html b/tictactoe/jdoc/model/class-use/RowBlockModel.html new file mode 100644 index 00000000..0c8935b3 --- /dev/null +++ b/tictactoe/jdoc/model/class-use/RowBlockModel.html @@ -0,0 +1,83 @@ + + + + +类 model.RowBlockModel的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

类的使用
model.RowBlockModel

+
+
使用RowBlockModel的程序包
+
+
程序包
+
说明
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/model/class-use/RowGameModel.html b/tictactoe/jdoc/model/class-use/RowGameModel.html new file mode 100644 index 00000000..565d96ba --- /dev/null +++ b/tictactoe/jdoc/model/class-use/RowGameModel.html @@ -0,0 +1,163 @@ + + + + +类 model.RowGameModel的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

类的使用
model.RowGameModel

+
+
使用RowGameModel的程序包
+
+
程序包
+
说明
+ +
 
+ +
 
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/model/package-summary.html b/tictactoe/jdoc/model/package-summary.html new file mode 100644 index 00000000..6e4650c2 --- /dev/null +++ b/tictactoe/jdoc/model/package-summary.html @@ -0,0 +1,95 @@ + + + + +model (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包 model

+
+
+
package model
+
+
    +
  • +
    +
    +
    +
    +
    +
    说明
    + +
     
    + +
    +
    The TicTacToeBlock class represents a given block in the game.
    +
    + +
     
    +
    +
    +
    +
  • +
+
+
+
+
+ + diff --git a/tictactoe/jdoc/model/package-tree.html b/tictactoe/jdoc/model/package-tree.html new file mode 100644 index 00000000..45c61201 --- /dev/null +++ b/tictactoe/jdoc/model/package-tree.html @@ -0,0 +1,87 @@ + + + + +model 类分层结构 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包model的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +
+
+

Enum Class Hierarchy

+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/model/package-use.html b/tictactoe/jdoc/model/package-use.html new file mode 100644 index 00000000..5ef82177 --- /dev/null +++ b/tictactoe/jdoc/model/package-use.html @@ -0,0 +1,112 @@ + + + + +程序包 model的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包的使用
model

+
+
使用model的程序包
+
+
程序包
+
说明
+ +
 
+ +
 
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/module-search-index.js b/tictactoe/jdoc/module-search-index.js new file mode 100644 index 00000000..0d59754f --- /dev/null +++ b/tictactoe/jdoc/module-search-index.js @@ -0,0 +1 @@ +moduleSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/overview-summary.html b/tictactoe/jdoc/overview-summary.html new file mode 100644 index 00000000..518b626a --- /dev/null +++ b/tictactoe/jdoc/overview-summary.html @@ -0,0 +1,26 @@ + + + + +CS520 - Homework 1 + + + + + + + + + + + +
+ +

index.html

+
+ + diff --git a/tictactoe/jdoc/overview-tree.html b/tictactoe/jdoc/overview-tree.html new file mode 100644 index 00000000..eb9c1bd9 --- /dev/null +++ b/tictactoe/jdoc/overview-tree.html @@ -0,0 +1,101 @@ + + + + +类分层结构 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

所有程序包的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +
+
+

接口分层结构

+ +
+
+

Enum Class Hierarchy

+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/package-search-index.js b/tictactoe/jdoc/package-search-index.js new file mode 100644 index 00000000..5dd0f850 --- /dev/null +++ b/tictactoe/jdoc/package-search-index.js @@ -0,0 +1 @@ +packageSearchIndex = [{"l":"controller"},{"l":"model"},{"l":"view"},{"l":"所有程序包","u":"allpackages-index.html"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/package-summary.html b/tictactoe/jdoc/package-summary.html new file mode 100644 index 00000000..1aed24bf --- /dev/null +++ b/tictactoe/jdoc/package-summary.html @@ -0,0 +1,82 @@ + + + + +Unnamed Package (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

Unnamed Package

+
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/package-tree.html b/tictactoe/jdoc/package-tree.html new file mode 100644 index 00000000..f6a9b0bb --- /dev/null +++ b/tictactoe/jdoc/package-tree.html @@ -0,0 +1,72 @@ + + + + + 类分层结构 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Unnamed Package

+程序包分层结构: + +
+
+

类分层结构

+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/package-use.html b/tictactoe/jdoc/package-use.html new file mode 100644 index 00000000..0fc4873f --- /dev/null +++ b/tictactoe/jdoc/package-use.html @@ -0,0 +1,58 @@ + + + + +程序包 的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

程序包的使用

+
+没有Unnamed Package的用法
+
+
+ + diff --git a/tictactoe/jdoc/resources/glass.png b/tictactoe/jdoc/resources/glass.png new file mode 100644 index 0000000000000000000000000000000000000000..a7f591f467a1c0c949bbc510156a0c1afb860a6e GIT binary patch literal 499 zcmVJoRsvExf%rEN>jUL}qZ_~k#FbE+Q;{`;0FZwVNX2n-^JoI; zP;4#$8DIy*Yk-P>VN(DUKmPse7mx+ExD4O|;?E5D0Z5($mjO3`*anwQU^s{ZDK#Lz zj>~{qyaIx5K!t%=G&2IJNzg!ChRpyLkO7}Ry!QaotAHAMpbB3AF(}|_f!G-oI|uK6 z`id_dumai5K%C3Y$;tKS_iqMPHg<*|-@e`liWLAggVM!zAP#@l;=c>S03;{#04Z~5 zN_+ss=Yg6*hTr59mzMwZ@+l~q!+?ft!fF66AXT#wWavHt30bZWFCK%!BNk}LN?0Hg z1VF_nfs`Lm^DjYZ1(1uD0u4CSIr)XAaqW6IT{!St5~1{i=i}zAy76p%_|w8rh@@c0Axr!ns=D-X+|*sY6!@wacG9%)Qn*O zl0sa739kT-&_?#oVxXF6tOnqTD)cZ}2vi$`ZU8RLAlo8=_z#*P3xI~i!lEh+Pdu-L zx{d*wgjtXbnGX_Yf@Tc7Q3YhLhPvc8noGJs2DA~1DySiA&6V{5JzFt ojAY1KXm~va;tU{v7C?Xj0BHw!K;2aXV*mgE07*qoM6N<$f;4TDA^-pY literal 0 HcmV?d00001 diff --git a/tictactoe/jdoc/script-dir/jquery-3.6.0.min.js b/tictactoe/jdoc/script-dir/jquery-3.6.0.min.js new file mode 100644 index 00000000..c4c6022f --- /dev/null +++ b/tictactoe/jdoc/script-dir/jquery-3.6.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=x.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthC(E(s),E(n))?o.important="horizontal":o.important="vertical",c.using.call(this,t,o)}),l.offset(x.extend(u,{using:t}))})},x.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,l=s-o,a=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=x(t.target),i=x(x.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){x.contains(this.element[0],x.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=x(t.target).closest(".ui-menu-item"),i=x(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=x(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case x.ui.keyCode.PAGE_UP:this.previousPage(t);break;case x.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case x.ui.keyCode.HOME:this._move("first","first",t);break;case x.ui.keyCode.END:this._move("last","last",t);break;case x.ui.keyCode.UP:this.previous(t);break;case x.ui.keyCode.DOWN:this.next(t);break;case x.ui.keyCode.LEFT:this.collapse(t);break;case x.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case x.ui.keyCode.ENTER:case x.ui.keyCode.SPACE:this._activate(t);break;case x.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=x(this),e=t.prev(),i=x("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=x(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!x.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(x.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(x.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=x("
    ").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){x(t.target).trigger(t.originalEvent)});s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(x("
    ").text(i))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==x.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=x("
    ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||x.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?x(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(x.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=x.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(x("
    ").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),x.extend(x.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(x.ui.autocomplete.escapeRegex(e),"i");return x.grep(t,function(t){return i.test(t.label||t.value||t)})}}),x.widget("ui.autocomplete",x.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1").text(e))},100))}});x.ui.autocomplete}); \ No newline at end of file diff --git a/tictactoe/jdoc/script.js b/tictactoe/jdoc/script.js new file mode 100644 index 00000000..0765364e --- /dev/null +++ b/tictactoe/jdoc/script.js @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +var moduleSearchIndex; +var packageSearchIndex; +var typeSearchIndex; +var memberSearchIndex; +var tagSearchIndex; +function loadScripts(doc, tag) { + createElem(doc, tag, 'search.js'); + + createElem(doc, tag, 'module-search-index.js'); + createElem(doc, tag, 'package-search-index.js'); + createElem(doc, tag, 'type-search-index.js'); + createElem(doc, tag, 'member-search-index.js'); + createElem(doc, tag, 'tag-search-index.js'); +} + +function createElem(doc, tag, path) { + var script = doc.createElement(tag); + var scriptElement = doc.getElementsByTagName(tag)[0]; + script.src = pathtoroot + path; + scriptElement.parentNode.insertBefore(script, scriptElement); +} + +function show(tableId, selected, columns) { + if (tableId !== selected) { + document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')') + .forEach(function(elem) { + elem.style.display = 'none'; + }); + } + document.querySelectorAll('div.' + selected) + .forEach(function(elem, index) { + elem.style.display = ''; + var isEvenRow = index % (columns * 2) < columns; + elem.classList.remove(isEvenRow ? oddRowColor : evenRowColor); + elem.classList.add(isEvenRow ? evenRowColor : oddRowColor); + }); + updateTabs(tableId, selected); +} + +function updateTabs(tableId, selected) { + document.querySelector('div#' + tableId +' .summary-table') + .setAttribute('aria-labelledby', selected); + document.querySelectorAll('button[id^="' + tableId + '"]') + .forEach(function(tab, index) { + if (selected === tab.id || (tableId === selected && index === 0)) { + tab.className = activeTableTab; + tab.setAttribute('aria-selected', true); + tab.setAttribute('tabindex',0); + } else { + tab.className = tableTab; + tab.setAttribute('aria-selected', false); + tab.setAttribute('tabindex',-1); + } + }); +} + +function switchTab(e) { + var selected = document.querySelector('[aria-selected=true]'); + if (selected) { + if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) { + // left or up arrow key pressed: move focus to previous tab + selected.previousSibling.click(); + selected.previousSibling.focus(); + e.preventDefault(); + } else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) { + // right or down arrow key pressed: move focus to next tab + selected.nextSibling.click(); + selected.nextSibling.focus(); + e.preventDefault(); + } + } +} + +var updateSearchResults = function() {}; + +function indexFilesLoaded() { + return moduleSearchIndex + && packageSearchIndex + && typeSearchIndex + && memberSearchIndex + && tagSearchIndex; +} + +// Workaround for scroll position not being included in browser history (8249133) +document.addEventListener("DOMContentLoaded", function(e) { + var contentDiv = document.querySelector("div.flex-content"); + window.addEventListener("popstate", function(e) { + if (e.state !== null) { + contentDiv.scrollTop = e.state; + } + }); + window.addEventListener("hashchange", function(e) { + history.replaceState(contentDiv.scrollTop, document.title); + }); + contentDiv.addEventListener("scroll", function(e) { + var timeoutID; + if (!timeoutID) { + timeoutID = setTimeout(function() { + history.replaceState(contentDiv.scrollTop, document.title); + timeoutID = null; + }, 100); + } + }); + if (!location.hash) { + history.replaceState(contentDiv.scrollTop, document.title); + } +}); diff --git a/tictactoe/jdoc/search.js b/tictactoe/jdoc/search.js new file mode 100644 index 00000000..13aba853 --- /dev/null +++ b/tictactoe/jdoc/search.js @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +var noResult = {l: "No results found"}; +var loading = {l: "Loading search index..."}; +var catModules = "Modules"; +var catPackages = "Packages"; +var catTypes = "Classes and Interfaces"; +var catMembers = "Members"; +var catSearchTags = "Search Tags"; +var highlight = "$&"; +var searchPattern = ""; +var fallbackPattern = ""; +var RANKING_THRESHOLD = 2; +var NO_MATCH = 0xffff; +var MIN_RESULTS = 3; +var MAX_RESULTS = 500; +var UNNAMED = ""; +function escapeHtml(str) { + return str.replace(//g, ">"); +} +function getHighlightedText(item, matcher, fallbackMatcher) { + var escapedItem = escapeHtml(item); + var highlighted = escapedItem.replace(matcher, highlight); + if (highlighted === escapedItem) { + highlighted = escapedItem.replace(fallbackMatcher, highlight) + } + return highlighted; +} +function getURLPrefix(ui) { + var urlPrefix=""; + var slash = "/"; + if (ui.item.category === catModules) { + return ui.item.l + slash; + } else if (ui.item.category === catPackages && ui.item.m) { + return ui.item.m + slash; + } else if (ui.item.category === catTypes || ui.item.category === catMembers) { + if (ui.item.m) { + urlPrefix = ui.item.m + slash; + } else { + $.each(packageSearchIndex, function(index, item) { + if (item.m && ui.item.p === item.l) { + urlPrefix = item.m + slash; + } + }); + } + } + return urlPrefix; +} +function createSearchPattern(term) { + var pattern = ""; + var isWordToken = false; + term.replace(/,\s*/g, ", ").trim().split(/\s+/).forEach(function(w, index) { + if (index > 0) { + // whitespace between identifiers is significant + pattern += (isWordToken && /^\w/.test(w)) ? "\\s+" : "\\s*"; + } + var tokens = w.split(/(?=[A-Z,.()<>[\/])/); + for (var i = 0; i < tokens.length; i++) { + var s = tokens[i]; + if (s === "") { + continue; + } + pattern += $.ui.autocomplete.escapeRegex(s); + isWordToken = /\w$/.test(s); + if (isWordToken) { + pattern += "([a-z0-9_$<>\\[\\]]*?)"; + } + } + }); + return pattern; +} +function createMatcher(pattern, flags) { + var isCamelCase = /[A-Z]/.test(pattern); + return new RegExp(pattern, flags + (isCamelCase ? "" : "i")); +} +var watermark = 'Search'; +$(function() { + var search = $("#search-input"); + var reset = $("#reset-button"); + search.val(''); + search.prop("disabled", false); + reset.prop("disabled", false); + search.val(watermark).addClass('watermark'); + search.blur(function() { + if ($(this).val().length === 0) { + $(this).val(watermark).addClass('watermark'); + } + }); + search.on('click keydown paste', function() { + if ($(this).val() === watermark) { + $(this).val('').removeClass('watermark'); + } + }); + reset.click(function() { + search.val('').focus(); + }); + search.focus()[0].setSelectionRange(0, 0); +}); +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function() { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function(ul, items) { + var rMenu = this; + var currentCategory = ""; + rMenu.menu.bindings = $(); + $.each(items, function(index, item) { + var li; + if (item.category && item.category !== currentCategory) { + ul.append("
  • " + item.category + "
  • "); + currentCategory = item.category; + } + li = rMenu._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", item.category + " : " + item.l); + li.attr("class", "result-item"); + } else { + li.attr("aria-label", item.l); + li.attr("class", "result-item"); + } + }); + }, + _renderItem: function(ul, item) { + var label = ""; + var matcher = createMatcher(escapeHtml(searchPattern), "g"); + var fallbackMatcher = new RegExp(fallbackPattern, "gi") + if (item.category === catModules) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catPackages) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catTypes) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catMembers) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.c + "." + item.l, matcher, fallbackMatcher); + } else if (item.category === catSearchTags) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else { + label = item.l; + } + var li = $("
  • ").appendTo(ul); + var div = $("
    ").appendTo(li); + if (item.category === catSearchTags && item.h) { + if (item.d) { + div.html(label + " (" + item.h + ")
    " + + item.d + "
    "); + } else { + div.html(label + " (" + item.h + ")"); + } + } else { + if (item.m) { + div.html(item.m + "/" + label); + } else { + div.html(label); + } + } + return li; + } +}); +function rankMatch(match, category) { + if (!match) { + return NO_MATCH; + } + var index = match.index; + var input = match.input; + var leftBoundaryMatch = 2; + var periferalMatch = 0; + // make sure match is anchored on a left word boundary + if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index]) { + leftBoundaryMatch = 0; + } else if ("_" === input[index - 1] || (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input))) { + leftBoundaryMatch = 1; + } + var matchEnd = index + match[0].length; + var leftParen = input.indexOf("("); + var endOfName = leftParen > -1 ? leftParen : input.length; + // exclude peripheral matches + if (category !== catModules && category !== catSearchTags) { + var delim = category === catPackages ? "/" : "."; + if (leftParen > -1 && leftParen < index) { + periferalMatch += 2; + } else if (input.lastIndexOf(delim, endOfName) >= matchEnd) { + periferalMatch += 2; + } + } + var delta = match[0].length === endOfName ? 0 : 1; // rank full match higher than partial match + for (var i = 1; i < match.length; i++) { + // lower ranking if parts of the name are missing + if (match[i]) + delta += match[i].length; + } + if (category === catTypes) { + // lower ranking if a type name contains unmatched camel-case parts + if (/[A-Z]/.test(input.substring(matchEnd))) + delta += 5; + if (/[A-Z]/.test(input.substring(0, index))) + delta += 5; + } + return leftBoundaryMatch + periferalMatch + (delta / 200); + +} +function doSearch(request, response) { + var result = []; + searchPattern = createSearchPattern(request.term); + fallbackPattern = createSearchPattern(request.term.toLowerCase()); + if (searchPattern === "") { + return this.close(); + } + var camelCaseMatcher = createMatcher(searchPattern, ""); + var fallbackMatcher = new RegExp(fallbackPattern, "i"); + + function searchIndexWithMatcher(indexArray, matcher, category, nameFunc) { + if (indexArray) { + var newResults = []; + $.each(indexArray, function (i, item) { + item.category = category; + var ranking = rankMatch(matcher.exec(nameFunc(item)), category); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ranking: ranking, item: item}); + } + return newResults.length <= MAX_RESULTS; + }); + return newResults.sort(function(e1, e2) { + return e1.ranking - e2.ranking; + }).map(function(e) { + return e.item; + }); + } + return []; + } + function searchIndex(indexArray, category, nameFunc) { + var primaryResults = searchIndexWithMatcher(indexArray, camelCaseMatcher, category, nameFunc); + result = result.concat(primaryResults); + if (primaryResults.length <= MIN_RESULTS && !camelCaseMatcher.ignoreCase) { + var secondaryResults = searchIndexWithMatcher(indexArray, fallbackMatcher, category, nameFunc); + result = result.concat(secondaryResults.filter(function (item) { + return primaryResults.indexOf(item) === -1; + })); + } + } + + searchIndex(moduleSearchIndex, catModules, function(item) { return item.l; }); + searchIndex(packageSearchIndex, catPackages, function(item) { + return (item.m && request.term.indexOf("/") > -1) + ? (item.m + "/" + item.l) : item.l; + }); + searchIndex(typeSearchIndex, catTypes, function(item) { + return request.term.indexOf(".") > -1 ? item.p + "." + item.l : item.l; + }); + searchIndex(memberSearchIndex, catMembers, function(item) { + return request.term.indexOf(".") > -1 + ? item.p + "." + item.c + "." + item.l : item.l; + }); + searchIndex(tagSearchIndex, catSearchTags, function(item) { return item.l; }); + + if (!indexFilesLoaded()) { + updateSearchResults = function() { + doSearch(request, response); + } + result.unshift(loading); + } else { + updateSearchResults = function() {}; + } + response(result); +} +$(function() { + $("#search-input").catcomplete({ + minLength: 1, + delay: 300, + source: doSearch, + response: function(event, ui) { + if (!ui.content.length) { + ui.content.push(noResult); + } else { + $("#search-input").empty(); + } + }, + autoFocus: true, + focus: function(event, ui) { + return false; + }, + position: { + collision: "flip" + }, + select: function(event, ui) { + if (ui.item.category) { + var url = getURLPrefix(ui); + if (ui.item.category === catModules) { + url += "module-summary.html"; + } else if (ui.item.category === catPackages) { + if (ui.item.u) { + url = ui.item.u; + } else { + url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; + } + } else if (ui.item.category === catTypes) { + if (ui.item.u) { + url = ui.item.u; + } else if (ui.item.p === UNNAMED) { + url += ui.item.l + ".html"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; + } + } else if (ui.item.category === catMembers) { + if (ui.item.p === UNNAMED) { + url += ui.item.c + ".html" + "#"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; + } + if (ui.item.u) { + url += ui.item.u; + } else { + url += ui.item.l; + } + } else if (ui.item.category === catSearchTags) { + url += ui.item.u; + } + if (top !== window) { + parent.classFrame.location = pathtoroot + url; + } else { + window.location.href = pathtoroot + url; + } + $("#search-input").focus(); + } + } + }); +}); diff --git a/tictactoe/jdoc/stylesheet.css b/tictactoe/jdoc/stylesheet.css new file mode 100644 index 00000000..6dc5b365 --- /dev/null +++ b/tictactoe/jdoc/stylesheet.css @@ -0,0 +1,866 @@ +/* + * Javadoc style sheet + */ + +@import url('resources/fonts/dejavu.css'); + +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; + padding:0; + height:100%; + width:100%; +} +iframe { + margin:0; + padding:0; + height:100%; + width:100%; + overflow-y:scroll; + border:none; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a[href]:hover, a[href]:focus { + text-decoration:none; + color:#bb7a2a; +} +a[name] { + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; +} +h4 { + font-size:15px; +} +h5 { + font-size:14px; +} +h6 { + font-size:13px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; +} +:not(h1, h2, h3, h4, h5, h6) > code, +:not(h1, h2, h3, h4, h5, h6) > tt { + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +.summary-table dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size: 14px; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.clear { + clear:both; + height:0; + overflow:hidden; +} +.about-language { + float:right; + padding:0 21px 8px 8px; + font-size:11px; + margin-top:-9px; + height:2.9em; +} +.legal-copy { + margin-left:.5em; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* + * Styles for navigation bar. + */ +@media screen { + .flex-box { + position:fixed; + display:flex; + flex-direction:column; + height: 100%; + width: 100%; + } + .flex-header { + flex: 0 0 auto; + } + .flex-content { + flex: 1 1 auto; + overflow-y: auto; + } +} +.top-nav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + min-height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.sub-nav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.sub-nav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list { + padding-top:5px; +} +ul.nav-list { + display:block; + margin:0 25px 0 0; + padding:0; +} +ul.sub-nav-list { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.nav-list li { + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list-search { + float:right; + margin:0 0 0 0; + padding:5px 6px; + clear:none; +} +.nav-list-search label { + position:relative; + right:-16px; +} +ul.sub-nav-list li { + list-style:none; + float:left; + padding-top:10px; +} +.top-nav a:link, .top-nav a:active, .top-nav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.top-nav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.nav-bar-cell1-rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header and footer. + */ +.title { + color:#2c4557; + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3, +body.class-declaration-page .summary .inherited-list h2 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +/* + * Styles for page layout containers. + */ +main { + clear:both; + padding:10px 20px; + position:relative; +} +dl.notes > dt { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +dl.notes > dd { + margin:5px 10px 10px 0; + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:10px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +.summary-table dl, .summary-table dl dt, .summary-table dl dd { + margin-top:0; + margin-bottom:1px; +} +ul.see-list, ul.see-list-long { + padding-left: 0; + list-style: none; +} +ul.see-list li { + display: inline; +} +ul.see-list li:not(:last-child):after, +ul.see-list-long li:not(:last-child):after { + content: ", "; + white-space: pre-wrap; +} +/* + * Styles for tables. + */ +.summary-table, .details-table { + width:100%; + border-spacing:0; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; + padding:0; +} +.caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0; + padding-top:10px; + padding-left:1px; + margin:0; + white-space:pre; +} +.caption a:link, .caption a:visited { + color:#1f389c; +} +.caption a:hover, +.caption a:active { + color:#FFFFFF; +} +.caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +div.table-tabs { + padding:10px 0 0 1px; + margin:0; +} +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; +} +div.table-tabs > button.active-table-tab { + background: #F8981D; + color: #253441; +} +div.table-tabs > button.table-tab { + background: #4D7A97; + color: #FFFFFF; +} +.two-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); +} +.three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(15%, max-content) minmax(15%, auto); +} +.four-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(10%, max-content) minmax(10%, max-content) minmax(10%, auto); +} +@media screen and (max-width: 600px) { + .two-column-summary { + display: grid; + grid-template-columns: 1fr; + } +} +@media screen and (max-width: 800px) { + .three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(25%, auto); + } + .three-column-summary .col-last { + grid-column-end: span 2; + } +} +@media screen and (max-width: 1000px) { + .four-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); + } +} +.summary-table > div, .details-table > div { + text-align:left; + padding: 8px 3px 3px 7px; +} +.col-first, .col-second, .col-last, .col-constructor-name, .col-summary-item-name { + vertical-align:top; + padding-right:0; + padding-top:8px; + padding-bottom:3px; +} +.table-header { + background:#dee3e9; + font-weight: bold; +} +.col-first, .col-first { + font-size:13px; +} +.col-second, .col-second, .col-last, .col-constructor-name, .col-summary-item-name, .col-last { + font-size:13px; +} +.col-first, .col-second, .col-constructor-name { + vertical-align:top; + overflow: auto; +} +.col-last { + white-space:normal; +} +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-constructor-name a:link, .col-constructor-name a:visited, +.col-summary-item-name a:link, .col-summary-item-name a:visited, +.constant-values-container a:link, .constant-values-container a:visited, +.all-classes-container a:link, .all-classes-container a:visited, +.all-packages-container a:link, .all-packages-container a:visited { + font-weight:bold; +} +.table-sub-heading-color { + background-color:#EEEEFF; +} +.even-row-color, .even-row-color .table-header { + background-color:#FFFFFF; +} +.odd-row-color, .odd-row-color .table-header { + background-color:#EEEEEF; +} +/* + * Styles for contents. + */ +.deprecated-content { + margin:0; + padding:10px 0; +} +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +.col-last div { + padding-top:0; +} +.col-last a { + padding-bottom:3px; +} +.module-signature, +.package-signature, +.type-signature, +.member-signature { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + margin:14px 0; + white-space: pre-wrap; +} +.module-signature, +.package-signature, +.type-signature { + margin-top: 0; +} +.member-signature .type-parameters-long, +.member-signature .parameters, +.member-signature .exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +.member-signature .type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:0 10px 5px 0; + color:#474747; +} +.deprecated-label, .descfrm-type-label, .implementation-label, .member-name-label, .member-name-link, +.module-label-in-package, .module-label-in-type, .override-specify-label, .package-label-in-type, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .preview-comment { + font-style:italic; +} +.deprecation-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +.preview-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment { + font-style:normal; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color:#4D7A97; + color:#FFFFFF; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow-y:scroll; + overflow-x:scroll; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +ul.ui-autocomplete { + position:fixed; + z-index:999999; + background-color: #FFFFFF; +} +ul.ui-autocomplete li { + float:left; + clear:both; + width:100%; +} +.ui-autocomplete .result-item { + font-size: inherit; +} +.ui-autocomplete .result-highlight { + font-weight:bold; +} +#search-input { + background-image:url('resources/glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + padding-left:20px; + position:relative; + right:-18px; + width:400px; +} +#reset-button { + background-color: rgb(255,255,255); + background-image:url('resources/x.png'); + background-position:center; + background-repeat:no-repeat; + background-size:12px; + border:0 none; + width:16px; + height:16px; + position:relative; + left:-4px; + top:-4px; + font-size:0px; +} +.watermark { + color:#545454; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:yellow; +} +.module-graph span { + display:none; + position:absolute; +} +.module-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 1; +} +.inherited-list { + margin: 10px 0 10px 0; +} +section.class-description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0px 20px 5px 10px; + border: 1px solid #ededed; + background-color: #f8f8f8; +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +.vertical-separator { + padding: 0 5px; +} +ul.help-section-list { + margin: 0; +} +ul.help-subtoc > li { + display: inline-block; + padding-right: 5px; + font-size: smaller; +} +ul.help-subtoc > li::before { + content: "\2022" ; + padding-right:2px; +} +span.help-note { + font-style: italic; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} + +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #E3E3E3; +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} +table.striped > tbody > tr > th { + font-weight: normal; +} +/** + * Tweak font sizes and paddings for small screens. + */ +@media screen and (max-width: 1050px) { + #search-input { + width: 300px; + } +} +@media screen and (max-width: 800px) { + #search-input { + width: 200px; + } + .top-nav, + .bottom-nav { + font-size: 11px; + padding-top: 6px; + } + .sub-nav { + font-size: 11px; + } + .about-language { + padding-right: 16px; + } + ul.nav-list li, + .sub-nav .nav-list-search { + padding: 6px; + } + ul.sub-nav-list li { + padding-top: 5px; + } + main { + padding: 10px; + } + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0 8px 5px 8px; + } + body { + -webkit-text-size-adjust: none; + } +} +@media screen and (max-width: 500px) { + #search-input { + width: 150px; + } + .top-nav, + .bottom-nav { + font-size: 10px; + } + .sub-nav { + font-size: 10px; + } + .about-language { + font-size: 10px; + padding-right: 12px; + } +} diff --git a/tictactoe/jdoc/tag-search-index.js b/tictactoe/jdoc/tag-search-index.js new file mode 100644 index 00000000..9f5ca6e5 --- /dev/null +++ b/tictactoe/jdoc/tag-search-index.js @@ -0,0 +1 @@ +tagSearchIndex = [{"l":"常量字段值","h":"","u":"constant-values.html"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/type-search-index.js b/tictactoe/jdoc/type-search-index.js new file mode 100644 index 00000000..f5002648 --- /dev/null +++ b/tictactoe/jdoc/type-search-index.js @@ -0,0 +1 @@ +typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"view","l":"BlockIndex"},{"p":"view","l":"GameBoardView"},{"p":"view","l":"GameStatusView"},{"p":"model","l":"Player"},{"p":"model","l":"RowBlockModel"},{"p":"","l":"RowGameApp"},{"p":"controller","l":"RowGameController"},{"p":"view","l":"RowGameGUI"},{"p":"model","l":"RowGameModel"},{"p":"view","l":"View"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/view/BlockIndex.html b/tictactoe/jdoc/view/BlockIndex.html new file mode 100644 index 00000000..8daa7091 --- /dev/null +++ b/tictactoe/jdoc/view/BlockIndex.html @@ -0,0 +1,219 @@ + + + + +BlockIndex (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 view
    +

    类 BlockIndex

    +
    +
    java.lang.Object +
    view.BlockIndex
    +
    +
    +
    +
    public class BlockIndex +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      字段详细资料

      +
        +
      • +
        +

        row

        +
        private final int row
        +
        +
      • +
      • +
        +

        column

        +
        private final int column
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      构造器详细资料

      +
        +
      • +
        +

        BlockIndex

        +
        public BlockIndex(int row, + int column)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      方法详细资料

      +
        +
      • +
        +

        getRow

        +
        public int getRow()
        +
        +
      • +
      • +
        +

        getColumn

        +
        public int getColumn()
        +
        +
      • +
      • +
        +

        matches

        +
        public boolean matches(int row, + int column)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/GameBoardView.html b/tictactoe/jdoc/view/GameBoardView.html new file mode 100644 index 00000000..32bbb877 --- /dev/null +++ b/tictactoe/jdoc/view/GameBoardView.html @@ -0,0 +1,247 @@ + + + + +GameBoardView (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 view
    +

    类 GameBoardView

    +
    +
    java.lang.Object +
    view.GameBoardView
    +
    +
    +
    +
    所有已实现的接口:
    +
    View
    +
    +
    +
    public class GameBoardView +extends Object +implements View
    +
    The GameBoardView class visualizes the game board of blocks. + + NOTE) For the Composite design pattern, this class is-a Component (i.e. View).
    +
    +
    + +
    +
    +
      + +
    • +
      +

      字段详细资料

      +
        +
      • +
        +

        blocks

        +
        private JButton[][] blocks
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      构造器详细资料

      + +
      +
    • + +
    • +
      +

      方法详细资料

      +
        +
      • +
        +

        getBlockIndex

        +
        public BlockIndex getBlockIndex(JButton block)
        +
        Returns the BlockIndex (pair of row and column) of the given block + if it is part of this game board and returns null otherwise.
        +
        +
        参数:
        +
        block - The block of interest
        +
        返回:
        +
        The BlockIndex (pair of row and column) of the given block + if it is part of this game board and null otherwise
        +
        +
        +
      • +
      • +
        +

        updateBlock

        +
        public void updateBlock(RowGameModel gameModel, + int row, + int column)
        +
        Updates the block at the given row and column + after one of the player's moves.
        +
        +
        参数:
        +
        gameModel - The RowGameModel containing the block
        +
        row - The row that contains the block
        +
        column - The column that contains the block
        +
        +
        +
      • +
      • +
        +

        update

        +
        public void update(RowGameModel model)
        +
        +
        指定者:
        +
        update 在接口中 View
        +
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/GameStatusView.html b/tictactoe/jdoc/view/GameStatusView.html new file mode 100644 index 00000000..5785f5f7 --- /dev/null +++ b/tictactoe/jdoc/view/GameStatusView.html @@ -0,0 +1,201 @@ + + + + +GameStatusView (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 view
    +

    类 GameStatusView

    +
    +
    java.lang.Object +
    view.GameStatusView
    +
    +
    +
    +
    所有已实现的接口:
    +
    View
    +
    +
    +
    public class GameStatusView +extends Object +implements View
    +
    The GameStatusView class visualizes the game status as either in progress, + current player's turn, or finished, either win or tie. + + NOTE) For the Composite design pattern, this class is-a Component (i.e. View).
    +
    +
    + +
    +
    +
      + +
    • +
      +

      字段详细资料

      +
        +
      • +
        +

        playerturn

        +
        private JTextArea playerturn
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      构造器详细资料

      +
        +
      • +
        +

        GameStatusView

        +
        public GameStatusView(JPanel messages)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      方法详细资料

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/RowGameGUI.html b/tictactoe/jdoc/view/RowGameGUI.html new file mode 100644 index 00000000..5be9aad2 --- /dev/null +++ b/tictactoe/jdoc/view/RowGameGUI.html @@ -0,0 +1,259 @@ + + + + +RowGameGUI (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 view
    +

    类 RowGameGUI

    +
    +
    java.lang.Object +
    view.RowGameGUI
    +
    +
    +
    +
    所有已实现的接口:
    +
    View
    +
    +
    +
    public class RowGameGUI +extends Object +implements View
    +
    The RowGameGUI class is applying the Composite design pattern. + This class is the Composite. The class also is-a Component (i.e. View).
    +
    +
    + +
    +
    +
      + +
    • +
      +

      字段详细资料

      +
        +
      • +
        +

        gui

        +
        public JFrame gui
        +
        +
      • +
      • +
        +

        gameModel

        +
        public RowGameModel gameModel
        +
        +
      • +
      • +
        +

        gameBoardView

        +
        private GameBoardView gameBoardView
        +
        +
      • +
      • +
        +

        viewList

        +
        private List<View> viewList
        +
        For the Composite design pattern, the RowGameGUI is the Composite
        +
        +
      • +
      • +
        +

        reset

        +
        public JButton reset
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      构造器详细资料

      +
        +
      • +
        +

        RowGameGUI

        +
        public RowGameGUI(RowGameController controller)
        +
        Creates a new game initializing the GUI.
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      方法详细资料

      +
        +
      • +
        +

        getBlockIndex

        +
        public BlockIndex getBlockIndex(JButton block)
        +
        +
      • +
      • +
        +

        addView

        +
        public void addView(View view)
        +
        +
      • +
      • +
        +

        update

        +
        public void update(RowGameModel model)
        +
        +
        指定者:
        +
        update 在接口中 View
        +
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/View.html b/tictactoe/jdoc/view/View.html new file mode 100644 index 00000000..bad18a2c --- /dev/null +++ b/tictactoe/jdoc/view/View.html @@ -0,0 +1,132 @@ + + + + +View (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 view
    +

    接口 View

    +
    +
    +
    +
    所有已知实现类:
    +
    GameBoardView, GameStatusView, RowGameGUI
    +
    +
    +
    public interface View
    +
    The View interfaces supports updating the visualizations of the Model. + + NOTE) For the Composite design pattern, the View interface is the Component interface.
    +
    +
    +
      + +
    • +
      +

      方法概要

      +
      +
      +
      +
      +
      修饰符和类型
      +
      方法
      +
      说明
      +
      void
      + +
       
      +
      +
      +
      +
      +
    • +
    +
    +
    +
      + +
    • +
      +

      方法详细资料

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/class-use/BlockIndex.html b/tictactoe/jdoc/view/class-use/BlockIndex.html new file mode 100644 index 00000000..c86adc4d --- /dev/null +++ b/tictactoe/jdoc/view/class-use/BlockIndex.html @@ -0,0 +1,89 @@ + + + + +类 view.BlockIndex的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    类的使用
    view.BlockIndex

    +
    +
    使用BlockIndex的程序包
    +
    +
    程序包
    +
    说明
    + +
     
    +
    +
    + +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/class-use/GameBoardView.html b/tictactoe/jdoc/view/class-use/GameBoardView.html new file mode 100644 index 00000000..29d7f654 --- /dev/null +++ b/tictactoe/jdoc/view/class-use/GameBoardView.html @@ -0,0 +1,83 @@ + + + + +类 view.GameBoardView的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    类的使用
    view.GameBoardView

    +
    +
    使用GameBoardView的程序包
    +
    +
    程序包
    +
    说明
    + +
     
    +
    +
    + +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/class-use/GameStatusView.html b/tictactoe/jdoc/view/class-use/GameStatusView.html new file mode 100644 index 00000000..af51e42a --- /dev/null +++ b/tictactoe/jdoc/view/class-use/GameStatusView.html @@ -0,0 +1,58 @@ + + + + +类 view.GameStatusView的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    类的使用
    view.GameStatusView

    +
    +没有view.GameStatusView的用法
    +
    +
    + + diff --git a/tictactoe/jdoc/view/class-use/RowGameGUI.html b/tictactoe/jdoc/view/class-use/RowGameGUI.html new file mode 100644 index 00000000..43a03edf --- /dev/null +++ b/tictactoe/jdoc/view/class-use/RowGameGUI.html @@ -0,0 +1,83 @@ + + + + +类 view.RowGameGUI的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    类的使用
    view.RowGameGUI

    +
    +
    使用RowGameGUI的程序包
    +
    +
    程序包
    +
    说明
    + +
     
    +
    +
    + +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/class-use/View.html b/tictactoe/jdoc/view/class-use/View.html new file mode 100644 index 00000000..f2bb5f0c --- /dev/null +++ b/tictactoe/jdoc/view/class-use/View.html @@ -0,0 +1,116 @@ + + + + +接口 view.View的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    接口的使用
    view.View

    +
    +
    使用View的程序包
    +
    +
    程序包
    +
    说明
    + +
     
    +
    +
    +
      +
    • +
      +

      viewView的使用

      +
      实现Viewview中的类
      +
      +
      修饰符和类型
      +
      +
      说明
      +
      class 
      + +
      +
      The GameBoardView class visualizes the game board of blocks.
      +
      +
      class 
      + +
      +
      The GameStatusView class visualizes the game status as either in progress, + current player's turn, or finished, either win or tie.
      +
      +
      class 
      + +
      +
      The RowGameGUI class is applying the Composite design pattern.
      +
      +
      +
      类型参数类型为Viewview中的字段
      +
      +
      修饰符和类型
      +
      字段
      +
      说明
      +
      private List<View>
      +
      RowGameGUI.viewList
      +
      +
      For the Composite design pattern, the RowGameGUI is the Composite
      +
      +
      +
      参数类型为Viewview中的方法
      +
      +
      修饰符和类型
      +
      方法
      +
      说明
      +
      void
      +
      RowGameGUI.addView(View view)
      +
       
      +
      +
      +
    • +
    +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/package-summary.html b/tictactoe/jdoc/view/package-summary.html new file mode 100644 index 00000000..94bb9d95 --- /dev/null +++ b/tictactoe/jdoc/view/package-summary.html @@ -0,0 +1,106 @@ + + + + +view (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    程序包 view

    +
    +
    +
    package view
    +
    +
      +
    • +
      +
      +
      +
      +
      +
      说明
      + +
       
      + +
      +
      The GameBoardView class visualizes the game board of blocks.
      +
      + +
      +
      The GameStatusView class visualizes the game status as either in progress, + current player's turn, or finished, either win or tie.
      +
      + +
      +
      The RowGameGUI class is applying the Composite design pattern.
      +
      + +
      +
      The View interfaces supports updating the visualizations of the Model.
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/package-tree.html b/tictactoe/jdoc/view/package-tree.html new file mode 100644 index 00000000..a926626f --- /dev/null +++ b/tictactoe/jdoc/view/package-tree.html @@ -0,0 +1,81 @@ + + + + +view 类分层结构 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    程序包view的分层结构

    +程序包分层结构: + +
    +
    +

    类分层结构

    + +
    +
    +

    接口分层结构

    + +
    +
    +
    +
    + + diff --git a/tictactoe/jdoc/view/package-use.html b/tictactoe/jdoc/view/package-use.html new file mode 100644 index 00000000..b3e59af6 --- /dev/null +++ b/tictactoe/jdoc/view/package-use.html @@ -0,0 +1,103 @@ + + + + +程序包 view的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    程序包的使用
    view

    +
    +
    使用view的程序包
    +
    +
    程序包
    +
    说明
    + +
     
    + +
     
    +
    +
    +
      +
    • +
      +
      controller使用的view中的类
      +
      +
      +
      说明
      + +
      +
      The RowGameGUI class is applying the Composite design pattern.
      +
      +
      +
      +
    • +
    • +
      +
      view使用的view中的类
      +
      +
      +
      说明
      + +
       
      + +
      +
      The GameBoardView class visualizes the game board of blocks.
      +
      + +
      +
      The View interfaces supports updating the visualizations of the Model.
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    + + diff --git a/tictactoe/src/controller/RowGameController.java b/tictactoe/src/controller/RowGameController.java index 84e6ee28..a4d21fc4 100644 --- a/tictactoe/src/controller/RowGameController.java +++ b/tictactoe/src/controller/RowGameController.java @@ -13,373 +13,503 @@ import view.RowGameGUI; public class RowGameController { - public RowGameModel gameModel; - public RowGameGUI gameView; + public RowGameModel gameModel; + public RowGameGUI gameView; - /** - * Creates a new game initializing the GUI. - */ - public RowGameController() { - gameModel = new RowGameModel(); - gameView = new RowGameGUI(this); + // Add a new button to the GUI for undo functionality + private JButton undo = new JButton("Undo"); - for(int row = 0; row<3; row++) { - for(int column = 0; column<3 ;column++) { - gameModel.blocksData[row][column].setContents(""); - gameModel.blocksData[row][column].setIsLegalMove(true); - } - } + /** + * Creates a new game initializing the GUI. + */ + public RowGameController() { + gameModel = new RowGameModel(); + gameView = new RowGameGUI(this); + /////////////// + // add undo button to the GUI + // gameView.gui.add(undo, BorderLayout.SOUTH); - gameView.update(gameModel); - } + // add action listener to the undo button + // undo.addActionListener(new ActionListener() { + // public void actionPerformed(ActionEvent e) { + // undoMove(); + // } + // }); + //////////////// + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { + gameModel.blocksData[row][column].setContents(""); + gameModel.blocksData[row][column].setIsLegalMove(true); + } + } - /** - * Moves the current player into the given block. - * - * @param block The block to be moved to by the current player - */ - public void move(JButton block) { - // The Controller first manipulates the Model. - gameModel.movesLeft--; + gameView.update(gameModel); + } - BlockIndex blockIndex = gameView.getBlockIndex(block); - if(gameModel.getPlayer().equals(Player.PLAYER_1)) { - // Check whether player 1 won - if(blockIndex.matches(0, 0)) { - gameModel.blocksData[0][0].setContents("X"); - gameModel.blocksData[0][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[2][0].getContents())) || - (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][2].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(0, 1)) { - gameModel.blocksData[0][1].setContents("X"); - gameModel.blocksData[0][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][1].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(0, 2)) { - gameModel.blocksData[0][2].setContents("X"); - gameModel.blocksData[0][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents())) || - (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][2].getContents()) && - gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(1, 0)) { - gameModel.blocksData[1][0].setContents("X"); - gameModel.blocksData[1][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][2].getContents())) || - (gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(1, 1)) { - gameModel.blocksData[1][1].setContents("X"); - gameModel.blocksData[1][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][2].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[2][1].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()) && - gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(1, 2)) { - gameModel.blocksData[1][2].setContents("X"); - gameModel.blocksData[1][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents()) && - gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 0)) { - gameModel.blocksData[2][0].setContents("X"); - gameModel.blocksData[2][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][1].getContents()) && - gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents())) || - (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 1)) { - gameModel.blocksData[2][1].setContents("X"); - gameModel.blocksData[2][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents()) && - gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 2)) { - gameModel.blocksData[2][2].setContents("X"); - gameModel.blocksData[2][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_2); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[2][1].getContents()) && - gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents())) || - (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][2].getContents()) && - gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } - } else { - // Check whether player 2 won - if(blockIndex.matches(0, 0)) { - gameModel.blocksData[0][0].setContents("O"); - gameModel.blocksData[0][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[2][0].getContents())) || - (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][2].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(0, 1)) { - gameModel.blocksData[0][1].setContents("O"); - gameModel.blocksData[0][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][1].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(0, 2)) { - gameModel.blocksData[0][2].setContents("O"); - gameModel.blocksData[0][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents())) || - (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][2].getContents()) && - gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(1, 0)) { - gameModel.blocksData[1][0].setContents("O"); - gameModel.blocksData[1][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][2].getContents())) || - (gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } + ////////////// + public void undoMove() { + if (gameModel.movesLeft < 9) { + gameModel.undoMove(); // call the undoMove() method of the model + gameView.update(gameModel); // update the view with the new model state } - } else if(blockIndex.matches(1, 1)) { - gameModel.blocksData[1][1].setContents("O"); - gameModel.blocksData[1][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][2].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()) && - gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[2][1].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && - gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()) && - gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(1, 2)) { - gameModel.blocksData[1][2].setContents("O"); - gameModel.blocksData[1][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents()) && - gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 0)) { - gameModel.blocksData[2][0].setContents("O"); - gameModel.blocksData[2][0].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][1].getContents()) && - gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][0].getContents()) && - gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents())) || - (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 1)) { - gameModel.blocksData[2][1].setContents("O"); - gameModel.blocksData[2][1].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents()) && - gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][2].getContents())) || - (gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } else if(blockIndex.matches(2, 2)) { - gameModel.blocksData[2][2].setContents("O"); - gameModel.blocksData[2][2].setIsLegalMove(false); - gameModel.setPlayer(Player.PLAYER_1); - if(gameModel.movesLeft<7) { - if((gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[2][1].getContents()) && - gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents())) || - (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][2].getContents()) && - gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents())) || - (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][1].getContents()) && - gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()))) { - gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); - endGame(); - } else if(gameModel.movesLeft==0) { - gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); - } - } - } } + ////////////// + + /** + * Moves the current player into the given block. + * + * @param block The block to be moved to by the current player + */ + public void move(JButton block) { + // The Controller first manipulates the Model. + gameModel.movesLeft--; - // The Controller then updates the View. - gameView.update(gameModel); - } + BlockIndex blockIndex = gameView.getBlockIndex(block); + if (gameModel.getPlayer().equals(Player.PLAYER_1)) { + // Check whether player 1 won + if (blockIndex.matches(0, 0)) { + gameModel.blocksData[0][0].setContents("X"); + gameModel.blocksData[0][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(0, 0, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][1].getContents()) && + gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][0].getContents()) + && + gameModel.blocksData[1][0].getContents() + .equals(gameModel.blocksData[2][0].getContents())) + || + (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][2].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(0, 1)) { + gameModel.blocksData[0][1].setContents("X"); + gameModel.blocksData[0][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(0, 1, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && + gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][1].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(0, 2)) { + gameModel.blocksData[0][2].setContents("X"); + gameModel.blocksData[0][2].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(0, 2, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[0][1].getContents()) && + gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents())) + || + (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][2].getContents()) + && + gameModel.blocksData[1][2].getContents() + .equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 0)) { + gameModel.blocksData[1][0].setContents("X"); + gameModel.blocksData[1][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(1, 0, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && + gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][2].getContents())) + || + (gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents()) + && + gameModel.blocksData[0][0].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 1)) { + gameModel.blocksData[1][1].setContents("X"); + gameModel.blocksData[1][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(1, 1, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()) && + gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][2].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()) + && + gameModel.blocksData[0][1].getContents() + .equals(gameModel.blocksData[2][1].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()) + && + gameModel.blocksData[0][0].getContents() + .equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()) + && + gameModel.blocksData[0][2].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 2)) { + gameModel.blocksData[1][2].setContents("X"); + gameModel.blocksData[1][2].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(1, 2, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents()) && + gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[1][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 0)) { + gameModel.blocksData[2][0].setContents("X"); + gameModel.blocksData[2][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(2, 0, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][1].getContents()) && + gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][0].getContents()) + && + gameModel.blocksData[1][0].getContents() + .equals(gameModel.blocksData[0][0].getContents())) + || + (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][2].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 1)) { + gameModel.blocksData[2][1].setContents("X"); + gameModel.blocksData[2][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(2, 1, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents()) && + gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][1].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 2)) { + gameModel.blocksData[2][2].setContents("X"); + gameModel.blocksData[2][2].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_2); + gameModel.recordMove(2, 2, Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[2][1].getContents()) && + gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents())) + || + (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][2].getContents()) + && + gameModel.blocksData[1][2].getContents() + .equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_1 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } + } else { + // Check whether player 2 won + if (blockIndex.matches(0, 0)) { + gameModel.blocksData[0][0].setContents("O"); + gameModel.blocksData[0][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(0, 0, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][1].getContents()) && + gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][0].getContents()) + && + gameModel.blocksData[1][0].getContents() + .equals(gameModel.blocksData[2][0].getContents())) + || + (gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][2].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(0, 1)) { + gameModel.blocksData[0][1].setContents("O"); + gameModel.blocksData[0][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(0, 1, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents()) && + gameModel.blocksData[0][0].getContents().equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][1].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(0, 2)) { + gameModel.blocksData[0][2].setContents("O"); + gameModel.blocksData[0][2].setIsLegalMove(false); + gameModel.recordMove(0, 2, Player.PLAYER_2); + gameModel.setPlayer(Player.PLAYER_1); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[0][1].getContents()) && + gameModel.blocksData[0][1].getContents().equals(gameModel.blocksData[0][0].getContents())) + || + (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][2].getContents()) + && + gameModel.blocksData[1][2].getContents() + .equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 0)) { + gameModel.blocksData[1][0].setContents("O"); + gameModel.blocksData[1][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(1, 0, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][1].getContents()) && + gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][2].getContents())) + || + (gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[0][0].getContents()) + && + gameModel.blocksData[0][0].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 1)) { + gameModel.blocksData[1][1].setContents("O"); + gameModel.blocksData[1][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(1, 1, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[1][0].getContents()) && + gameModel.blocksData[1][0].getContents().equals(gameModel.blocksData[1][2].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][1].getContents()) + && + gameModel.blocksData[0][1].getContents() + .equals(gameModel.blocksData[2][1].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][0].getContents()) + && + gameModel.blocksData[0][0].getContents() + .equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[1][1].getContents().equals(gameModel.blocksData[0][2].getContents()) + && + gameModel.blocksData[0][2].getContents() + .equals(gameModel.blocksData[2][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(1, 2)) { + gameModel.blocksData[1][2].setContents("O"); + gameModel.blocksData[1][2].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(1, 2, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[0][2].getContents()) && + gameModel.blocksData[0][2].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[1][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[1][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 0)) { + gameModel.blocksData[2][0].setContents("O"); + gameModel.blocksData[2][0].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(2, 0, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][1].getContents()) && + gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][0].getContents()) + && + gameModel.blocksData[1][0].getContents() + .equals(gameModel.blocksData[0][0].getContents())) + || + (gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][2].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 1)) { + gameModel.blocksData[2][1].setContents("O"); + gameModel.blocksData[2][1].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(2, 1, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents()) && + gameModel.blocksData[2][0].getContents().equals(gameModel.blocksData[2][2].getContents())) + || + (gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][1].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } else if (blockIndex.matches(2, 2)) { + gameModel.blocksData[2][2].setContents("O"); + gameModel.blocksData[2][2].setIsLegalMove(false); + gameModel.setPlayer(Player.PLAYER_1); + gameModel.recordMove(2, 2, Player.PLAYER_2); + if (gameModel.movesLeft < 7) { + if ((gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[2][1].getContents()) && + gameModel.blocksData[2][1].getContents().equals(gameModel.blocksData[2][0].getContents())) + || + (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][2].getContents()) + && + gameModel.blocksData[1][2].getContents() + .equals(gameModel.blocksData[0][2].getContents())) + || + (gameModel.blocksData[2][2].getContents().equals(gameModel.blocksData[1][1].getContents()) + && + gameModel.blocksData[1][1].getContents() + .equals(gameModel.blocksData[0][0].getContents()))) { + gameModel.setFinalResult("Player " + Player.PLAYER_2 + " wins!"); + endGame(); + } else if (gameModel.movesLeft == 0) { + gameModel.setFinalResult(RowGameModel.GAME_END_NOWINNER); + } + } + } + } - /** - * Ends the game disallowing further player turns. - */ - public void endGame() { - // The Controller first manipulates the Model. - for(int row = 0;row<3;row++) { - for(int column = 0;column<3;column++) { - gameModel.blocksData[row][column].setIsLegalMove(false); - } + // The Controller then updates the View. + gameView.update(gameModel); } - // The Controller then updates the View. - gameView.update(gameModel); - } + /** + * Ends the game disallowing further player turns. + */ + public void endGame() { + // The Controller first manipulates the Model. + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { + gameModel.blocksData[row][column].setIsLegalMove(false); + } + } - /** - * Resets the game to be able to start playing again. - */ - public void resetGame() { - // The Controller first manipulates the Model. - for(int row = 0;row<3;row++) { - for(int column = 0;column<3;column++) { - gameModel.blocksData[row][column].reset(); - gameModel.blocksData[row][column].setIsLegalMove(true); - } - } - gameModel.setPlayer(Player.PLAYER_1); - gameModel.movesLeft = 9; - gameModel.setFinalResult(null); + // The Controller then updates the View. + gameView.update(gameModel); + } - // The Controller then updates the View. - gameView.update(gameModel); - } + /** + * Resets the game to be able to start playing again. + */ + public void resetGame() { + // The Controller first manipulates the Model. + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { + gameModel.blocksData[row][column].reset(); + gameModel.blocksData[row][column].setIsLegalMove(true); + } + } + gameModel.setPlayer(Player.PLAYER_1); + gameModel.movesLeft = 9; + gameModel.setFinalResult(null); + + // The Controller then updates the View. + gameView.update(gameModel); + } } diff --git a/tictactoe/src/model/RowBlockModel.java b/tictactoe/src/model/RowBlockModel.java index f7029df1..672d251b 100644 --- a/tictactoe/src/model/RowBlockModel.java +++ b/tictactoe/src/model/RowBlockModel.java @@ -3,8 +3,7 @@ /** * The TicTacToeBlock class represents a given block in the game. */ -public class RowBlockModel -{ +public class RowBlockModel { /** * The game that contains this block */ @@ -27,18 +26,18 @@ public class RowBlockModel * @throws IllegalArgumentException When the given game is null */ public RowBlockModel(RowGameModel game) { - super(); + super(); - if (game == null) { - throw new IllegalArgumentException("The game must be non-null."); - } - - this.game = game; - this.reset(); + if (game == null) { + throw new IllegalArgumentException("The game must be non-null."); + } + + this.game = game; + this.reset(); } public RowGameModel getGame() { - return this.game; + return this.game; } /** @@ -48,10 +47,10 @@ public RowGameModel getGame() { * @throws IllegalArgumentException When the given value is null */ public void setContents(String value) { - if (value == null) { - throw new IllegalArgumentException("The value must be non-null."); - } - this.contents = value; + if (value == null) { + throw new IllegalArgumentException("The value must be non-null."); + } + this.contents = value; } /** @@ -60,22 +59,22 @@ public void setContents(String value) { * @return The non-null String value */ public String getContents() { - return this.contents; + return this.contents; } public void setIsLegalMove(boolean isLegalMove) { - this.isLegalMove = isLegalMove; + this.isLegalMove = isLegalMove; } public boolean getIsLegalMove() { - return this.isLegalMove; + return this.isLegalMove; } /** * Resets this block before starting a new game. */ public void reset() { - this.contents = ""; - this.isLegalMove = false; + this.contents = ""; + this.isLegalMove = false; } } diff --git a/tictactoe/src/model/RowGameModel.java b/tictactoe/src/model/RowGameModel.java index f9b15ec1..6fb535e4 100644 --- a/tictactoe/src/model/RowGameModel.java +++ b/tictactoe/src/model/RowGameModel.java @@ -1,8 +1,8 @@ package model; +import java.util.Stack; -public class RowGameModel -{ +public class RowGameModel { public static final String GAME_END_NOWINNER = "Game ends in a draw"; public RowBlockModel[][] blocksData = new RowBlockModel[3][3]; @@ -15,35 +15,96 @@ public class RowGameModel private String finalResult = null; + private Stack moveHistory = new Stack<>(); // Stack to store move history public RowGameModel() { - super(); + super(); - for (int row = 0; row < 3; row++) { - for (int col = 0; col < 3; col++) { - blocksData[row][col] = new RowBlockModel(this); - } // end for col - } // end for row + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + blocksData[row][col] = new RowBlockModel(this); + } // end for col + } // end for row } public Player getPlayer() { - return this.player; + return this.player; } public void setPlayer(Player player) { - // Perform input validation - if (player == null) { - throw new IllegalArgumentException("The player must be non-null."); - } + // Perform input validation + if (player == null) { + throw new IllegalArgumentException("The player must be non-null."); + } - this.player = player; + this.player = player; } - + public String getFinalResult() { - return this.finalResult; + return this.finalResult; } public void setFinalResult(String finalResult) { - this.finalResult = finalResult; + this.finalResult = finalResult; + } + + /** + * Method to handle undo functionality. Allows undoing the previous move if + * there + * are moves to undo. + */ + public void undoMove() { + if (!moveHistory.isEmpty()) { // Check if there are moves to undo + Move lastMove = moveHistory.pop(); // Pop the last move from the move history stack + int row = lastMove.getRow(); + int col = lastMove.getCol(); + Player player = lastMove.getPlayer(); + + // Undo the move by resetting the contents of the corresponding block + blocksData[row][col].reset(); + blocksData[row][col].setIsLegalMove(true); + + // Update the model state + this.player = player; + this.movesLeft++; + } + } + + /** + * Method to record a move in the move history stack. + * + * @param row The row index of the block where the move was made + * @param col The column index of the block where the move was made + * @param player The player who made the move + */ + public void recordMove(int row, int col, Player player) { + moveHistory.push(new Move(row, col, player)); + } + + /** + * Inner class to represent a move made by a player. + */ + private static class Move { + private int row; + private int col; + private Player player; + + public Move(int row, int col, Player player) { + this.row = row; + this.col = col; + this.player = player; + } + + public int getRow() { + return row; + } + + public int getCol() { + return col; + } + + public Player getPlayer() { + return player; + } } -} +} \ No newline at end of file diff --git a/tictactoe/src/view/GameBoardView.java b/tictactoe/src/view/GameBoardView.java index 44c17d67..4675c76d 100644 --- a/tictactoe/src/view/GameBoardView.java +++ b/tictactoe/src/view/GameBoardView.java @@ -9,33 +9,31 @@ import javax.swing.JButton; import javax.swing.JPanel; - /** * The GameBoardView class visualizes the game board of blocks. * - * NOTE) For the Composite design pattern, this class is-a Component (i.e. View). + * NOTE) For the Composite design pattern, this class is-a Component (i.e. + * View). */ -public class GameBoardView implements View -{ +public class GameBoardView implements View { private JButton[][] blocks = new JButton[3][3]; - public GameBoardView(JPanel game, RowGameController controller) { - super(); + super(); // Initialize a JButton for each cell of the 3x3 game board. - for(int row = 0; row<3; row++) { - for(int column = 0; column<3 ;column++) { + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { blocks[row][column] = new JButton(); - blocks[row][column].setPreferredSize(new Dimension(75,75)); + blocks[row][column].setPreferredSize(new Dimension(75, 75)); game.add(blocks[row][column]); blocks[row][column].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - controller.move((JButton)e.getSource()); + controller.move((JButton) e.getSource()); } }); } - } + } } /** @@ -47,37 +45,37 @@ public void actionPerformed(ActionEvent e) { * if it is part of this game board and null otherwise */ public BlockIndex getBlockIndex(JButton block) { - for (int row = 0; row < 3; row++) { - for (int column = 0; column < 3; column++) { - if (this.blocks[row][column] == block) { - // Found - return new BlockIndex(row, column); - } - } // end for column - } // end for row + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { + if (this.blocks[row][column] == block) { + // Found + return new BlockIndex(row, column); + } + } // end for column + } // end for row - // Not found - return null; + // Not found + return null; } - + /** - * Updates the block at the given row and column + * Updates the block at the given row and column * after one of the player's moves. * * @param gameModel The RowGameModel containing the block - * @param row The row that contains the block - * @param column The column that contains the block + * @param row The row that contains the block + * @param column The column that contains the block */ public void updateBlock(RowGameModel gameModel, int row, int column) { blocks[row][column].setText(gameModel.blocksData[row][column].getContents()); blocks[row][column].setEnabled(gameModel.blocksData[row][column].getIsLegalMove()); } - + public void update(RowGameModel model) { - for (int row = 0; row < 3; row++) { - for (int column = 0; column < 3; column++) { - updateBlock(model, row, column); - } // end for col - } // end for row + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 3; column++) { + updateBlock(model, row, column); + } // end for col + } // end for row } } // end for GameBoardView diff --git a/tictactoe/src/view/RowGameGUI.java b/tictactoe/src/view/RowGameGUI.java index b9716d55..49f055cd 100644 --- a/tictactoe/src/view/RowGameGUI.java +++ b/tictactoe/src/view/RowGameGUI.java @@ -23,7 +23,8 @@ public class RowGameGUI implements View { /** For the Composite design pattern, the RowGameGUI is the Composite */ private List viewList = new ArrayList(); public JButton reset = new JButton("Reset"); - + // Add a new button to the GUI for undo functionality + public JButton undo = new JButton("Undo"); /** * Creates a new game initializing the GUI. @@ -34,11 +35,22 @@ public RowGameGUI(RowGameController controller) { gui.setResizable(true); JPanel gamePanel = new JPanel(new FlowLayout()); - JPanel game = new JPanel(new GridLayout(3,3)); + JPanel game = new JPanel(new GridLayout(3, 3)); gamePanel.add(game, BorderLayout.CENTER); JPanel options = new JPanel(new FlowLayout()); options.add(reset); + + // add the undo button to the options panel + options.add(undo); + + // add action listener to the undo button + undo.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + controller.undoMove(); + } + }); + JPanel messages = new JPanel(new FlowLayout()); messages.setBackground(Color.white); @@ -46,8 +58,8 @@ public RowGameGUI(RowGameController controller) { gui.add(options, BorderLayout.CENTER); gui.add(messages, BorderLayout.SOUTH); - GameStatusView gameStatusView = new GameStatusView(messages); - addView(gameStatusView); + GameStatusView gameStatusView = new GameStatusView(messages); + addView(gameStatusView); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -55,30 +67,30 @@ public void actionPerformed(ActionEvent e) { } }); - this.gameBoardView = new GameBoardView(game, controller); - addView(this.gameBoardView); + this.gameBoardView = new GameBoardView(game, controller); + addView(this.gameBoardView); } public BlockIndex getBlockIndex(JButton block) { - return this.gameBoardView.getBlockIndex(block); + return this.gameBoardView.getBlockIndex(block); } public void addView(View view) { - // For the Composite API - - // Perform input validation - if (view == null) { - throw new IllegalArgumentException("The view must be non-null."); - } - - this.viewList.add(view); + // For the Composite API + + // Perform input validation + if (view == null) { + throw new IllegalArgumentException("The view must be non-null."); + } + + this.viewList.add(view); } public void update(RowGameModel model) { - // For the Composite API - - for (View currentView : this.viewList) { - currentView.update(model); - } // end for currentView + // For the Composite API + + for (View currentView : this.viewList) { + currentView.update(model); + } // end for currentView } -} +} \ No newline at end of file From 1efddd28a40c61965933cf29f962828bbb56280c Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Wed, 19 Apr 2023 18:07:07 -0400 Subject: [PATCH 02/13] test initial --- .../bin/controller/RowGameController.class | Bin 9283 -> 9616 bytes tictactoe/bin/model/RowBlockModel.class | Bin 1296 -> 1296 bytes tictactoe/bin/model/RowGameModel$Move.class | Bin 781 -> 781 bytes tictactoe/bin/model/RowGameModel.class | Bin 2215 -> 2265 bytes tictactoe/bin/view/GameBoardView$1.class | Bin 1044 -> 1044 bytes tictactoe/bin/view/GameBoardView.class | Bin 2184 -> 2184 bytes tictactoe/jdoc/RowGameApp.html | 2 +- tictactoe/jdoc/allclasses-index.html | 10 +- tictactoe/jdoc/allpackages-index.html | 2 +- tictactoe/jdoc/class-use/RowGameApp.html | 2 +- tictactoe/jdoc/constant-values.html | 2 +- .../jdoc/controller/RowGameController.html | 20 +- .../class-use/RowGameController.html | 2 +- .../jdoc/controller/package-summary.html | 2 +- tictactoe/jdoc/controller/package-tree.html | 2 +- tictactoe/jdoc/controller/package-use.html | 2 +- tictactoe/jdoc/help-doc.html | 2 +- tictactoe/jdoc/index-all.html | 38 ++- tictactoe/jdoc/index.html | 2 +- tictactoe/jdoc/member-search-index.js | 2 +- tictactoe/jdoc/model/Player.html | 2 +- tictactoe/jdoc/model/RowBlockModel.html | 2 +- tictactoe/jdoc/model/RowGameModel.Move.html | 233 ++++++++++++++++++ tictactoe/jdoc/model/RowGameModel.html | 82 +++++- tictactoe/jdoc/model/class-use/Player.html | 44 +++- .../jdoc/model/class-use/RowBlockModel.html | 2 +- .../model/class-use/RowGameModel.Move.html | 83 +++++++ .../jdoc/model/class-use/RowGameModel.html | 4 +- tictactoe/jdoc/model/package-summary.html | 6 +- tictactoe/jdoc/model/package-tree.html | 3 +- tictactoe/jdoc/model/package-use.html | 6 +- tictactoe/jdoc/overview-summary.html | 2 +- tictactoe/jdoc/overview-tree.html | 3 +- tictactoe/jdoc/package-summary.html | 2 +- tictactoe/jdoc/package-tree.html | 2 +- tictactoe/jdoc/package-use.html | 2 +- tictactoe/jdoc/type-search-index.js | 2 +- tictactoe/jdoc/view/BlockIndex.html | 2 +- tictactoe/jdoc/view/GameBoardView.html | 9 +- tictactoe/jdoc/view/GameStatusView.html | 2 +- tictactoe/jdoc/view/RowGameGUI.html | 17 +- tictactoe/jdoc/view/View.html | 2 +- tictactoe/jdoc/view/class-use/BlockIndex.html | 2 +- .../jdoc/view/class-use/GameBoardView.html | 2 +- .../jdoc/view/class-use/GameStatusView.html | 2 +- tictactoe/jdoc/view/class-use/RowGameGUI.html | 2 +- tictactoe/jdoc/view/class-use/View.html | 2 +- tictactoe/jdoc/view/package-summary.html | 2 +- tictactoe/jdoc/view/package-tree.html | 2 +- tictactoe/jdoc/view/package-use.html | 2 +- 50 files changed, 548 insertions(+), 70 deletions(-) create mode 100644 tictactoe/jdoc/model/RowGameModel.Move.html create mode 100644 tictactoe/jdoc/model/class-use/RowGameModel.Move.html diff --git a/tictactoe/bin/controller/RowGameController.class b/tictactoe/bin/controller/RowGameController.class index 790b61013daf76d3dfe76686e9ae92734aafb643..d7b5bd926f963880ab774d50263724d1f4a9e19e 100644 GIT binary patch literal 9616 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 QZswMcuWrGwz+dD37mU@bga7~l literal 9283 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 VbUXj<#@*cWa%(T{#aA%w{{TxeLSp~` diff --git a/tictactoe/bin/model/RowBlockModel.class b/tictactoe/bin/model/RowBlockModel.class index 3f0c36869b931a385e4fd1c4fecafb442f55e779..4cf61cfccd810312dd979e2d42e883d93c98cdbe 100644 GIT binary patch delta 125 zcmbQhHGyjb8?&e^0}F#Z0|$cwgAjuNfNG2x z_!vwXgc-~xpJ(=Gv;)f7vN|!aGB{68WN~A31FPN3qNnQ1z{cRmz|G*#pvJ(!z{9`@ SCe;}Cv delta 125 zcmbQhHGyjb8?&e!0}F!!0|$d5gAjuXgE)gKgEWKMWNGGTM$O6cETWTpn9X>Nfoe<` z_!!I>gc-~ypJ(=Gvt);UnNcu?frTNKfs-MQfsY}cL6{+7G7D1_WAfy9CL6|dASpU|Ba=E~_T-yP FCIBsD3{wCA delta 51 zcmeBW>t);UnNcvBfrTN4fs-MYfsY}ML6{+aG7D1_W76b!CL6{yASpU|Ba=E~*5sQ^ FCIBpq3`+n2 diff --git a/tictactoe/bin/model/RowGameModel.class b/tictactoe/bin/model/RowGameModel.class index ba1c0d693cabde832d92b1bd1fc951ef8370daaa..35815c2d896dd5b00ad22df3f88d0f7f107592d4 100644 GIT binary patch delta 735 zcmZuvO;1xn6g~4k^--JPgC9fo>eSV#hAF_FPO~E z6^RR1CJ>+t7H-_RVDArcB_W=fmWB{B$(@sX=iYPgx$~{{cdPg7^ymkG`*^qK{WPZf zFdae$S%L6Y@FBgG3Cg8Pw)!y;u;Pn}yoXUd3c*HBz>lZXnT_gNP#MfsN}q!FcUAlb z=0cdqWBJF(i>Lb;^Q*Y>1YHowlgGe=9|T2&ToNR$N4^@7yIb{Zy#k0 zon?=aN|8CqTZf455!J`=wD&f38amgK(`?B>r`A{CRb5GD97MYM5QPIM*ztpVMqfy#l{Em*3pD-}nWf b^h$n{r$QD38`$J+kzy28B2Oa^Z{hs|Y?545 delta 706 zcmZuvNlP3-7=6`kcVjaOrd_~}OT=YnRMa4fBM~JcXht*RGNUH$jwW$b$jy`BIk&py znuAxxC7@tHZ~lYePZ7jd)$JhSrRwo5?|a{?`d@Zf=H5PBTmkri?PK@Gh$iqU0t-n2 zFFHD!+}>T!NBv}kh$yzJs&1jr~ z!?*>TXI9Qzn_^a8TfHrF%+|w1H+;;anqBRP;tP>rCWEh7;Jqm8?Z$yDQ3vBHW5rKV zenenkmZzcx1u42nP!P5XEMb|EtUR!r_Eqg06!C22*@RLK^AOX0mE;1-!#;&7nG;xK z)PyJ{T*0cMV&J(B|D}$$S9PqRYa{F);3zfBj<=q{KPC#+aCNkkK6O2lWEUjasL}ok ztOriA^NQju-a~Yx;T-ROqfh>FTI4^c!cprsqgdWK{{BbwU>JiK(ahcKsX!}oP@1Y) zr93xi;XC~fCe87+0m`hQr*|N>Anr*cu!&^2&Jx9_GEYgkL}Jc=+x{10=NQixc3VcU tT#EjuwS;)kQ&`R`Ji8Zu1u|+0CRhAMegog}gLe_=4}Wi&ayMfrUYsfsa9wL6kv?L5@M1L61R(!IeRlAsEQZ0E*=S=4}Wi&ayCfrUYYfsa9&L6kv;L5@L|K@Ui}GRQLoGbk`*0LAivawQDvla<-F zNE$J)GZ+I^n=nW*m@%jT*;))n3 - + RowGameApp (CS520 - Homework 1) diff --git a/tictactoe/jdoc/allclasses-index.html b/tictactoe/jdoc/allclasses-index.html index e8cd11ab..fac4c68a 100644 --- a/tictactoe/jdoc/allclasses-index.html +++ b/tictactoe/jdoc/allclasses-index.html @@ -1,7 +1,7 @@ - + All Classes and Interfaces (CS520 - Homework 1) @@ -88,8 +88,12 @@

    All Classes and Interfaces<

     
    - -
    + +
    +
    Inner class to represent a move made by a player.
    +
    + +
    The View interfaces supports updating the visualizations of the Model.
    diff --git a/tictactoe/jdoc/allpackages-index.html b/tictactoe/jdoc/allpackages-index.html index 84d4e28f..e5a84e49 100644 --- a/tictactoe/jdoc/allpackages-index.html +++ b/tictactoe/jdoc/allpackages-index.html @@ -1,7 +1,7 @@ - + 所有程序包 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/class-use/RowGameApp.html b/tictactoe/jdoc/class-use/RowGameApp.html index 4b742da6..4f848ed7 100644 --- a/tictactoe/jdoc/class-use/RowGameApp.html +++ b/tictactoe/jdoc/class-use/RowGameApp.html @@ -1,7 +1,7 @@ - + 类 RowGameApp的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/constant-values.html b/tictactoe/jdoc/constant-values.html index cec8817f..19535a2c 100644 --- a/tictactoe/jdoc/constant-values.html +++ b/tictactoe/jdoc/constant-values.html @@ -1,7 +1,7 @@ - + 常量字段值 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/controller/RowGameController.html b/tictactoe/jdoc/controller/RowGameController.html index 939c16c3..1032b4f7 100644 --- a/tictactoe/jdoc/controller/RowGameController.html +++ b/tictactoe/jdoc/controller/RowGameController.html @@ -1,7 +1,7 @@ - + RowGameController (CS520 - Homework 1) @@ -97,6 +97,9 @@

    字段概要

     
    +
    private JButton
    + +
     
  • @@ -141,6 +144,9 @@

    方法概要

    Resets the game to be able to start playing again.
    +
    void
    + +
     
    @@ -170,6 +176,12 @@

    gameView

    public RowGameGUI gameView
    +
  • +
    +

    undo

    +
    private JButton undo
    +
    +
@@ -194,6 +206,12 @@

RowGameController

方法详细资料

  • +
    +

    undoMove

    +
    public void undoMove()
    +
    +
  • +
  • move

    public void move(JButton block)
    diff --git a/tictactoe/jdoc/controller/class-use/RowGameController.html b/tictactoe/jdoc/controller/class-use/RowGameController.html index 17ba4d77..1eff6c81 100644 --- a/tictactoe/jdoc/controller/class-use/RowGameController.html +++ b/tictactoe/jdoc/controller/class-use/RowGameController.html @@ -1,7 +1,7 @@ - + 类 controller.RowGameController的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/controller/package-summary.html b/tictactoe/jdoc/controller/package-summary.html index 7f92bb16..05b58735 100644 --- a/tictactoe/jdoc/controller/package-summary.html +++ b/tictactoe/jdoc/controller/package-summary.html @@ -1,7 +1,7 @@ - + controller (CS520 - Homework 1) diff --git a/tictactoe/jdoc/controller/package-tree.html b/tictactoe/jdoc/controller/package-tree.html index 2d5e4cce..bedaaf27 100644 --- a/tictactoe/jdoc/controller/package-tree.html +++ b/tictactoe/jdoc/controller/package-tree.html @@ -1,7 +1,7 @@ - + controller 类分层结构 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/controller/package-use.html b/tictactoe/jdoc/controller/package-use.html index e408a35f..92244b45 100644 --- a/tictactoe/jdoc/controller/package-use.html +++ b/tictactoe/jdoc/controller/package-use.html @@ -1,7 +1,7 @@ - + 程序包 controller的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/help-doc.html b/tictactoe/jdoc/help-doc.html index 43a4750d..3f183723 100644 --- a/tictactoe/jdoc/help-doc.html +++ b/tictactoe/jdoc/help-doc.html @@ -1,7 +1,7 @@ - + API 帮助 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/index-all.html b/tictactoe/jdoc/index-all.html index 9305d386..ab07b388 100644 --- a/tictactoe/jdoc/index-all.html +++ b/tictactoe/jdoc/index-all.html @@ -1,7 +1,7 @@ - + 索引 (CS520 - Homework 1) @@ -70,6 +70,8 @@

    B

    C

    +
    col - 类中的变量 model.RowGameModel.Move
    +
     
    column - 类中的变量 view.BlockIndex
     
    contents - 类中的变量 model.RowBlockModel
    @@ -127,6 +129,8 @@

    G

    getBlockIndex(JButton) - 类中的方法 view.RowGameGUI
     
    +
    getCol() - 类中的方法 model.RowGameModel.Move
    +
     
    getColumn() - 类中的方法 view.BlockIndex
     
    getContents() - 类中的方法 model.RowBlockModel
    @@ -143,6 +147,10 @@

    G

     
    getPlayer() - 类中的方法 model.RowGameModel
     
    +
    getPlayer() - 类中的方法 model.RowGameModel.Move
    +
     
    +
    getRow() - 类中的方法 model.RowGameModel.Move
    +
     
    getRow() - 类中的方法 view.BlockIndex
     
    gui - 类中的变量 view.RowGameGUI
    @@ -171,11 +179,17 @@

    M

    Moves the current player into the given block.
    +
    Move(int, int, Player) - 类的构造器 model.RowGameModel.Move
    +
     
    +
    moveHistory - 类中的变量 model.RowGameModel
    +
     
    movesLeft - 类中的变量 model.RowGameModel
     

    P

    +
    player - 类中的变量 model.RowGameModel.Move
    +
     
    player - 类中的变量 model.RowGameModel
    The current player taking their turn
    @@ -193,6 +207,10 @@

    P

    R

    +
    recordMove(int, int, Player) - 类中的方法 model.RowGameModel
    +
    +
    Method to record a move in the move history stack.
    +
    reset - 类中的变量 view.RowGameGUI
     
    reset() - 类中的方法 model.RowBlockModel
    @@ -203,6 +221,8 @@

    R

    Resets the game to be able to start playing again.
    +
    row - 类中的变量 model.RowGameModel.Move
    +
     
    row - 类中的变量 view.BlockIndex
     
    RowBlockModel - model中的类
    @@ -235,6 +255,10 @@

    R

     
    RowGameModel() - 类的构造器 model.RowGameModel
     
    +
    RowGameModel.Move - model中的类
    +
    +
    Inner class to represent a move made by a player.
    +

    S

    @@ -256,6 +280,16 @@

    T

    U

    +
    undo - 类中的变量 controller.RowGameController
    +
     
    +
    undo - 类中的变量 view.RowGameGUI
    +
     
    +
    undoMove() - 类中的方法 controller.RowGameController
    +
     
    +
    undoMove() - 类中的方法 model.RowGameModel
    +
    +
    Method to handle undo functionality.
    +
    update(RowGameModel) - 类中的方法 view.GameBoardView
     
    update(RowGameModel) - 类中的方法 view.GameStatusView
    @@ -266,7 +300,7 @@

    U

     
    updateBlock(RowGameModel, int, int) - 类中的方法 view.GameBoardView
    -
    Updates the block at the given row and column +
    Updates the block at the given row and column after one of the player's moves.
    diff --git a/tictactoe/jdoc/index.html b/tictactoe/jdoc/index.html index 631f4d0d..2d3cd10f 100644 --- a/tictactoe/jdoc/index.html +++ b/tictactoe/jdoc/index.html @@ -1,7 +1,7 @@ - + 概览 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/member-search-index.js b/tictactoe/jdoc/member-search-index.js index 960c388d..2540a71f 100644 --- a/tictactoe/jdoc/member-search-index.js +++ b/tictactoe/jdoc/member-search-index.js @@ -1 +1 @@ -memberSearchIndex = [{"p":"view","c":"RowGameGUI","l":"addView(View)","u":"addView(view.View)"},{"p":"view","c":"BlockIndex","l":"BlockIndex(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"view","c":"GameBoardView","l":"blocks"},{"p":"model","c":"RowGameModel","l":"blocksData"},{"p":"view","c":"BlockIndex","l":"column"},{"p":"model","c":"RowBlockModel","l":"contents"},{"p":"controller","c":"RowGameController","l":"endGame()"},{"p":"model","c":"RowGameModel","l":"finalResult"},{"p":"model","c":"RowBlockModel","l":"game"},{"p":"model","c":"RowGameModel","l":"GAME_END_NOWINNER"},{"p":"view","c":"RowGameGUI","l":"gameBoardView"},{"p":"view","c":"GameBoardView","l":"GameBoardView(JPanel, RowGameController)","u":"%3Cinit%3E(javax.swing.JPanel,controller.RowGameController)"},{"p":"controller","c":"RowGameController","l":"gameModel"},{"p":"view","c":"RowGameGUI","l":"gameModel"},{"p":"view","c":"GameStatusView","l":"GameStatusView(JPanel)","u":"%3Cinit%3E(javax.swing.JPanel)"},{"p":"controller","c":"RowGameController","l":"gameView"},{"p":"view","c":"GameBoardView","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"view","c":"RowGameGUI","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"view","c":"BlockIndex","l":"getColumn()"},{"p":"model","c":"RowBlockModel","l":"getContents()"},{"p":"model","c":"RowGameModel","l":"getFinalResult()"},{"p":"model","c":"RowBlockModel","l":"getGame()"},{"p":"model","c":"Player","l":"getID()"},{"p":"model","c":"RowBlockModel","l":"getIsLegalMove()"},{"p":"model","c":"RowGameModel","l":"getPlayer()"},{"p":"view","c":"BlockIndex","l":"getRow()"},{"p":"view","c":"RowGameGUI","l":"gui"},{"p":"model","c":"Player","l":"id"},{"p":"model","c":"RowBlockModel","l":"isLegalMove"},{"p":"","c":"RowGameApp","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"view","c":"BlockIndex","l":"matches(int, int)","u":"matches(int,int)"},{"p":"controller","c":"RowGameController","l":"move(JButton)","u":"move(javax.swing.JButton)"},{"p":"model","c":"RowGameModel","l":"movesLeft"},{"p":"model","c":"RowGameModel","l":"player"},{"p":"model","c":"Player","l":"PLAYER_1"},{"p":"model","c":"Player","l":"PLAYER_2"},{"p":"model","c":"Player","l":"Player(int)","u":"%3Cinit%3E(int)"},{"p":"view","c":"GameStatusView","l":"playerturn"},{"p":"view","c":"RowGameGUI","l":"reset"},{"p":"model","c":"RowBlockModel","l":"reset()"},{"p":"controller","c":"RowGameController","l":"resetGame()"},{"p":"view","c":"BlockIndex","l":"row"},{"p":"model","c":"RowBlockModel","l":"RowBlockModel(RowGameModel)","u":"%3Cinit%3E(model.RowGameModel)"},{"p":"","c":"RowGameApp","l":"RowGameApp()","u":"%3Cinit%3E()"},{"p":"controller","c":"RowGameController","l":"RowGameController()","u":"%3Cinit%3E()"},{"p":"view","c":"RowGameGUI","l":"RowGameGUI(RowGameController)","u":"%3Cinit%3E(controller.RowGameController)"},{"p":"model","c":"RowGameModel","l":"RowGameModel()","u":"%3Cinit%3E()"},{"p":"model","c":"RowBlockModel","l":"setContents(String)","u":"setContents(java.lang.String)"},{"p":"model","c":"RowGameModel","l":"setFinalResult(String)","u":"setFinalResult(java.lang.String)"},{"p":"model","c":"RowBlockModel","l":"setIsLegalMove(boolean)"},{"p":"model","c":"RowGameModel","l":"setPlayer(Player)","u":"setPlayer(model.Player)"},{"p":"model","c":"Player","l":"toString()"},{"p":"view","c":"GameBoardView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameStatusView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"RowGameGUI","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"View","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameBoardView","l":"updateBlock(RowGameModel, int, int)","u":"updateBlock(model.RowGameModel,int,int)"},{"p":"model","c":"Player","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"model","c":"Player","l":"values()"},{"p":"view","c":"RowGameGUI","l":"viewList"}];updateSearchResults(); \ No newline at end of file +memberSearchIndex = [{"p":"view","c":"RowGameGUI","l":"addView(View)","u":"addView(view.View)"},{"p":"view","c":"BlockIndex","l":"BlockIndex(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"view","c":"GameBoardView","l":"blocks"},{"p":"model","c":"RowGameModel","l":"blocksData"},{"p":"model","c":"RowGameModel.Move","l":"col"},{"p":"view","c":"BlockIndex","l":"column"},{"p":"model","c":"RowBlockModel","l":"contents"},{"p":"controller","c":"RowGameController","l":"endGame()"},{"p":"model","c":"RowGameModel","l":"finalResult"},{"p":"model","c":"RowBlockModel","l":"game"},{"p":"model","c":"RowGameModel","l":"GAME_END_NOWINNER"},{"p":"view","c":"RowGameGUI","l":"gameBoardView"},{"p":"view","c":"GameBoardView","l":"GameBoardView(JPanel, RowGameController)","u":"%3Cinit%3E(javax.swing.JPanel,controller.RowGameController)"},{"p":"controller","c":"RowGameController","l":"gameModel"},{"p":"view","c":"RowGameGUI","l":"gameModel"},{"p":"view","c":"GameStatusView","l":"GameStatusView(JPanel)","u":"%3Cinit%3E(javax.swing.JPanel)"},{"p":"controller","c":"RowGameController","l":"gameView"},{"p":"view","c":"GameBoardView","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"view","c":"RowGameGUI","l":"getBlockIndex(JButton)","u":"getBlockIndex(javax.swing.JButton)"},{"p":"model","c":"RowGameModel.Move","l":"getCol()"},{"p":"view","c":"BlockIndex","l":"getColumn()"},{"p":"model","c":"RowBlockModel","l":"getContents()"},{"p":"model","c":"RowGameModel","l":"getFinalResult()"},{"p":"model","c":"RowBlockModel","l":"getGame()"},{"p":"model","c":"Player","l":"getID()"},{"p":"model","c":"RowBlockModel","l":"getIsLegalMove()"},{"p":"model","c":"RowGameModel","l":"getPlayer()"},{"p":"model","c":"RowGameModel.Move","l":"getPlayer()"},{"p":"model","c":"RowGameModel.Move","l":"getRow()"},{"p":"view","c":"BlockIndex","l":"getRow()"},{"p":"view","c":"RowGameGUI","l":"gui"},{"p":"model","c":"Player","l":"id"},{"p":"model","c":"RowBlockModel","l":"isLegalMove"},{"p":"","c":"RowGameApp","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"view","c":"BlockIndex","l":"matches(int, int)","u":"matches(int,int)"},{"p":"model","c":"RowGameModel.Move","l":"Move(int, int, Player)","u":"%3Cinit%3E(int,int,model.Player)"},{"p":"controller","c":"RowGameController","l":"move(JButton)","u":"move(javax.swing.JButton)"},{"p":"model","c":"RowGameModel","l":"moveHistory"},{"p":"model","c":"RowGameModel","l":"movesLeft"},{"p":"model","c":"RowGameModel.Move","l":"player"},{"p":"model","c":"RowGameModel","l":"player"},{"p":"model","c":"Player","l":"PLAYER_1"},{"p":"model","c":"Player","l":"PLAYER_2"},{"p":"model","c":"Player","l":"Player(int)","u":"%3Cinit%3E(int)"},{"p":"view","c":"GameStatusView","l":"playerturn"},{"p":"model","c":"RowGameModel","l":"recordMove(int, int, Player)","u":"recordMove(int,int,model.Player)"},{"p":"view","c":"RowGameGUI","l":"reset"},{"p":"model","c":"RowBlockModel","l":"reset()"},{"p":"controller","c":"RowGameController","l":"resetGame()"},{"p":"model","c":"RowGameModel.Move","l":"row"},{"p":"view","c":"BlockIndex","l":"row"},{"p":"model","c":"RowBlockModel","l":"RowBlockModel(RowGameModel)","u":"%3Cinit%3E(model.RowGameModel)"},{"p":"","c":"RowGameApp","l":"RowGameApp()","u":"%3Cinit%3E()"},{"p":"controller","c":"RowGameController","l":"RowGameController()","u":"%3Cinit%3E()"},{"p":"view","c":"RowGameGUI","l":"RowGameGUI(RowGameController)","u":"%3Cinit%3E(controller.RowGameController)"},{"p":"model","c":"RowGameModel","l":"RowGameModel()","u":"%3Cinit%3E()"},{"p":"model","c":"RowBlockModel","l":"setContents(String)","u":"setContents(java.lang.String)"},{"p":"model","c":"RowGameModel","l":"setFinalResult(String)","u":"setFinalResult(java.lang.String)"},{"p":"model","c":"RowBlockModel","l":"setIsLegalMove(boolean)"},{"p":"model","c":"RowGameModel","l":"setPlayer(Player)","u":"setPlayer(model.Player)"},{"p":"model","c":"Player","l":"toString()"},{"p":"controller","c":"RowGameController","l":"undo"},{"p":"view","c":"RowGameGUI","l":"undo"},{"p":"controller","c":"RowGameController","l":"undoMove()"},{"p":"model","c":"RowGameModel","l":"undoMove()"},{"p":"view","c":"GameBoardView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameStatusView","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"RowGameGUI","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"View","l":"update(RowGameModel)","u":"update(model.RowGameModel)"},{"p":"view","c":"GameBoardView","l":"updateBlock(RowGameModel, int, int)","u":"updateBlock(model.RowGameModel,int,int)"},{"p":"model","c":"Player","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"model","c":"Player","l":"values()"},{"p":"view","c":"RowGameGUI","l":"viewList"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/model/Player.html b/tictactoe/jdoc/model/Player.html index 80f6b640..9b1e0268 100644 --- a/tictactoe/jdoc/model/Player.html +++ b/tictactoe/jdoc/model/Player.html @@ -1,7 +1,7 @@ - + Player (CS520 - Homework 1) diff --git a/tictactoe/jdoc/model/RowBlockModel.html b/tictactoe/jdoc/model/RowBlockModel.html index 4a848a0d..e0a4831f 100644 --- a/tictactoe/jdoc/model/RowBlockModel.html +++ b/tictactoe/jdoc/model/RowBlockModel.html @@ -1,7 +1,7 @@ - + RowBlockModel (CS520 - Homework 1) diff --git a/tictactoe/jdoc/model/RowGameModel.Move.html b/tictactoe/jdoc/model/RowGameModel.Move.html new file mode 100644 index 00000000..bf4094ec --- /dev/null +++ b/tictactoe/jdoc/model/RowGameModel.Move.html @@ -0,0 +1,233 @@ + + + + +RowGameModel.Move (CS520 - Homework 1) + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    程序包 model
    +

    类 RowGameModel.Move

    +
    +
    java.lang.Object +
    model.RowGameModel.Move
    +
    +
    +
    +
    封闭类:
    +
    RowGameModel
    +
    +
    +
    private static class RowGameModel.Move +extends Object
    +
    Inner class to represent a move made by a player.
    +
    +
    + +
    +
    +
      + +
    • +
      +

      字段详细资料

      +
        +
      • +
        +

        row

        +
        private int row
        +
        +
      • +
      • +
        +

        col

        +
        private int col
        +
        +
      • +
      • +
        +

        player

        +
        private Player player
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      构造器详细资料

      +
        +
      • +
        +

        Move

        +
        public Move(int row, + int col, + Player player)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      方法详细资料

      +
        +
      • +
        +

        getRow

        +
        public int getRow()
        +
        +
      • +
      • +
        +

        getCol

        +
        public int getCol()
        +
        +
      • +
      • +
        +

        getPlayer

        +
        public Player getPlayer()
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/tictactoe/jdoc/model/RowGameModel.html b/tictactoe/jdoc/model/RowGameModel.html index 02da6992..1dd21f53 100644 --- a/tictactoe/jdoc/model/RowGameModel.html +++ b/tictactoe/jdoc/model/RowGameModel.html @@ -1,7 +1,7 @@ - + RowGameModel (CS520 - Homework 1) @@ -45,7 +45,7 @@
  • @@ -249,6 +287,30 @@

    setFinalResult

    public void setFinalResult(String finalResult)
    +
  • +
    +

    undoMove

    +
    public void undoMove()
    +
    Method to handle undo functionality. Allows undoing the previous move if + there + are moves to undo.
    +
    +
  • +
  • +
    +

    recordMove

    +
    public void recordMove(int row, + int col, + Player player)
    +
    Method to record a move in the move history stack.
    +
    +
    参数:
    +
    row - The row index of the block where the move was made
    +
    col - The column index of the block where the move was made
    +
    player - The player who made the move
    +
    +
    +
diff --git a/tictactoe/jdoc/model/class-use/Player.html b/tictactoe/jdoc/model/class-use/Player.html index 222a3307..8869f339 100644 --- a/tictactoe/jdoc/model/class-use/Player.html +++ b/tictactoe/jdoc/model/class-use/Player.html @@ -1,7 +1,7 @@ - + Enum Class model.Player的使用 (CS520 - Homework 1) @@ -69,8 +69,11 @@

model字段
说明
-
RowGameModel.player
-
+
RowGameModel.Move.player
+
 
+
private Player
+
RowGameModel.player
+
The current player taking their turn
@@ -82,14 +85,17 @@

modelPlayer
RowGameModel.getPlayer()
 
-
static Player
-
Player.valueOf(String name)
-
+ +
RowGameModel.Move.getPlayer()
+
 
+
static Player
+
Player.valueOf(String name)
+
Returns the enum constant of this class with the specified name.
-
static Player[]
-
Player.values()
-
+
static Player[]
+
Player.values()
+
Returns an array containing the constants of this enum class, in the order they are declared.
@@ -100,7 +106,25 @@

model方法

说明
void
-
+
RowGameModel.recordMove(int row, + int col, + Player player)
+
+
Method to record a move in the move history stack.
+
+
void
+
RowGameModel.setPlayer(Player player)
+
 
+
+
参数类型为Playermodel中的构造器
+
+
限定符
+
构造器
+
说明
+
 
+
Move(int row, + int col, + Player player)
 
diff --git a/tictactoe/jdoc/model/class-use/RowBlockModel.html b/tictactoe/jdoc/model/class-use/RowBlockModel.html index 0c8935b3..df6d74f7 100644 --- a/tictactoe/jdoc/model/class-use/RowBlockModel.html +++ b/tictactoe/jdoc/model/class-use/RowBlockModel.html @@ -1,7 +1,7 @@ - + 类 model.RowBlockModel的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/model/class-use/RowGameModel.Move.html b/tictactoe/jdoc/model/class-use/RowGameModel.Move.html new file mode 100644 index 00000000..21a0643f --- /dev/null +++ b/tictactoe/jdoc/model/class-use/RowGameModel.Move.html @@ -0,0 +1,83 @@ + + + + +类 model.RowGameModel.Move的使用 (CS520 - Homework 1) + + + + + + + + + + + + + + + +
+ +
+
+
+

类的使用
model.RowGameModel.Move

+
+
使用RowGameModel.Move的程序包
+
+
程序包
+
说明
+ +
 
+
+
+ +
+
+
+
+ + diff --git a/tictactoe/jdoc/model/class-use/RowGameModel.html b/tictactoe/jdoc/model/class-use/RowGameModel.html index 565d96ba..31a2519c 100644 --- a/tictactoe/jdoc/model/class-use/RowGameModel.html +++ b/tictactoe/jdoc/model/class-use/RowGameModel.html @@ -1,7 +1,7 @@ - + 类 model.RowGameModel的使用 (CS520 - Homework 1) @@ -148,7 +148,7 @@

view -
Updates the block at the given row and column +
Updates the block at the given row and column after one of the player's moves.
diff --git a/tictactoe/jdoc/model/package-summary.html b/tictactoe/jdoc/model/package-summary.html index 6e4650c2..67dcc396 100644 --- a/tictactoe/jdoc/model/package-summary.html +++ b/tictactoe/jdoc/model/package-summary.html @@ -1,7 +1,7 @@ - + model (CS520 - Homework 1) @@ -82,6 +82,10 @@

程序包 model

 
+ +
+
Inner class to represent a move made by a player.
+
diff --git a/tictactoe/jdoc/model/package-tree.html b/tictactoe/jdoc/model/package-tree.html index 45c61201..060a4f51 100644 --- a/tictactoe/jdoc/model/package-tree.html +++ b/tictactoe/jdoc/model/package-tree.html @@ -1,7 +1,7 @@ - + model 类分层结构 (CS520 - Homework 1) @@ -62,6 +62,7 @@

类分层结构

diff --git a/tictactoe/jdoc/model/package-use.html b/tictactoe/jdoc/model/package-use.html index 5ef82177..0ac03cd4 100644 --- a/tictactoe/jdoc/model/package-use.html +++ b/tictactoe/jdoc/model/package-use.html @@ -1,7 +1,7 @@ - + 程序包 model的使用 (CS520 - Homework 1) @@ -89,6 +89,10 @@

程序包的使用
model
 
+ +
+
Inner class to represent a move made by a player.
+
diff --git a/tictactoe/jdoc/overview-summary.html b/tictactoe/jdoc/overview-summary.html index 518b626a..a3b2e5a2 100644 --- a/tictactoe/jdoc/overview-summary.html +++ b/tictactoe/jdoc/overview-summary.html @@ -1,7 +1,7 @@ - + CS520 - Homework 1 diff --git a/tictactoe/jdoc/overview-tree.html b/tictactoe/jdoc/overview-tree.html index eb9c1bd9..84693ce5 100644 --- a/tictactoe/jdoc/overview-tree.html +++ b/tictactoe/jdoc/overview-tree.html @@ -1,7 +1,7 @@ - + 类分层结构 (CS520 - Homework 1) @@ -70,6 +70,7 @@

类分层结构

  • controller.RowGameController
  • view.RowGameGUI (implements view.View)
  • model.RowGameModel
  • +
  • model.RowGameModel.Move
  • diff --git a/tictactoe/jdoc/package-summary.html b/tictactoe/jdoc/package-summary.html index 1aed24bf..4c5a38f5 100644 --- a/tictactoe/jdoc/package-summary.html +++ b/tictactoe/jdoc/package-summary.html @@ -1,7 +1,7 @@ - + Unnamed Package (CS520 - Homework 1) diff --git a/tictactoe/jdoc/package-tree.html b/tictactoe/jdoc/package-tree.html index f6a9b0bb..3bfd175d 100644 --- a/tictactoe/jdoc/package-tree.html +++ b/tictactoe/jdoc/package-tree.html @@ -1,7 +1,7 @@ - + 类分层结构 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/package-use.html b/tictactoe/jdoc/package-use.html index 0fc4873f..81b21684 100644 --- a/tictactoe/jdoc/package-use.html +++ b/tictactoe/jdoc/package-use.html @@ -1,7 +1,7 @@ - + 程序包 的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/type-search-index.js b/tictactoe/jdoc/type-search-index.js index f5002648..1ab98559 100644 --- a/tictactoe/jdoc/type-search-index.js +++ b/tictactoe/jdoc/type-search-index.js @@ -1 +1 @@ -typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"view","l":"BlockIndex"},{"p":"view","l":"GameBoardView"},{"p":"view","l":"GameStatusView"},{"p":"model","l":"Player"},{"p":"model","l":"RowBlockModel"},{"p":"","l":"RowGameApp"},{"p":"controller","l":"RowGameController"},{"p":"view","l":"RowGameGUI"},{"p":"model","l":"RowGameModel"},{"p":"view","l":"View"}];updateSearchResults(); \ No newline at end of file +typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"view","l":"BlockIndex"},{"p":"view","l":"GameBoardView"},{"p":"view","l":"GameStatusView"},{"p":"model","l":"RowGameModel.Move"},{"p":"model","l":"Player"},{"p":"model","l":"RowBlockModel"},{"p":"","l":"RowGameApp"},{"p":"controller","l":"RowGameController"},{"p":"view","l":"RowGameGUI"},{"p":"model","l":"RowGameModel"},{"p":"view","l":"View"}];updateSearchResults(); \ No newline at end of file diff --git a/tictactoe/jdoc/view/BlockIndex.html b/tictactoe/jdoc/view/BlockIndex.html index 8daa7091..298fa128 100644 --- a/tictactoe/jdoc/view/BlockIndex.html +++ b/tictactoe/jdoc/view/BlockIndex.html @@ -1,7 +1,7 @@ - + BlockIndex (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/GameBoardView.html b/tictactoe/jdoc/view/GameBoardView.html index 32bbb877..05bc0c97 100644 --- a/tictactoe/jdoc/view/GameBoardView.html +++ b/tictactoe/jdoc/view/GameBoardView.html @@ -1,7 +1,7 @@ - + GameBoardView (CS520 - Homework 1) @@ -86,7 +86,8 @@

    类 GameBoardView

    implements View
    The GameBoardView class visualizes the game board of blocks. - NOTE) For the Composite design pattern, this class is-a Component (i.e. View).
    + NOTE) For the Composite design pattern, this class is-a Component (i.e. + View).
      @@ -144,7 +145,7 @@

      方法概要

      int row, int column)
      -
      Updates the block at the given row and column +
      Updates the block at the given row and column after one of the player's moves.
      @@ -214,7 +215,7 @@

      updateBlock

      public void updateBlock(RowGameModel gameModel, int row, int column)
      -
      Updates the block at the given row and column +
      Updates the block at the given row and column after one of the player's moves.
      参数:
      diff --git a/tictactoe/jdoc/view/GameStatusView.html b/tictactoe/jdoc/view/GameStatusView.html index 5785f5f7..a1484865 100644 --- a/tictactoe/jdoc/view/GameStatusView.html +++ b/tictactoe/jdoc/view/GameStatusView.html @@ -1,7 +1,7 @@ - + GameStatusView (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/RowGameGUI.html b/tictactoe/jdoc/view/RowGameGUI.html index 5be9aad2..19627f6f 100644 --- a/tictactoe/jdoc/view/RowGameGUI.html +++ b/tictactoe/jdoc/view/RowGameGUI.html @@ -1,7 +1,7 @@ - + RowGameGUI (CS520 - Homework 1) @@ -110,9 +110,12 @@

      字段概要

       
      -
      private List<View>
      - -
      + + +
       
      +
      private List<View>
      + +
      For the Composite design pattern, the RowGameGUI is the Composite
      @@ -201,6 +204,12 @@

      reset

      public JButton reset
    +
  • +
    +

    undo

    +
    public JButton undo
    +
    +
  • diff --git a/tictactoe/jdoc/view/View.html b/tictactoe/jdoc/view/View.html index bad18a2c..5d31cf43 100644 --- a/tictactoe/jdoc/view/View.html +++ b/tictactoe/jdoc/view/View.html @@ -1,7 +1,7 @@ - + View (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/class-use/BlockIndex.html b/tictactoe/jdoc/view/class-use/BlockIndex.html index c86adc4d..c536b368 100644 --- a/tictactoe/jdoc/view/class-use/BlockIndex.html +++ b/tictactoe/jdoc/view/class-use/BlockIndex.html @@ -1,7 +1,7 @@ - + 类 view.BlockIndex的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/class-use/GameBoardView.html b/tictactoe/jdoc/view/class-use/GameBoardView.html index 29d7f654..68b4123b 100644 --- a/tictactoe/jdoc/view/class-use/GameBoardView.html +++ b/tictactoe/jdoc/view/class-use/GameBoardView.html @@ -1,7 +1,7 @@ - + 类 view.GameBoardView的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/class-use/GameStatusView.html b/tictactoe/jdoc/view/class-use/GameStatusView.html index af51e42a..0a6d4da8 100644 --- a/tictactoe/jdoc/view/class-use/GameStatusView.html +++ b/tictactoe/jdoc/view/class-use/GameStatusView.html @@ -1,7 +1,7 @@ - + 类 view.GameStatusView的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/class-use/RowGameGUI.html b/tictactoe/jdoc/view/class-use/RowGameGUI.html index 43a03edf..995fdae7 100644 --- a/tictactoe/jdoc/view/class-use/RowGameGUI.html +++ b/tictactoe/jdoc/view/class-use/RowGameGUI.html @@ -1,7 +1,7 @@ - + 类 view.RowGameGUI的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/class-use/View.html b/tictactoe/jdoc/view/class-use/View.html index f2bb5f0c..797fe6ee 100644 --- a/tictactoe/jdoc/view/class-use/View.html +++ b/tictactoe/jdoc/view/class-use/View.html @@ -1,7 +1,7 @@ - + 接口 view.View的使用 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/package-summary.html b/tictactoe/jdoc/view/package-summary.html index 94bb9d95..4a649392 100644 --- a/tictactoe/jdoc/view/package-summary.html +++ b/tictactoe/jdoc/view/package-summary.html @@ -1,7 +1,7 @@ - + view (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/package-tree.html b/tictactoe/jdoc/view/package-tree.html index a926626f..01b58438 100644 --- a/tictactoe/jdoc/view/package-tree.html +++ b/tictactoe/jdoc/view/package-tree.html @@ -1,7 +1,7 @@ - + view 类分层结构 (CS520 - Homework 1) diff --git a/tictactoe/jdoc/view/package-use.html b/tictactoe/jdoc/view/package-use.html index b3e59af6..3de764c8 100644 --- a/tictactoe/jdoc/view/package-use.html +++ b/tictactoe/jdoc/view/package-use.html @@ -1,7 +1,7 @@ - + 程序包 view的使用 (CS520 - Homework 1) From 0321688fd64908315483e6212bd9345a579c25bd Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Wed, 19 Apr 2023 21:39:51 -0400 Subject: [PATCH 03/13] generate the javadoc --- tictactoe/test/TestExample.java | 97 +++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 5 deletions(-) diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index f25efecc..8244aa90 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -5,8 +5,11 @@ import model.Player; import model.RowBlockModel; +import model.RowGameModel; import controller.RowGameController; +import javax.swing.JButton; + /** * An example test class, which merely shows how to write JUnit tests. */ @@ -15,22 +18,106 @@ public class TestExample { @Before public void setUp() { - game = new RowGameController(); + game = new RowGameController(); } @After public void tearDown() { - game = null; + game = null; } @Test public void testNewGame() { - assertEquals (Player.PLAYER_1, game.gameModel.getPlayer()); - assertEquals (9, game.gameModel.movesLeft); + assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + assertEquals(9, game.gameModel.movesLeft); } @Test(expected = IllegalArgumentException.class) public void testNewBlockViolatesPrecondition() { - RowBlockModel block = new RowBlockModel(null); + RowBlockModel block = new RowBlockModel(null); + } + + ///////////////////////// *1.After performing an illegal move, the game is not + ///////////////////////// updated.*/ + @Test + public void testIllegalMove() { + // Place a block in an already occupied cell + JButton block = game.gameView.blocks[0][0]; + Player currentPlayer = game.gameModel.getPlayer(); + game.move(block); + // Try to place another block in the same cell + boolean success = game.move(block); + // Check if the move was unsuccessful + assertFalse(success); + // Check if the game state remains the same + assertEquals(currentPlayer, game.gameModel.getPlayer()); + } + + // 2After performing a legal move, the game is updated appropriately. + @Test + public void testLegalMove() { + // Place a block in an empty cell + int row = 0; + int col = 0; + Player currentPlayer = game.gameModel.getPlayer(); + boolean success = game.move(row, col); + // Check if the move was successful + assertEquals(true, success); + // Check if the game state was updated correctly + assertNotEquals(currentPlayer, game.gameModel.getPlayer()); + assertEquals(8, game.gameModel.movesLeft); + } + + // 3One of the players wins the game. + @Test + public void testWinningGame() { + // Make moves to achieve a winning state + game.move(0, 0); // Player 1 + game.move(1, 0); // Player 2 + game.move(0, 1); // Player 1 + game.move(1, 1); // Player 2 + game.move(0, 2); // Player 1 (wins) + // Check if the game state reflects the winner + assertEquals(Player.PLAYER_1, game.gameModel.getWinner()); } + + // 4The players tie the game. + @Test + public void testTieGame() { + // Make moves to achieve a tied state + game.move(0, 0); // Player 1 + game.move(0, 1); // Player 2 + game.move(0, 2); // Player 1 + game.move(1, 0); // Player 2 + game.move(1, 2); // Player 1 + game.move(1, 1); // Player 2 + game.move(2, 0); // Player 1 + game.move(2, 2); // Player 2 + game.move(2, 1); // Player 1 (tie) + // Check if the game state reflects the tie + assertEquals(Player.NONE, game.gameModel.getWinner()); + } + + // 5. After resetting the app, the game has the expected initial configuration. + @Test + public void testResetGame() { + // Make some moves and reset the game + game.move(0, 0); // Player 1 + game.move(1, 0); // Player 2 + game.reset(); + // Check if the game state is reset to initial values + assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + assertEquals(9, game.gameModel.movesLeft); + assertEquals(Player.NONE, game.gameModel.getWinner()); + } + + // 6. If the user has not done at least one move, the user is not permitted to + // undo. +@Test +public void testUndoNotAllowedBeforeAnyMoves() { + // Check if undo is disallowed before any moves are made + boolean success = game.undo(); + assertEquals(false, success); +}`` + } From f28e6d59f348b3919d484c8676e8fb871925f901 Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 04:42:33 -0400 Subject: [PATCH 04/13] TestIllegalMove --- tictactoe/README.md | 5 +- tictactoe/bin/TestExample.class | Bin 1331 -> 1331 bytes tictactoe/test/TestExample.java | 174 +++++++++++++++++--------------- 3 files changed, 98 insertions(+), 81 deletions(-) diff --git a/tictactoe/README.md b/tictactoe/README.md index 3aa3dff7..91d37b1f 100644 --- a/tictactoe/README.md +++ b/tictactoe/README.md @@ -14,7 +14,10 @@ 1. After building the project (i.e., running `ant`), run the following command in the tictactoe folder: `java -cp bin RowGameApp` - +2.To undo a move, press the "Undo" button on the game board. This will undo the last move made by the player. The game board will be updated + to show the previous state of the game. ### How to clean up (from Terminal): 1. Run `ant clean` to clean the project (i.e., delete all generated files). + +Note: The undo feature is only available for the player's moves and not for the computer's moves. \ No newline at end of file diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 9063078f2cf4d576836d8f63caa256e7d69d2504..4142f11e7107b622dbed0fa6adf05124a0426446 100644 GIT binary patch delta 57 zcmdnYwV7+fQf5ZJ$;+6XS%n$68AK+(WAg3b delta 57 zcmdnYwV7+fQf5Zp$;+6XS%nz58H6XlWA Date: Fri, 21 Apr 2023 04:42:45 -0400 Subject: [PATCH 05/13] TestIllegalMove --- tictactoe/bin/TestExample.class | Bin 1331 -> 1819 bytes tictactoe/bin/view/GameBoardView.class | Bin 2184 -> 2184 bytes tictactoe/bin/view/RowGameGUI.class | Bin 3236 -> 3236 bytes tictactoe/src/view/GameBoardView.java | 2 +- tictactoe/src/view/RowGameGUI.java | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 4142f11e7107b622dbed0fa6adf05124a0426446..14ae1fea6f7b0208d461f2d0ce18f10bc98b5fc9 100644 GIT binary patch delta 937 zcmaKrZBNrs6vzL!dnhdx2APBS%wCNJZJgi(6O}2>;fOe4I;LWo&4O+;p>yM1U-=1m z>8Ah+Ba-+5{7}YoZ)Z1_#U{Py_MY?q-T%3{JyL&+sK5XG`~_eEl>=3k90fAwG~C5K zhM}raH;db5i(xF^q^K9HR+iSX>$$Xo2bhB-s6KqfwwL)YF9Pga#X}u6=$;lYl3>p|r(ou3Vyk0;ikpV8oq>j8ZgqTpK zVMtqnh|_F4=`*`>c{-tJJ@iVa*)7l=4`#&dSKRIfB)I82}#Z1B3to delta 14 VcmeAW>=4`#&dSKNIfB)I82}#f1BCzp diff --git a/tictactoe/bin/view/RowGameGUI.class b/tictactoe/bin/view/RowGameGUI.class index 11bd34a62c88cd1de0d144b18c6d6ddc1e7ff696..fdecc801aff2b4b66d5c6102aaa93baf3bde883b 100644 GIT binary patch delta 14 WcmZ1?xkPfqR}MzT&EGiIF#`ZArUi@u delta 14 WcmZ1?xkPfqR}My|&EGiIF#`ZAtObn# diff --git a/tictactoe/src/view/GameBoardView.java b/tictactoe/src/view/GameBoardView.java index 4675c76d..875a1e6d 100644 --- a/tictactoe/src/view/GameBoardView.java +++ b/tictactoe/src/view/GameBoardView.java @@ -16,7 +16,7 @@ * View). */ public class GameBoardView implements View { - private JButton[][] blocks = new JButton[3][3]; + public JButton[][] blocks = new JButton[3][3]; public GameBoardView(JPanel game, RowGameController controller) { super(); diff --git a/tictactoe/src/view/RowGameGUI.java b/tictactoe/src/view/RowGameGUI.java index 49f055cd..60fce794 100644 --- a/tictactoe/src/view/RowGameGUI.java +++ b/tictactoe/src/view/RowGameGUI.java @@ -19,7 +19,7 @@ public class RowGameGUI implements View { public JFrame gui = new JFrame("Tic Tac Toe"); public RowGameModel gameModel = new RowGameModel(); - private GameBoardView gameBoardView; + public GameBoardView gameBoardView; /** For the Composite design pattern, the RowGameGUI is the Composite */ private List viewList = new ArrayList(); public JButton reset = new JButton("Reset"); From 8d6c7041b71ebbb89403dcc479be0000396e1867 Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 04:55:03 -0400 Subject: [PATCH 06/13] TestLegalMoveUpdate --- tictactoe/test/TestExample.java | 59 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index d47bc85c..d0286e77 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -33,51 +33,52 @@ public void testNewBlockViolatesPrecondition() { RowBlockModel block = new RowBlockModel(null); } + // @Test + // public void testIllegalMove() { + // // Make an illegal move (selecting an already occupied block) + // // a legal move + // game.move(game.gameView.gameBoardView.blocks[0][0]); + // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + // assertEquals(8, game.gameModel.movesLeft); + // // an illegal move (selecting an already occupied block) + // game.move(game.gameView.gameBoardView.blocks[0][0]); + // assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + // assertEquals(7, game.gameModel.movesLeft); + // } + @Test - public void testIllegalMove() { - // Make an illegal move (selecting an already occupied block) - // a legal move - game.move(game.gameView.gameBoardView.blocks[0][0]); - assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - assertEquals(8, game.gameModel.movesLeft); - // an illegal move (selecting an already occupied block) - game.move(game.gameView.gameBoardView.blocks[0][0]); - assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); - assertEquals(7, game.gameModel.movesLeft); - } + public void testLegalMoveUpdatesGame() { - // @Test - // public void testLegalMoveUpdatesGame() { + // Move to a valid block + game.move(game.gameView.gameBoardView.blocks[0][0]); - // game.move(event); - // // Move to a valid block - // game.move(game.gameView.blocks[0][0]); + // The current player should have changed + assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - // // The current player should have changed - // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + // The blocks data should have been updated + assertEquals("X", game.gameModel.blocksData[0][0].getContents()); - // // The blocks data should have been updated - // assertEquals("X", game.gameModel.blocksData[0][0].getContents()); + // The number of moves left should have decreased by 1 + assertEquals(8, game.gameModel.movesLeft); + } - // // The number of moves left should have decreased by 1 - // assertEquals(8, game.gameModel.movesLeft); - // } // @Test // public void testWinningMove() { // // Simulate a winning move for player 1 - // game.gameView.[0][0].setText("X"); - // game.gameView.blockButton[1][1].setText("O"); - // game.gameView.blockButton[0][1].setText("X"); - // game.gameView.blockButton[1][0].setText("O"); - // game.gameView.blockButton[0][2].setText("X"); + // game.move(game.gameView.gameBoardView.blocks[0][0]); + // game.move(game.gameView.gameBoardView.blocks[1][1]); + // game.move(game.gameView.gameBoardView.blocks[0][1]); + // game.move(game.gameView.gameBoardView.blocks[1][0]); + // game.move(game.gameView.gameBoardView.blocks[0][2]); // // Perform a final move to complete the game - // game.move(game.gameView.blockButton[1][2]); + // game.move(game.gameView.gameBoardView.blocks[1][2]); // // Check if the game is won by player 1 // assertEquals(Player.PLAYER_1, game.gameModel.getFinalResult()); // assertEquals(false, game.gameModel.blocksData[1][2].getIsLegalMove()); // } + // @Test // public void testTieGame() { // game.move(0, 0); From 498e42d3368ae3bedeb32432791c2487cef910f3 Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 05:27:08 -0400 Subject: [PATCH 07/13] TestWin --- tictactoe/test/TestExample.java | 49 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index d0286e77..b4097713 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -46,38 +46,35 @@ public void testNewBlockViolatesPrecondition() { // assertEquals(7, game.gameModel.movesLeft); // } - @Test - public void testLegalMoveUpdatesGame() { - - // Move to a valid block - game.move(game.gameView.gameBoardView.blocks[0][0]); + // @Test + // public void testLegalMoveUpdatesGame() { - // The current player should have changed - assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + // // Move to a valid block + // game.move(game.gameView.gameBoardView.blocks[0][0]); - // The blocks data should have been updated - assertEquals("X", game.gameModel.blocksData[0][0].getContents()); + // // The current player should have changed + // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - // The number of moves left should have decreased by 1 - assertEquals(8, game.gameModel.movesLeft); - } + // // The blocks data should have been updated + // assertEquals("X", game.gameModel.blocksData[0][0].getContents()); - // @Test - // public void testWinningMove() { - // // Simulate a winning move for player 1 - // game.move(game.gameView.gameBoardView.blocks[0][0]); - // game.move(game.gameView.gameBoardView.blocks[1][1]); - // game.move(game.gameView.gameBoardView.blocks[0][1]); - // game.move(game.gameView.gameBoardView.blocks[1][0]); - // game.move(game.gameView.gameBoardView.blocks[0][2]); + // // The number of moves left should have decreased by 1 + // assertEquals(8, game.gameModel.movesLeft); + // } - // // Perform a final move to complete the game - // game.move(game.gameView.gameBoardView.blocks[1][2]); + @Test + public void testWinningMove() { + // Player 1 makes the winning move + game.move(game.gameView.gameBoardView.blocks[0][0]); + game.move(game.gameView.gameBoardView.blocks[0][1]); + game.move(game.gameView.gameBoardView.blocks[1][0]); + game.move(game.gameView.gameBoardView.blocks[0][2]); + game.move(game.gameView.gameBoardView.blocks[2][0]); - // // Check if the game is won by player 1 - // assertEquals(Player.PLAYER_1, game.gameModel.getFinalResult()); - // assertEquals(false, game.gameModel.blocksData[1][2].getIsLegalMove()); - // } + assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + //// The game should be over + assertEquals(false, game.gameModel.blocksData[0][2].getIsLegalMove()); + } // @Test // public void testTieGame() { From 5a5aaa5ae9ff10a61d8b054227fdd74c2a6b5dd5 Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 05:32:03 -0400 Subject: [PATCH 08/13] Testwin --- tictactoe/bin/TestExample.class | Bin 1819 -> 2052 bytes tictactoe/bin/model/RowGameModel.class | Bin 2265 -> 2265 bytes tictactoe/src/model/RowGameModel.java | 2 +- tictactoe/test/TestExample.java | 27 ++++++++++++++----------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 14ae1fea6f7b0208d461f2d0ce18f10bc98b5fc9..8482b87e0d37625a0519a320a720ac5b348b5e75 100644 GIT binary patch delta 761 zcmZvZ&rTCj6vn^XnQ7@TAp&Mf(ljaEP~41E6OBX@NyUOKU{TTjK`&((2Zk9#OVNd4 zW8&J((!_;4LF0rF7e0Wm;1j6tU_5s^p$%bi&%NiK?|05OcRr7OxT602_x%TeyLi)6 z|HO_*u*5L7=J0psL3S>CWV`KY6=^)uP)3DHmf2afUG7xP_My{ZxSF3W@A57;9PV1i zdgs7)t$7uzSWDoshAP$>#s`80&vQ)fG9!zWHi;l3k@~Y`#zW2Wz*tL#p{|3Qhv7fEiK() zi4EIz$)w+q@3V&gMb>AU^Z;=%iW)YcHtV zlE{VA^w7B)u}N}iW0#`vJW9JoYp(@|w*7u9D*T2-IdI~Cicis+%*cgP6t4wP#R_mU z!0iC{5fW08XJT7k{m`T7BPhf gxQ<1X@R0sa32(8CkEq})R)*d)b8_kPxM4f*Kc57QPyhe` delta 571 zcmZuu%TB^T6g@3=3Z)WItVG0EHe!RCpc^%surLwP098@&fk=#-uH*yU=-#ADH~s<& zN?iB>uKW%^!g!}tOVDZN&b__ooH;jh6TS~A?_aNP0M^iGDWBp@01@O=Y++1*zqp;P zY?!r-L;$}0KZ*SG;ad^poMl~H)-5|CW!DSTUw}X#AQ>+ZT9k+=Qe@6g6(!2m9snkG zsS>b9T@eNQPD)&JtU?vYLl7f moveHistory = new Stack<>(); // Stack to store move history diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index b4097713..bd0c05d6 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -71,24 +71,27 @@ public void testWinningMove() { game.move(game.gameView.gameBoardView.blocks[0][2]); game.move(game.gameView.gameBoardView.blocks[2][0]); - assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + assertEquals("Player 1 wins!", game.gameModel.getFinalResult()); + // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); //// The game should be over assertEquals(false, game.gameModel.blocksData[0][2].getIsLegalMove()); } // @Test // public void testTieGame() { - // game.move(0, 0); - // game.takeTurn(1, 1); - // game.takeTurn(2, 2); - // game.takeTurn(0, 2); - // game.takeTurn(0, 1); - // game.takeTurn(2, 1); - // game.takeTurn(1, 2); - // game.takeTurn(2, 0); - // game.takeTurn(1, 0); - // assertTrue(game.isGameOver()); - // assertNull(game.getWinner()); + // // Make a series of moves that results in a tie game + // game.move(game.gameView.gameBoardView.blocks[0][0]); // Player 1 + // game.move(game.gameView.gameBoardView.blocks[0][1]); // Player 2 + // game.move(game.gameView.gameBoardView.blocks[0][2]); // Player 1 + // game.move(game.gameView.gameBoardView.blocks[1][0]); // Player 2 + // game.move(game.gameView.gameBoardView.blocks[1][1]); // Player 1 + // game.move(game.gameView.gameBoardView.blocks[2][1]); // Player 2 + // game.move(game.gameView.gameBoardView.blocks[1][2]); // Player 1 + // game.move(game.gameView.gameBoardView.blocks[2][0]); // Player 2 + // game.move(game.gameView.gameBoardView.blocks[2][2]); // Player 1 + // System.out.printf("%s", game.gameModel.getFinalResult()); + // // assertTrue(game.isGameOver()); + // // assertNull(game.getWinner()); // } // @Test From 2887e83df2a0a6756e0d502170f0e8d5668f63be Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 05:41:48 -0400 Subject: [PATCH 09/13] TestTie --- tictactoe/bin/TestExample.class | Bin 2052 -> 1984 bytes tictactoe/test/TestExample.java | 60 +++++++++++++++++--------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 8482b87e0d37625a0519a320a720ac5b348b5e75..7fbb18613a0446bb8040a20b5b917a17288d3028 100644 GIT binary patch delta 566 zcmZutO-lk%6g@NJ%*z=oO*6@aQE20$!fI0_w5pYrnO|i&1VSm00PQ7Q+<>tw5&~Ui zgTw=P%?6$THA1ut)HOREgB1@@2{Cpp5kVK8xpU8a<8$Xv^r%Cx7i)w@8n zea_@R#9sV${Gei0`<)k3s-Yr}xe(?x6tKY1xy|c5X>!X*PT968xWy2vb8}zhw;1%n z;!yTk$5#z4yuaz5bJb_V&cV&i~P@B*%Fms8xbctF2qKQvZN~WG=x+CeF r1_a=GN}!Em8a;TA5lkb4547hD4l#pc Date: Fri, 21 Apr 2023 05:45:46 -0400 Subject: [PATCH 10/13] TestReset --- tictactoe/bin/TestExample.class | Bin 1984 -> 1785 bytes tictactoe/test/TestExample.java | 51 ++++++++++++++++---------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 7fbb18613a0446bb8040a20b5b917a17288d3028..f4140eb925970bd3ae4e82390626145aabc26242 100644 GIT binary patch delta 707 zcmZva&u-H|5XQev>_pkPpi<#TR7j+kI$SIjN`O#GL!lJ%hlIAY2?e(4HW1ues-18_ z;t@Fb%mZ+&h@yx?#hDwAgOCuj#!{`8gJ(TE^ZWLjwZEVLHNk)U`F0Fo0pf`B#7B-a z<_+9HiXn3-J?XEAeaUeXx6-(6poBXNlRYsIwj&O@cG-0uDGnIY1L5>#eUHJkT7}A) zj#38GxNBe$_Zaw&<96P8%fc57xpup<@9s*+Zo0+yWmT!Fw8UYfY~VhY8P0X3zv@+F zS2$I7AQ_TYp~Xq^p@9`V3UW!y=E&o*fhVZY3BvQ_p{~6Vk+FHo2M{Hfs#aNTnb1^n`irom==Mno^zs738Pkn0k#NEs(VlyPRA|jib z-a2ubM+P(DX=do0M{I^%w$P@iJZEX$q~}Ek+qAs=Cq;!%&?pBQSBKyuTo1nJ`Mx$r zQRPFJLo6ic^tln1Xm5-w(e?-r##lWfFahP|5(xsk^v6k>eGeAi(8qpDUV5>cX#97s ISE0)5zwWDcWdHyG delta 987 zcmZ`%OHUJF6g}T`X4*~%k!lJ_Z8BwrT~ITC4=O12Q63eQM|l*r1D%knbP`%yb`$@B zN&kdfVnyS^u;v%Ib16I5Zix4rsdi|FOupB>=bZbRKYhpj%E{Tc?*OK-eW)mc9Yzon zDsJKyLul97GYb{7$uN*_(3xJcnmMxNR_8Kd+`(iJ85MUi#n9j5XXxYXtYz$%U5Tr% z1n2*^lFB{Y4`N0|77rMrwj*;6!ys?JwRYar7zT^Q{A;6O9HeW_N_96qpM6)aTh)w0 zNk3BY7&!)U&uW+qLnFS(>xB^J7_RULnprK^v`SSowDP{uR1n94q#} Date: Fri, 21 Apr 2023 05:54:12 -0400 Subject: [PATCH 11/13] TestNotpermittedToUndo --- tictactoe/bin/TestExample.class | Bin 1785 -> 1463 bytes .../bin/controller/RowGameController.class | Bin 9616 -> 9727 bytes .../src/controller/RowGameController.java | 5 +++- tictactoe/test/TestExample.java | 28 +++++++++--------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index f4140eb925970bd3ae4e82390626145aabc26242..c77cf44404bee93c6f4812a953df9f5bc4c02245 100644 GIT binary patch delta 489 zcmZ8eJ5Iwu6r6QpW3LSg6iyMRa7s561OkK@V*ViLI6-2nh(%yRi8w<}67h*d!2!4g zN1&!byj@$cvMj%SZ+B*P#{Qn4x%}hj?Hxc5r&I15j(vAE6lY?bK82N476e&(n_bY> zxybsXk+@HXNqQ-6Qi4nd)i~}DcNvTxz>H>KQ)&#XQ?=BlhYjkz9Dq%9X=2!-Qv;pJ zXSMktv79Dg5iXWAyjS3RbSBke#of-i)VGNxFSa7~0{(w9Wl9ZVXr0Y zb}*aX`JN8kVu^$;Et|ORFb1E4YyCWpNduz?2xrD%N3;lFo4yfuQ$c~&idTT=C{o5y zqSF8z@d|=oUFI0k${4X9;3o`DRlq#rIPc>qQ%)JeyXJ)peK~_Jlgx1x$*?nUNrbWB z!$oE|kGA8|UU{^^*U-(r)6N_j1@OXl)6El|x2<#&YNdr27iVyVDHOWlN*KYC5cHfaQfcO6Z D$Y_XW diff --git a/tictactoe/bin/controller/RowGameController.class b/tictactoe/bin/controller/RowGameController.class index d7b5bd926f963880ab774d50263724d1f4a9e19e..65a867e7f19ba06fade4d66e8c8602b6389543a9 100644 GIT binary patch literal 9727 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 QZswMcuWrGwz+dD37mU@bga7~l diff --git a/tictactoe/src/controller/RowGameController.java b/tictactoe/src/controller/RowGameController.java index a4d21fc4..daad037b 100644 --- a/tictactoe/src/controller/RowGameController.java +++ b/tictactoe/src/controller/RowGameController.java @@ -48,7 +48,10 @@ public RowGameController() { ////////////// public void undoMove() { - if (gameModel.movesLeft < 9) { + if (gameModel.movesLeft == 9) { + + throw new IllegalStateException("Cannot undo before making a move"); + } else if (gameModel.movesLeft < 9) { gameModel.undoMove(); // call the undoMove() method of the model gameView.update(gameModel); // update the view with the new model state } diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index 9aeb06d1..3ec8ad76 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -94,23 +94,23 @@ public void testNewBlockViolatesPrecondition() { // assertEquals("Game ends in a draw", game.gameModel.getFinalResult()); // } - @Test - public void testResetGame() { - // Reset the game and check if the initial configuration is as expected - game.resetGame(); - assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); - assertEquals(9, game.gameModel.movesLeft); - // The game should not be over - assertEquals(true, game.gameModel.blocksData[0][2].getIsLegalMove()); - assertNull(game.gameModel.getFinalResult()); - } - // @Test - // public void testUndoNotAllowedBeforeMove() { - // // Undo should not be allowed if no moves have been made - // assertFalse(game.undoMove()); + // public void testResetGame() { + // // Reset the game and check if the initial configuration is as expected + // game.resetGame(); + // assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + // assertEquals(9, game.gameModel.movesLeft); + // // The game should not be over + // assertEquals(true, game.gameModel.blocksData[0][2].getIsLegalMove()); + // assertNull(game.gameModel.getFinalResult()); // } + @Test + public void testUndoNotAllowedBeforeMove() { + // Undo should not be allowed if no moves have been made + game.undoMove(); + } + // @Test // public void testUndoMove() { // JButton button = new JButton(); From 945069a08e8a520e26e7e48cd8f240c12835d2db Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 05:59:11 -0400 Subject: [PATCH 12/13] testUndoAllowedAfterMove --- tictactoe/bin/TestExample.class | Bin 1463 -> 1811 bytes tictactoe/test/TestExample.java | 41 +++++++++++++------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index c77cf44404bee93c6f4812a953df9f5bc4c02245..0d83edfccb5305760a231fefe9f4a2e8d24e77ad 100644 GIT binary patch delta 869 zcmZva-A)rx5XXO~Ep2zZA`mP@(Fhj?8RhZ*O*lt?O9hGvDFF7d|Pl4!!E+s zccMbM!CZj2L4uo#p}K?lFGu0ey|MDI%Zia~Hu=h|n(w3K+D2(Tx|DcVsaT~MU5cJJ zxXpsXw`o<2iqXkKGtZ_q23a&%;+QnJl8k5OQ){t4IRX0#25rn)C+7GfKk}Zz?N&FcnNPF`|?_b z{$LxV;&L3`(t_emTpt~{Hh!z^QX*SYB2RpQOR0BHb(vD%5ZZ#z04oa%e zouJ%{VSRxAGdOht3$U@6<2X}}hgRmjtrO0z*V7RDTgyMoT441G+)u8 zH+^H6#Ho-`U={PIp^mkjzERKzss1o?6Ob~A!6#_;Sd8_nV!%2qG*V(!bxw&Er8vUz s0~L<|Hr0T}$sJCqoMkVxX_w?R-7)wlT1CF3Kl+q&Y|eCiP6Q1Xe=iX;VE_OC diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index 3ec8ad76..1666c0d4 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -105,35 +105,28 @@ public void testNewBlockViolatesPrecondition() { // assertNull(game.gameModel.getFinalResult()); // } - @Test - public void testUndoNotAllowedBeforeMove() { - // Undo should not be allowed if no moves have been made - game.undoMove(); - } - // @Test - // public void testUndoMove() { - // JButton button = new JButton(); + // public void testUndoNotAllowedBeforeMove() { + // // Undo should not be allowed if no moves have been made + // game.undoMove(); + // } - // // Make a move - // game.move(null); - // ; - // Player currentPlayer = game.gameModel.getPlayer(); - // int movesLeft = game.gameModel.movesLeft; + @Test + public void testUndoMove() { - // // Verify the move was made successfully - // assertEquals(Player.PLAYER_2, currentPlayer); - // assertEquals(8, movesLeft); + // Make a move + game.move(game.gameView.gameBoardView.blocks[0][0]); - // // Undo the move - // game.undoMove(); + // Verify the move was made successfully + assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + assertEquals(8, game.gameModel.movesLeft); - // // Verify the game is updated appropriately - // currentPlayer = game.gameModel.getPlayer(); - // movesLeft = game.gameModel.movesLeft; + // Undo the move + game.undoMove(); - // assertEquals(Player.PLAYER_1, currentPlayer); - // assertEquals(9, movesLeft); - // } + // Verify the game is updated appropriately + assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + assertEquals(9, game.gameModel.movesLeft); + } } From d906e47e10efc3d0d93ba6e5c22af44600b893fa Mon Sep 17 00:00:00 2001 From: Escaper3 <2037063847@qq.com> Date: Fri, 21 Apr 2023 06:01:39 -0400 Subject: [PATCH 13/13] commitjdoc --- tictactoe/bin/TestExample.class | Bin 1811 -> 3508 bytes tictactoe/jdoc/RowGameApp.html | 4 +- tictactoe/jdoc/allclasses-index.html | 4 +- tictactoe/jdoc/allpackages-index.html | 4 +- tictactoe/jdoc/class-use/RowGameApp.html | 4 +- tictactoe/jdoc/constant-values.html | 4 +- .../jdoc/controller/RowGameController.html | 4 +- .../class-use/RowGameController.html | 4 +- .../jdoc/controller/package-summary.html | 4 +- tictactoe/jdoc/controller/package-tree.html | 4 +- tictactoe/jdoc/controller/package-use.html | 4 +- tictactoe/jdoc/help-doc.html | 4 +- tictactoe/jdoc/index-all.html | 4 +- tictactoe/jdoc/index.html | 4 +- tictactoe/jdoc/model/Player.html | 4 +- tictactoe/jdoc/model/RowBlockModel.html | 4 +- tictactoe/jdoc/model/RowGameModel.Move.html | 4 +- tictactoe/jdoc/model/RowGameModel.html | 8 +- tictactoe/jdoc/model/class-use/Player.html | 4 +- .../jdoc/model/class-use/RowBlockModel.html | 4 +- .../model/class-use/RowGameModel.Move.html | 4 +- .../jdoc/model/class-use/RowGameModel.html | 4 +- tictactoe/jdoc/model/package-summary.html | 4 +- tictactoe/jdoc/model/package-tree.html | 4 +- tictactoe/jdoc/model/package-use.html | 4 +- tictactoe/jdoc/overview-summary.html | 4 +- tictactoe/jdoc/overview-tree.html | 4 +- tictactoe/jdoc/package-summary.html | 4 +- tictactoe/jdoc/package-tree.html | 4 +- tictactoe/jdoc/package-use.html | 4 +- tictactoe/jdoc/view/BlockIndex.html | 4 +- tictactoe/jdoc/view/GameBoardView.html | 8 +- tictactoe/jdoc/view/GameStatusView.html | 4 +- tictactoe/jdoc/view/RowGameGUI.html | 8 +- tictactoe/jdoc/view/View.html | 4 +- tictactoe/jdoc/view/class-use/BlockIndex.html | 4 +- .../jdoc/view/class-use/GameBoardView.html | 6 +- .../jdoc/view/class-use/GameStatusView.html | 4 +- tictactoe/jdoc/view/class-use/RowGameGUI.html | 4 +- tictactoe/jdoc/view/class-use/View.html | 4 +- tictactoe/jdoc/view/package-summary.html | 4 +- tictactoe/jdoc/view/package-tree.html | 4 +- tictactoe/jdoc/view/package-use.html | 4 +- tictactoe/test/TestExample.java | 154 +++++++++--------- 44 files changed, 168 insertions(+), 168 deletions(-) diff --git a/tictactoe/bin/TestExample.class b/tictactoe/bin/TestExample.class index 0d83edfccb5305760a231fefe9f4a2e8d24e77ad..4e19a93db02dad8288359ea313116d2d89057746 100644 GIT binary patch literal 3508 zcmbVO+fo!)6kSIK=0b~rsA$xT#3Vq}QKH6(8bJ{u0|LS*n5YeNz{aK|S+ z5k*8pC8`8!r}a5KW$M;c>fHFWoNxuIjv1EWo)D;LZplOu6WBgsTdrf9rgTz6_I$TK zBTp4q5{RNAj%sL8tk+P34Fc7}GUs+J=rgmX6o^dGL11V4zhK(qs6%}e8#OdwlYlm3 zXQi1MF!h_#5r_?>J4U;Pt{f1kNtbWYFN!T18nIO%t|Ij*M}daGEFkQywkPlkwnwo; z!%n;^Q12s^n*rK5oZ;{H3JtuQ%IZ0g6qhjw>f%geiHuv_b>g*TT zSWKeRv?s26i6)Rjn=0|!0$ZBHlxWE);SOmyjCUxn5-wxNd4an09PfoXcaQW?;dgN~ zigpdha9m)+ihY6g%DdCnovaVh;6rqmuM*`woQ$GFLnlsAdJkop30rSmWkA)oT)O0m zw2;cp8|=;A&b;f|7V8&9mxeRwW?Lz71R8yTS6Zt4>d>R1S9MdNecB2##|jV87zQZr zMJ4-?hVvK}Ncc2P>#puo2~n6-QpjkyfQ#&Rwv0Lv(sD_@flX7Y`FYo22JJD7v332v zN*+iutK2TtjUQq~W4?Af}H~T!dCC5&nua)YcSP> zh&wVTU1g;D&(dIHmJ<10-k&#l)Ha3mcuPisI2v*aB$l_bwjVfhiszGElr}8cpPw0* z&aghN#zcMEp3u#V?ilJlSd6&W3`)8_T{cnL+5V(7LK<6#@|J6;*3B7o>aZ-^)m_83 z=tI2X;p~)?wj=2nbEWQ_w&$r|UD)k?9NBePjWL)9oSzF=4uyUsWEk{ULozrS9&vdR3Ka=5Ga5tgUlb~{Yd zo|jo)E#FxyZ2PZ?^LE~ukY@~4vD#s}24jAo>QFXFHNP)_;FVtjK52aBmxfoDZz=X?|uzFq5cL`R<@{sf5Vi$hE}x#?Gq2}(<0h1A|6`PW7M`TBC&|g zOW5`d$p*X;yf32p{xj?;@vdQ3;2@~QcFMP-ELziwXt%v+cZ$(E>8Wx~JV$C&JjH=@ z3Ds9)7vgC05I6gl0b-mi@8TY>N|$QhZ}ac734G4m{bGP8K{`3b-RFOB5l0qrqN1&$ zZ3(9z<7|*tA-YZxlp~n zD5mo;NM~SeR?E|=KUX9*=x03Q)pA9WC9bMpfJ5YZgk0Nkg1_hZ-79e%2<7;o$no!> z#~-c5F=RcWO0jA^;+JUEdPQ4hsC}hxUq7lmyvDu6WGkNGamuGyLE_^I&u9KWM%WT=yi~Cg mQ-5O3v5YsV!Yxj$PjC`Mx$ delta 541 zcmZvZyG}wu5Qe|yat({>k=oL0W(RetrR)+;(*$n$WoHc06boB**moA)9bZksWySkk2Xvpkrqzg9TJepH-$VC;2Y0DsR!oa| z$dO@z0{IZLIKgaK=J}Xe5v5s84_K|MK5JW(OBYB|w8ZSNb3{yvmkTcQlFa%k$qhMI zEv_Zq3?~FXUR7-eckXi4_*|49gnQ;`v%(`AJW=LZKHx - + RowGameApp (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/allclasses-index.html b/tictactoe/jdoc/allclasses-index.html index fac4c68a..ff912da5 100644 --- a/tictactoe/jdoc/allclasses-index.html +++ b/tictactoe/jdoc/allclasses-index.html @@ -1,11 +1,11 @@ - + All Classes and Interfaces (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/allpackages-index.html b/tictactoe/jdoc/allpackages-index.html index e5a84e49..4b6a04f9 100644 --- a/tictactoe/jdoc/allpackages-index.html +++ b/tictactoe/jdoc/allpackages-index.html @@ -1,11 +1,11 @@ - + 所有程序包 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/class-use/RowGameApp.html b/tictactoe/jdoc/class-use/RowGameApp.html index 4f848ed7..9c3d7322 100644 --- a/tictactoe/jdoc/class-use/RowGameApp.html +++ b/tictactoe/jdoc/class-use/RowGameApp.html @@ -1,11 +1,11 @@ - + 类 RowGameApp的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/constant-values.html b/tictactoe/jdoc/constant-values.html index 19535a2c..33acfec4 100644 --- a/tictactoe/jdoc/constant-values.html +++ b/tictactoe/jdoc/constant-values.html @@ -1,11 +1,11 @@ - + 常量字段值 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/controller/RowGameController.html b/tictactoe/jdoc/controller/RowGameController.html index 1032b4f7..8e0536b3 100644 --- a/tictactoe/jdoc/controller/RowGameController.html +++ b/tictactoe/jdoc/controller/RowGameController.html @@ -1,11 +1,11 @@ - + RowGameController (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/controller/class-use/RowGameController.html b/tictactoe/jdoc/controller/class-use/RowGameController.html index 1eff6c81..55846de4 100644 --- a/tictactoe/jdoc/controller/class-use/RowGameController.html +++ b/tictactoe/jdoc/controller/class-use/RowGameController.html @@ -1,11 +1,11 @@ - + 类 controller.RowGameController的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/controller/package-summary.html b/tictactoe/jdoc/controller/package-summary.html index 05b58735..7fb4843b 100644 --- a/tictactoe/jdoc/controller/package-summary.html +++ b/tictactoe/jdoc/controller/package-summary.html @@ -1,11 +1,11 @@ - + controller (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/controller/package-tree.html b/tictactoe/jdoc/controller/package-tree.html index bedaaf27..f95c0d85 100644 --- a/tictactoe/jdoc/controller/package-tree.html +++ b/tictactoe/jdoc/controller/package-tree.html @@ -1,11 +1,11 @@ - + controller 类分层结构 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/controller/package-use.html b/tictactoe/jdoc/controller/package-use.html index 92244b45..1e2cffcd 100644 --- a/tictactoe/jdoc/controller/package-use.html +++ b/tictactoe/jdoc/controller/package-use.html @@ -1,11 +1,11 @@ - + 程序包 controller的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/help-doc.html b/tictactoe/jdoc/help-doc.html index 3f183723..0e8ff167 100644 --- a/tictactoe/jdoc/help-doc.html +++ b/tictactoe/jdoc/help-doc.html @@ -1,11 +1,11 @@ - + API 帮助 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/index-all.html b/tictactoe/jdoc/index-all.html index ab07b388..02242f0f 100644 --- a/tictactoe/jdoc/index-all.html +++ b/tictactoe/jdoc/index-all.html @@ -1,11 +1,11 @@ - + 索引 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/index.html b/tictactoe/jdoc/index.html index 2d3cd10f..a15b166b 100644 --- a/tictactoe/jdoc/index.html +++ b/tictactoe/jdoc/index.html @@ -1,11 +1,11 @@ - + 概览 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/Player.html b/tictactoe/jdoc/model/Player.html index 9b1e0268..6a6c2b5c 100644 --- a/tictactoe/jdoc/model/Player.html +++ b/tictactoe/jdoc/model/Player.html @@ -1,11 +1,11 @@ - + Player (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/RowBlockModel.html b/tictactoe/jdoc/model/RowBlockModel.html index e0a4831f..36053e70 100644 --- a/tictactoe/jdoc/model/RowBlockModel.html +++ b/tictactoe/jdoc/model/RowBlockModel.html @@ -1,11 +1,11 @@ - + RowBlockModel (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/RowGameModel.Move.html b/tictactoe/jdoc/model/RowGameModel.Move.html index bf4094ec..cafaa0f5 100644 --- a/tictactoe/jdoc/model/RowGameModel.Move.html +++ b/tictactoe/jdoc/model/RowGameModel.Move.html @@ -1,11 +1,11 @@ - + RowGameModel.Move (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/RowGameModel.html b/tictactoe/jdoc/model/RowGameModel.html index 1dd21f53..c5dfba76 100644 --- a/tictactoe/jdoc/model/RowGameModel.html +++ b/tictactoe/jdoc/model/RowGameModel.html @@ -1,11 +1,11 @@ - + RowGameModel (CS520 - Homework 1) - + @@ -111,7 +111,7 @@

    字段概要

     
    -
    private String
    +
     
    static final String
    @@ -232,7 +232,7 @@

    movesLeft

  • finalResult

    -
    private String finalResult
    +
    public String finalResult
  • diff --git a/tictactoe/jdoc/model/class-use/Player.html b/tictactoe/jdoc/model/class-use/Player.html index 8869f339..4acbd992 100644 --- a/tictactoe/jdoc/model/class-use/Player.html +++ b/tictactoe/jdoc/model/class-use/Player.html @@ -1,11 +1,11 @@ - + Enum Class model.Player的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/class-use/RowBlockModel.html b/tictactoe/jdoc/model/class-use/RowBlockModel.html index df6d74f7..c728576b 100644 --- a/tictactoe/jdoc/model/class-use/RowBlockModel.html +++ b/tictactoe/jdoc/model/class-use/RowBlockModel.html @@ -1,11 +1,11 @@ - + 类 model.RowBlockModel的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/class-use/RowGameModel.Move.html b/tictactoe/jdoc/model/class-use/RowGameModel.Move.html index 21a0643f..11cd4d08 100644 --- a/tictactoe/jdoc/model/class-use/RowGameModel.Move.html +++ b/tictactoe/jdoc/model/class-use/RowGameModel.Move.html @@ -1,11 +1,11 @@ - + 类 model.RowGameModel.Move的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/class-use/RowGameModel.html b/tictactoe/jdoc/model/class-use/RowGameModel.html index 31a2519c..f4db7b4d 100644 --- a/tictactoe/jdoc/model/class-use/RowGameModel.html +++ b/tictactoe/jdoc/model/class-use/RowGameModel.html @@ -1,11 +1,11 @@ - + 类 model.RowGameModel的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/package-summary.html b/tictactoe/jdoc/model/package-summary.html index 67dcc396..b5a6528f 100644 --- a/tictactoe/jdoc/model/package-summary.html +++ b/tictactoe/jdoc/model/package-summary.html @@ -1,11 +1,11 @@ - + model (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/package-tree.html b/tictactoe/jdoc/model/package-tree.html index 060a4f51..c8953070 100644 --- a/tictactoe/jdoc/model/package-tree.html +++ b/tictactoe/jdoc/model/package-tree.html @@ -1,11 +1,11 @@ - + model 类分层结构 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/model/package-use.html b/tictactoe/jdoc/model/package-use.html index 0ac03cd4..5c17ba30 100644 --- a/tictactoe/jdoc/model/package-use.html +++ b/tictactoe/jdoc/model/package-use.html @@ -1,11 +1,11 @@ - + 程序包 model的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/overview-summary.html b/tictactoe/jdoc/overview-summary.html index a3b2e5a2..5b201487 100644 --- a/tictactoe/jdoc/overview-summary.html +++ b/tictactoe/jdoc/overview-summary.html @@ -1,11 +1,11 @@ - + CS520 - Homework 1 - + diff --git a/tictactoe/jdoc/overview-tree.html b/tictactoe/jdoc/overview-tree.html index 84693ce5..5150d630 100644 --- a/tictactoe/jdoc/overview-tree.html +++ b/tictactoe/jdoc/overview-tree.html @@ -1,11 +1,11 @@ - + 类分层结构 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/package-summary.html b/tictactoe/jdoc/package-summary.html index 4c5a38f5..16d7aa67 100644 --- a/tictactoe/jdoc/package-summary.html +++ b/tictactoe/jdoc/package-summary.html @@ -1,11 +1,11 @@ - + Unnamed Package (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/package-tree.html b/tictactoe/jdoc/package-tree.html index 3bfd175d..c5df6cd6 100644 --- a/tictactoe/jdoc/package-tree.html +++ b/tictactoe/jdoc/package-tree.html @@ -1,11 +1,11 @@ - + 类分层结构 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/package-use.html b/tictactoe/jdoc/package-use.html index 81b21684..53807ff5 100644 --- a/tictactoe/jdoc/package-use.html +++ b/tictactoe/jdoc/package-use.html @@ -1,11 +1,11 @@ - + 程序包 的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/BlockIndex.html b/tictactoe/jdoc/view/BlockIndex.html index 298fa128..f459d2d8 100644 --- a/tictactoe/jdoc/view/BlockIndex.html +++ b/tictactoe/jdoc/view/BlockIndex.html @@ -1,11 +1,11 @@ - + BlockIndex (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/GameBoardView.html b/tictactoe/jdoc/view/GameBoardView.html index 05bc0c97..c4b496fd 100644 --- a/tictactoe/jdoc/view/GameBoardView.html +++ b/tictactoe/jdoc/view/GameBoardView.html @@ -1,11 +1,11 @@ - + GameBoardView (CS520 - Homework 1) - + @@ -100,7 +100,7 @@

    字段概要

    修饰符和类型
    字段
    说明
    -
    private JButton[][]
    +
     
    @@ -168,7 +168,7 @@

    字段详细资料

  • blocks

    -
    private JButton[][] blocks
    +
    public JButton[][] blocks
  • diff --git a/tictactoe/jdoc/view/GameStatusView.html b/tictactoe/jdoc/view/GameStatusView.html index a1484865..edac1698 100644 --- a/tictactoe/jdoc/view/GameStatusView.html +++ b/tictactoe/jdoc/view/GameStatusView.html @@ -1,11 +1,11 @@ - + GameStatusView (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/RowGameGUI.html b/tictactoe/jdoc/view/RowGameGUI.html index 19627f6f..b736b82f 100644 --- a/tictactoe/jdoc/view/RowGameGUI.html +++ b/tictactoe/jdoc/view/RowGameGUI.html @@ -1,11 +1,11 @@ - + RowGameGUI (CS520 - Homework 1) - + @@ -98,7 +98,7 @@

    字段概要

    修饰符和类型
    字段
    说明
    - +
     
    @@ -188,7 +188,7 @@

    gameModel

  • gameBoardView

    -
    private GameBoardView gameBoardView
    +
    public GameBoardView gameBoardView
  • diff --git a/tictactoe/jdoc/view/View.html b/tictactoe/jdoc/view/View.html index 5d31cf43..ebc067af 100644 --- a/tictactoe/jdoc/view/View.html +++ b/tictactoe/jdoc/view/View.html @@ -1,11 +1,11 @@ - + View (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/class-use/BlockIndex.html b/tictactoe/jdoc/view/class-use/BlockIndex.html index c536b368..baa3bb79 100644 --- a/tictactoe/jdoc/view/class-use/BlockIndex.html +++ b/tictactoe/jdoc/view/class-use/BlockIndex.html @@ -1,11 +1,11 @@ - + 类 view.BlockIndex的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/class-use/GameBoardView.html b/tictactoe/jdoc/view/class-use/GameBoardView.html index 68b4123b..038928f3 100644 --- a/tictactoe/jdoc/view/class-use/GameBoardView.html +++ b/tictactoe/jdoc/view/class-use/GameBoardView.html @@ -1,11 +1,11 @@ - + 类 view.GameBoardView的使用 (CS520 - Homework 1) - + @@ -68,7 +68,7 @@

    view修饰符和类型
    字段
    说明
    -
    +
    RowGameGUI.gameBoardView
     
    diff --git a/tictactoe/jdoc/view/class-use/GameStatusView.html b/tictactoe/jdoc/view/class-use/GameStatusView.html index 0a6d4da8..2abc7026 100644 --- a/tictactoe/jdoc/view/class-use/GameStatusView.html +++ b/tictactoe/jdoc/view/class-use/GameStatusView.html @@ -1,11 +1,11 @@ - + 类 view.GameStatusView的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/class-use/RowGameGUI.html b/tictactoe/jdoc/view/class-use/RowGameGUI.html index 995fdae7..51f52ed1 100644 --- a/tictactoe/jdoc/view/class-use/RowGameGUI.html +++ b/tictactoe/jdoc/view/class-use/RowGameGUI.html @@ -1,11 +1,11 @@ - + 类 view.RowGameGUI的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/class-use/View.html b/tictactoe/jdoc/view/class-use/View.html index 797fe6ee..4a90a6fd 100644 --- a/tictactoe/jdoc/view/class-use/View.html +++ b/tictactoe/jdoc/view/class-use/View.html @@ -1,11 +1,11 @@ - + 接口 view.View的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/package-summary.html b/tictactoe/jdoc/view/package-summary.html index 4a649392..bc7ecdd4 100644 --- a/tictactoe/jdoc/view/package-summary.html +++ b/tictactoe/jdoc/view/package-summary.html @@ -1,11 +1,11 @@ - + view (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/package-tree.html b/tictactoe/jdoc/view/package-tree.html index 01b58438..683a5ddc 100644 --- a/tictactoe/jdoc/view/package-tree.html +++ b/tictactoe/jdoc/view/package-tree.html @@ -1,11 +1,11 @@ - + view 类分层结构 (CS520 - Homework 1) - + diff --git a/tictactoe/jdoc/view/package-use.html b/tictactoe/jdoc/view/package-use.html index 3de764c8..26965e56 100644 --- a/tictactoe/jdoc/view/package-use.html +++ b/tictactoe/jdoc/view/package-use.html @@ -1,11 +1,11 @@ - + 程序包 view的使用 (CS520 - Homework 1) - + diff --git a/tictactoe/test/TestExample.java b/tictactoe/test/TestExample.java index 1666c0d4..d19bef1e 100644 --- a/tictactoe/test/TestExample.java +++ b/tictactoe/test/TestExample.java @@ -33,83 +33,83 @@ public void testNewBlockViolatesPrecondition() { RowBlockModel block = new RowBlockModel(null); } - // @Test - // public void testIllegalMove() { - // // Make an illegal move (selecting an already occupied block) - // // a legal move - // game.move(game.gameView.gameBoardView.blocks[0][0]); - // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - // assertEquals(8, game.gameModel.movesLeft); - // // an illegal move (selecting an already occupied block) - // game.move(game.gameView.gameBoardView.blocks[0][0]); - // assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); - // assertEquals(7, game.gameModel.movesLeft); - // } - - // @Test - // public void testLegalMoveUpdatesGame() { - - // // Move to a valid block - // game.move(game.gameView.gameBoardView.blocks[0][0]); - - // // The current player should have changed - // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - - // // The blocks data should have been updated - // assertEquals("X", game.gameModel.blocksData[0][0].getContents()); - - // // The number of moves left should have decreased by 1 - // assertEquals(8, game.gameModel.movesLeft); - // } - - // @Test - // public void testWinningMove() { - // // Player 1 makes the winning move - // game.move(game.gameView.gameBoardView.blocks[0][0]); - // game.move(game.gameView.gameBoardView.blocks[0][1]); - // game.move(game.gameView.gameBoardView.blocks[1][0]); - // game.move(game.gameView.gameBoardView.blocks[0][2]); - // game.move(game.gameView.gameBoardView.blocks[2][0]); - - // assertEquals("Player 1 wins!", game.gameModel.getFinalResult()); - // // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); - // // The game should be over - // assertEquals(false, game.gameModel.blocksData[0][2].getIsLegalMove()); - // } - - // @Test - // public void testTieGame() { - // // Make a series of moves that results in a tie game - // game.move(game.gameView.gameBoardView.blocks[0][0]); // Player 1 - // game.move(game.gameView.gameBoardView.blocks[0][1]); // Player 2 - // game.move(game.gameView.gameBoardView.blocks[0][2]); // Player 1 - // game.move(game.gameView.gameBoardView.blocks[2][2]); // Player 2 - // game.move(game.gameView.gameBoardView.blocks[2][1]); // Player 1 - // game.move(game.gameView.gameBoardView.blocks[2][0]); // Player 2 - // game.move(game.gameView.gameBoardView.blocks[1][0]); // Player 1 - // game.move(game.gameView.gameBoardView.blocks[1][1]); // Player 2 - // game.move(game.gameView.gameBoardView.blocks[1][2]); // Player 1 - // // System.out.printf("%s", game.gameModel.getFinalResult()); - - // assertEquals("Game ends in a draw", game.gameModel.getFinalResult()); - // } - - // @Test - // public void testResetGame() { - // // Reset the game and check if the initial configuration is as expected - // game.resetGame(); - // assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); - // assertEquals(9, game.gameModel.movesLeft); - // // The game should not be over - // assertEquals(true, game.gameModel.blocksData[0][2].getIsLegalMove()); - // assertNull(game.gameModel.getFinalResult()); - // } - - // @Test - // public void testUndoNotAllowedBeforeMove() { - // // Undo should not be allowed if no moves have been made - // game.undoMove(); - // } + @Test + public void testIllegalMove() { + // Make an illegal move (selecting an already occupied block) + // a legal move + game.move(game.gameView.gameBoardView.blocks[0][0]); + assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + assertEquals(8, game.gameModel.movesLeft); + // an illegal move (selecting an already occupied block) + game.move(game.gameView.gameBoardView.blocks[0][0]); + assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + assertEquals(7, game.gameModel.movesLeft); + } + + @Test + public void testLegalMoveUpdatesGame() { + + // Move to a valid block + game.move(game.gameView.gameBoardView.blocks[0][0]); + + // The current player should have changed + assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + + // The blocks data should have been updated + assertEquals("X", game.gameModel.blocksData[0][0].getContents()); + + // The number of moves left should have decreased by 1 + assertEquals(8, game.gameModel.movesLeft); + } + + @Test + public void testWinningMove() { + // Player 1 makes the winning move + game.move(game.gameView.gameBoardView.blocks[0][0]); + game.move(game.gameView.gameBoardView.blocks[0][1]); + game.move(game.gameView.gameBoardView.blocks[1][0]); + game.move(game.gameView.gameBoardView.blocks[0][2]); + game.move(game.gameView.gameBoardView.blocks[2][0]); + + assertEquals("Player 1 wins!", game.gameModel.getFinalResult()); + // assertEquals(Player.PLAYER_2, game.gameModel.getPlayer()); + // The game should be over + assertEquals(false, game.gameModel.blocksData[0][2].getIsLegalMove()); + } + + @Test + public void testTieGame() { + // Make a series of moves that results in a tie game + game.move(game.gameView.gameBoardView.blocks[0][0]); // Player 1 + game.move(game.gameView.gameBoardView.blocks[0][1]); // Player 2 + game.move(game.gameView.gameBoardView.blocks[0][2]); // Player 1 + game.move(game.gameView.gameBoardView.blocks[2][2]); // Player 2 + game.move(game.gameView.gameBoardView.blocks[2][1]); // Player 1 + game.move(game.gameView.gameBoardView.blocks[2][0]); // Player 2 + game.move(game.gameView.gameBoardView.blocks[1][0]); // Player 1 + game.move(game.gameView.gameBoardView.blocks[1][1]); // Player 2 + game.move(game.gameView.gameBoardView.blocks[1][2]); // Player 1 + // System.out.printf("%s", game.gameModel.getFinalResult()); + + assertEquals("Game ends in a draw", game.gameModel.getFinalResult()); + } + + @Test + public void testResetGame() { + // Reset the game and check if the initial configuration is as expected + game.resetGame(); + assertEquals(Player.PLAYER_1, game.gameModel.getPlayer()); + assertEquals(9, game.gameModel.movesLeft); + // The game should not be over + assertEquals(true, game.gameModel.blocksData[0][2].getIsLegalMove()); + assertNull(game.gameModel.getFinalResult()); + } + + @Test + public void testUndoNotAllowedBeforeMove() { + // Undo should not be allowed if no moves have been made + game.undoMove(); + } @Test public void testUndoMove() {