From 28e820292fdac0751aaa9e4da8154c5cd1e6447f Mon Sep 17 00:00:00 2001 From: cdez Date: Wed, 11 Sep 2024 14:47:24 -0700 Subject: [PATCH] This is the latest version of all my programs so far. --- assignmentOne/go_fish | Bin 16240 -> 18480 bytes assignmentOne/go_fish.cpp | 106 +++++++++++++++++- assignmentOne/maze | Bin 16240 -> 16568 bytes assignmentOne/maze.cpp | 196 +++++++++++++++++++++++++++++++++- assignmentOne/wordcounter | Bin 17648 -> 17648 bytes assignmentOne/wordcounter.cpp | 5 + 6 files changed, 299 insertions(+), 8 deletions(-) diff --git a/assignmentOne/go_fish b/assignmentOne/go_fish index d35971e0824f1a075a042607457d25927ddecac9..e218aaca3acc913cbc58381399ba2731de917e56 100755 GIT binary patch literal 18480 zcmeHPeQ;b?b-$8jTY)%|gPq8B5--L9C&nACEE|d7cx`FrCy*UsNx^ssFHgHGYbUE+ zvHRAM0#3x3WU`}Z#(WIbOz8ma&`ir$n5L}@l*kDrfuUg2HsdxlO)|+;CLvWENL3oL z{hfQy*?s%6YZ->W+P$9Dx#xF2?z!jQ`}V!N@A~dYUr&8qoszOl-K2<{Yc@!j1+7v6 zA66Y|75)a)MzsQbgU0Zu0zF%AaG{NcRm(uhu7xTU=v4+*LM1|?WLK?h;Rb{%?g!Z| zCnM(l^iQ-EL|&X)9z@g!=79+0IY9jhPZkZBQ9_!HxYs?e()=LqNMxe)_zDl~8H# zgRrB#Tx^kHKFIA=8;2>*qfi=eDmNq(!#mq=NXE7$6RF(9wuz3N+jh1Gv*}=)mQ!2- zd}!M2J1|7UGDjGvQPocwUi^`44a-TtEpqFryMBAql~3(F)qUWvzxd+6o%*Lv(xJG? zhIFWqKN)i3ss2`cNXO*klc*Vt=$ZIW#)wuce+t3n6@(8}!F#IUr>fu|uY!+M!KuFi zeEfy_7x07N-(3Yi0K8JaJ_~#kK5r_vePk@1va_y}acx`Ky@UJhSUeLylE}L8%;5g6 zWI7cebcU00BdaVq982~e9aHw<0|RbHBAvB|oou|l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$ubQ7DoRgow7)(D)1Oawc&%^{067U+bnZ9!Qy zzrb$DpjDg{fqBTZx?#S}Qz_1rzz{DRJ8B-NY#*X{_S%ECZoXgLFx}o*yo+lZ!V%+g z@I`%NQHQjT!nUYVBsw84!>Q;A8U;BPl;b`;abdFzK9H#u!tcJN){3wjZ2qF7Jok2*umbRW|-{oQU}YS+KxTI zE)ns*Xf_A0hLsha$`I~!;~R<27CFK_H~A}-@KI;5$ir@J9ET*B>1?pQ-=M1%Ah&t{ E0p2;uK>z>% diff --git a/assignmentOne/go_fish.cpp b/assignmentOne/go_fish.cpp index b3a83bd..6236fa7 100644 --- a/assignmentOne/go_fish.cpp +++ b/assignmentOne/go_fish.cpp @@ -32,9 +32,7 @@ Dependencies: ??? #include #include #include -#include -#include -#include +#include #include using namespace std; @@ -42,12 +40,112 @@ using namespace std; // function prototypes // class definitions +class Card +{ + // + public: + Card(char value, char suit) + { + // store the value and suit. (possible values 2-9, T, J, Q, K, A) + cardValue = value; + cardSuit = suit; + // special 1/Ace card here + if(cardValue == 'A') + { + cardNumericalValue = 1; + } + // get the numerical value of the card, casting from string to num where possible. (2-9) + if((cardValue >= 2) || (cardValue <= 9)) + { + // cast the character to number. + cardNumericalValue = (int)cardValue - 48; // numerical values 2-9 only + } + // face values here. + if(cardValue == 'T') + { + // 'ten' card + cardNumericalValue = 10; + } + if(cardValue == 'J') + { + // jack + cardNumericalValue = 11; + } + if(cardValue == 'Q') + { + // queen + cardNumericalValue = 12; + } + if(cardValue == 'K') + { + // king + cardNumericalValue = 13; + } + } + private: + char cardValue; + char cardSuit; + int cardNumericalValue; +}; // main program int main(int argc, char **argv) { + // create array of cards called deck. + vector deck; + // have two hands for cards + vector humanHand; + vector computerHand; + // game setup + // create deck by loop for 1 - 13 with each suit {(H)earts, S(pades), C(lubs), D(iamonds)}. + // use double for loop, outer for suits, inner for values. + // shuffle deck randomly? (use shuffle function from vector library) + // deal hands by taking each card from the deck, one by one (7x) (for loop here.) + // main gameplay loop (while?) + // ask for card rank/number/value + // if card is in hand, // return 0 return 0; } -// compiles using "g++ -Wall -pedantic go_fish.cpp -o go_fish" - note to programmer \ No newline at end of file +// compiles using "g++ -Wall -pedantic go_fish.cpp -o go_fish" - note to programmer + +/* +Function Name: humanTurn +Process: ??? +Function Input/Parameters: ??? +Function Output/Parameters: ??? +Function Output/Returned: ??? +Device Input/Device: ??? +Device Output/Monitor: ??? +Dependencies: ??? +*/ +void humanTurn() +{ + /* + Handles the human’s turn. It will prompt the player to ask for a card rank/number and + check if the computer has the requested rank/number. If the card is available in the + computer’s hand, it will transfer the card to the human’s hand otherwise, it will draw a + card. The function should return the number of sets collected during the turn + */ + // void function, no return. +} + +/* +Function Name: computerTurn +Process: ??? +Function Input/Parameters: ??? +Function Output/Parameters: ??? +Function Output/Returned: ??? +Device Input/Device: ??? +Device Output/Monitor: ??? +Dependencies: ??? +*/ +void computerTurn() +{ + /* + Handles the computer’s turn and it should do the same actions as the human but for the + computer. The function should return the number of set that is collected during its turn. + */ + // void function, no return. +} \ No newline at end of file diff --git a/assignmentOne/maze b/assignmentOne/maze index 0514a4342672f0ca8206a8ff3834408080734c6a..436115332783b0809b7aaf5c9acdf02a1a142e45 100755 GIT binary patch literal 16568 zcmeHOdu$v>8K3i`b!nP7ZBx<|+U*16G|9zITsIVjTw-5xhCJNZB`Kn8*LQ2*k@Ky& z-Hq+4rmjpOR_YR{c#20666N(rc!Ll$r6p+*R4E|T@{m%X!l5lBZb6|WIey>Fe0zJ_ zy8spZcO&h6Gr##>^Udtu%IC~Zd_C8klitd@(?9wjE2k_}4z&w80xW3NxkwO*_AL@C>0%Jy!CobDne_-}r> zn|Eq^wff+^qi*IxaLgYDP8Sn0$dZpQ=vJjy{%!_z@hf3*2^3btSJlA3Ttm+%YT$3Eq38EC z_$dwsu4saqs`$zp_}##(wW|q=u8Ar~`DI*-#WImdsLEC{NXayZN1TG`dREahO=0#9 zY%?=<(H_pZo?RT+)}40>_JB2*w^d#Bns@YjopvFU?@j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U zAPcMPP24W}hN><*aipZ2IAVq_`q!h|T}0e^!;6H$iG&{+ejc!~L7^#VX$UkbF(XD) z_=HD}@J{bD+~h8|-%?<*L6w44@I`}KCce%*h*V=4O57w1N~4=*p|)|OG)JMkao5%X zUQnkH#wRgUk;;fQCXx*tL%UN_h&XEDJq1;=n_gn$$SoFwuQSTqr4tZ{o#d?+fVYAMDF@gny^GP>Y|^YS_P}U79B_ zxkXh3xdkr3d-58%v!y~2loRNLvetlI5H)Lt?$(e~&{-hTd9qbi1nUI`;dbkYHOQL* zG~$MrBZ_S|Z|81EN5UnCxuzpb<2G!OQurgH!0CuX8l+GjRqf*R3JP>bRqBMXs5^bx zVdHm{$S@ss+Xa1OAAA!H+2cNA<+u-=Z6TZZtxLh4wy;f5Is<9c9{k4ub8X=VcRGvT zawbnhS^JP84#~k^$g213`B({j)Si&$O;8>S**)x|i1LaA2T+{|8EQF&11**R0P(e+ AqW}N^ diff --git a/assignmentOne/maze.cpp b/assignmentOne/maze.cpp index f0ffc86..9113248 100644 --- a/assignmentOne/maze.cpp +++ b/assignmentOne/maze.cpp @@ -23,10 +23,6 @@ Dependencies: ??? #include #include #include -#include -#include -#include -#include using namespace std; @@ -37,6 +33,198 @@ using namespace std; // main program int main(int argc, char **argv) { + /* + Maze Layout: + Y Y Y + ============= + | S | | | X + | B | | B | X + | E | | | X + ============= + */ + + bool mazeStop = true; + bool wrongWayFlag = false; + int currentX = 0; + int currentY = 0; + int currentIteration = 0; +// int endX = 0; +// int endY = 2; +// int blockerOneX = 0; +// int blockerOneY = 1; +// int blockerTwoX = 2; +// int blockerTwoY = 1; + char directionCharacter; + + // welcome user to the maze game, explain rules, etc. + cout << "Welcome to the maze game!" << endl; + cout << "Find the end of the maze by entering in directions, such as N(North), E(East), S(South), W(West)." << endl; + cout << "Start game!" << endl; + cout << endl; + while (mazeStop) + { + // if at the starting position, display starting message. + if(currentX == 0 && currentY == 0) + { + // display starting message. + cout << "You are at the start of the maze. The only opening is east." << endl; + if(directionCharacter == 'e') + { + // + currentX = 0; + currentY = 1; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + if(currentX == 0 && currentY == 1) + { + // + cout << "You have continued through the maze. There are openings to the east, west, and south." << endl; + if(directionCharacter == 'e') + { + // + currentX = 0; + currentY = 0; + wrongWayFlag = false; + } + if(directionCharacter == 'w') + { + // + currentX = 0; + currentY = 2; + wrongWayFlag = false; + } + if(directionCharacter == 's') + { + // + currentX = 1; + currentY = 1; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + if(currentX == 0 && currentY == 2) + { + // + cout << "You are continuing through the maze, however, the only opening is to the west." << endl; + if(directionCharacter == 'w') + { + // + currentX = 0; + currentY = 1; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + if(currentX == 1 && currentY == 1) + { + // + cout << "Continuing through the maze, the available directions are north and south." << endl; + if(directionCharacter == 'n') + { + // + currentX = 0; + currentY = 1; + wrongWayFlag = false; + } + if(directionCharacter == 's') + { + // + currentX = 2; + currentY = 1; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + if(currentX == 2 && currentY == 0) + { + // + cout << "You have found the end! Congratulations!" << endl; + cout << "Press X to exit." << endl; + if(directionCharacter == 'x') + { + // set the ending flag to false. + mazeStop = false; + } + } + if(currentX == 2 && currentY == 1) + { + // + cout << "Wandering along, the new directions open are north, east, and west." << endl; + if(directionCharacter == 'n') + { + // + currentX = 1; + currentY = 1; + wrongWayFlag = false; + } + if(directionCharacter == 'e') + { + // + currentX = 2; + currentY = 2; + wrongWayFlag = false; + } + if(directionCharacter == 'w') + { + // + currentX = 2; + currentY = 0; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + if(currentX == 2 && currentY == 2) + { + // + cout << "While continuing through the maze, you see the only opening is the west." << endl; + if(directionCharacter == 'w') + { + // + currentX = 2; + currentY = 1; + wrongWayFlag = false; + } + else + { + wrongWayFlag = true; + } + } + else + { + if(currentIteration != 0 && wrongWayFlag) + { + // print direction out of bounds. + cout << "You cannot move that way. Try again." << endl; + } + + } + // ask user for a direction, check if in bounds + cout << "Which direction would you like to go in?" << endl; + cout << ">"; + cin.ignore(); + directionCharacter = getchar(); + currentIteration = currentIteration + 1; + // if in bounds, move. (if not in bounds, warn them and start over.) + } + cout << "Thanks for playing!" << endl; + // return 0 return 0; } diff --git a/assignmentOne/wordcounter b/assignmentOne/wordcounter index adf754097219825a9dfe154bae5d52008d41f173..5479cf979e933fd11a7076e07174e81a5fd5d6c0 100755 GIT binary patch delta 1121 zcmY*ZZAep57{2H3!_8^)YZKJ$u8ho_!zGDXR*UZe@cItNDG?;W~`W$*Ev#8 z5rq+y8i>eZs}_pf3>=a_6r`jd7FjSMbcu4+ zbSTlPWu(WdC26Qgzlh{;F<6CcD7B4~!#EP2UCB68)IRj1y4^6me62*&Jg~Abez`H& zrE({*YIBe^r0YBl{H;DG-_l+0^r;W#!we^nqs2l557T)O9FQSI!Rg0>laEBN{}n~2 zUlU5A>`8e0UP#{}(JUy8CsHN^CnXjhmMLGYa`x>u^!hXvQpcpzD#FD<-DH#ARA`y5cB8=C~13JYH-cehH*e$4@C5WTNXsW1tC#lv(X zk*JG2HSJTuJ4P`0YP0!Rt4`d38JO)(~l zeSjfA`my%^7R8Hz{#8-@1!(^xiW%@#bpVziGQ#ag6=asnMEPWiJA@dLYRP0bR!D)x za_V(1!(?YCCFr`LArG4AdJF>xScXwwfB^4FxyznT)?%+p^@s%~!{k7E4wiY1bXs!R zvuk9?lB=t|t=>{I4>iFVOR+(p4t03cW|C#CVL5ZK*=km2jhN(gjSS2>Aj_ms+VkQf zG(%>KZK#bPdjt)TDf=_p*m!g>8EunPhb@sa%YB@gR6EX~o218K)9?NUrW~bufs-i$ S(N~u0=PYtG7p$s$$^HX<8nlrB delta 1037 zcmYL|T}TvB6vyYz?&hw#?W&EI#x^5GU#`mnkq^>Sh(ZLh4{O%2 zE|pgzD#{WRp=4>6SaMkgQ>T3iLn)t1ACeIt+%%0yoz9&Z*MZ^ObMEh)|2g;0qy&@_ zP{fKdlNL&Qk`|ncN^R3fcc;Y$dAbR7=M_T{DQ39-cnV6 z*fN?;ut``gmXMXKaIlfcBqTU>8pTI+WWlXR6Pu75vYgX0NbXy*3IM+bJ2D?5LW@l> z73_7V7491f5=j@vLVPSJA|MKpMrOu}upXfaut!duJ%kl)uU1qw1@`A}Rox38K-HS6R%o9$PO!!3Jf3F@PzCx@^@NL}ii)x`tPcS`2nEPH3`Of`iZWjThu`h&rfcoH_@K#jk_M8Z_Ct6E-icNG zlylMlR`CbUWxepg^vp~}&Eg#A&B7AxwB-Q<&j5o9-OY5I5!>DQ=E5dM4>#+ES_ey0 zPJ+GmmLds%@p@1jMrAUp!^yIjB=N?HK|6Ymb9|o6xRD-baHFptz(+ohZReLw`pRt) VRxcgFwwiL=IH!B#VnfXk{U6ybn}7fS diff --git a/assignmentOne/wordcounter.cpp b/assignmentOne/wordcounter.cpp index 424772b..5ec06b3 100644 --- a/assignmentOne/wordcounter.cpp +++ b/assignmentOne/wordcounter.cpp @@ -29,6 +29,7 @@ int main(int argc, char **argv) { int numSentences = 0; int numSpaces = 0; + int wordTotal = 0; string tempString; // ask user for number of sentences cout << "How many sentences would you like to enter?" << '\n'; @@ -55,11 +56,15 @@ int main(int argc, char **argv) } // add an extra 'word' because of the end. numSpaces = numSpaces + 1; + // total the number of words. + wordTotal = wordTotal + numSpaces; // print out to the user cout << "Sentence " << sentenceIterator + 1 << " has " << numSpaces << " words." << endl; // reset word counter numSpaces = 0; + cout << endl; } + cout << "Total word count: " << wordTotal << endl; // return 0 return 0; }