[Solved] ITCS 3166 Final Project

$25

File Name: ITCS_3166_Final_Project.zip
File Size: 216.66 KB

SKU: [Solved] ITCS 3166 Final Project Category: Tag:
5/5 - (1 vote)

This project is an extension of the ideas used on the Midterm Project. By now you are expected to fully understand the implementation of a serverclient program. Therefore, well now take it a step further.So for this project, were going to make a game. This game will make use of a server to join two clients together for a modified game of Blackjack. Ill explain how this modified game works below.Heres your task: Youre going to create exactly two classes. One class will act as the functional server. The main method of this server will setup the connection on a localhost, find the two clients, let them know which one is Player 1 and which one is Player 2 (depending on the order they connect), and then manage the game as its being played.This is important: For each players turn they should start by displaying their current score to the user. Then, the user should be prompted to select whether they want to Hit or Stand.This option selection can be done any way you choose, but invalid entries must be accounted for*. If the player chooses to Hit, the server should deal a card to the player, which will consist of choosing a random number between 1 and 13. The server sends this card to the player, and the player receives the card and adds it to their score. If the card is above a 10, then add a 10 to the players score instead of the original value (In a standard Blackjack game, Jacks, Queens, and Kings still count as 10). After they receive the card or if they choose to Stand, the next player should take their turn. If either player takes a Hit, and the card theyre dealt raises their score total above 21, then the game should immediately end and the other player is the winner (this is known as a Bust). Likewise, if both players choose to Stand, then both players should be shown the final scores and the game is then over.*for example, if you choose to say Enter (1) For a Hit or enter (2) to Stand, then any entry other than 1 or 2 should be counted as invalid and should loop to allow the player another entry. If you choose something like Enter (H)it or (S)tand, then valid entries should be H, S, and ideally h and s.You May: Get user input in any way you choose, though you must check for invalid entries and prompt a reentry if invalid data is entered; you may choose to implement an additional feature that allows a 1 (Ace) to be worth either 1 or 11, however this is not necessary; you may choose to deal two cards to each player to begin the game, however this is not necessary; you may choose to display the first card drawn to each player to both players, however this is not necessary; you may use driver classes and additional methods other than the main method ineach class, however this is not necessary to complete this program.You May Not: Exceed the scope of a consolebased application this means no GUIs, etc; you may not allow for more than two players by any means; you may not use two different client classes one client must function as either player; you may not use or copy code from any source, including but not limited to other students, textbooks, online sources, activities from this class or any other class, or any other source. Copying code will result in a 0 grade on this assignment and possible other consequences.While youre writing this program, keep the following things in mind: Socket, ServerSocket, and all forms of I/O must be closed when your connection is terminated. Your main method must catch any possible exceptions that may be thrown; it cannot throw an exception as this is bad practice. Please keep your program code neat and organized. Good use of white space goes a long way. Do not keep any unused variables or imports around this is bad practice. Sample Output is included on the next page.

Client Output (First Run of Client Class)Fetching server connectionConnection Established.Fetching player IDGame Found. Youre Player 1.Waiting for serverIts your turn. Enter H for a Hitor S to Stand.Score:0HDrew a 9.Waiting for Player 2Player 2 took a Hit.Its your turn. Enter H for a Hitor S to Stand.Score:9HDrew a 10.Waiting for Player 2Player 2 took a Hit.Its your turn. Enter H for a Hitor S to Stand.Score:19aInput is invalid.Its your turn. Enter H for a Hitor S to Stand.Score:19SChose to Stand at 19.Waiting for Player 2Player 2 took a Hit.Its your turn. Enter H for a Hitor S to Stand.Score:19SChose to Stand at 19.Waiting for Player 2Player 2 took a Stand.Game Over.Player 1s Score:19Player 2s Score:18Player 1 won!Server OutputServer started. Finding ClientsFound Client 1.Found Client 2.Initiating GamePlayer 1s Turn.Got H from Client.Player 1s Score: 9Player 2s Turn.Got H from Client.Player 2s Score:6Player 1s Turn.Got H from Client.Player 1s Score: 19Player 2s Turn.Got H from Client.Player 2s Score:10Player 1s Turn.Got S from Client.Player 2s Turn.Got H from Client.Player 2s Score:18Player 1s Turn.Got S from Client.Player 2s Turn.Got S from Client.Game Over.Player 1s Score:19Player 2s Score:18

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] ITCS 3166 Final Project
$25