#me and my friend are confused on where to even start for this assignment

30 messages · Page 1 of 1 (latest)

shrewd breach
#

this might look daunting but 90% of the code is done, I just have to create an intelligent computer player to finish

assignment:
Uses: 2-Dim Arrays, Inheritance, Enumerations For your third programming assignment, you are to add an intelligent player class to the "Go Fish" program done in the class. Specifically, you are to write an IntelligentPlayer class with the following constructor and methods: • Player chooseVictim() // returns the player to be asked for cards. • Rank chooseRank() // returns the rank of the card to be asked for. • void tellOne(Player[] players, Action action, Player player1, Player player2, Rank r, int n) // Used to update the player's knowledge of the other players' cards. The tellOne is used to pass information to the player about what has happened in the game. The possible actions are: • takesCard: player1 takes a card from the stock. • asks: player1 asks player2 for rank r. • gives: player1 gives player2 n cards of rank r. • tellsGoFish: player1 tells player2 to 'Go Fish.' • catches: player1 'goes fish' and gets the card of rank r that was asked for • books: player1 puts down a book of rank r. Program requirements You should write the IntelligentPlayer class and modify the code in the main program to play one intelligent player against three (random) computer players. The class should be a subclass of the Player class. The other classes should not be modified. You must use a 2-dimension array to store the information you've acquired about the other players' hands, and use an enumeration of values to represent what you know about the ranks of cards in the other players' hands.

idle riverBOT
#

This post has been reserved for your question.

Hey @shrewd breach! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

bronze loom
#

do each of tze things in order

shrewd breach
#

right

#

one sec

#

this is where i am

#

i started the semester not really knowing much about classes/methods/return etc which is why my code looks like that

#

i even tried getting a tutor and everything but idk its just tough

#

i would ask the teacher but they aren't allowed to give direct answers so i feel like it'd be kinda useless

bronze loom
#

well, how does the intelligent player know who to pick?

#

then

#

then put that into code

shrewd breach
#

yeah the intelligent player keeps track of what actions the other players take, like

#

if player 2 asks player 3 for 2's, then we know: player 2 has n 2s

#

and if player 3 gives player 2 three twos, then we know: player 2 has a book

#

so it'd just be a bunch of if else statements I have to write?

bronze loom
#

I have no idea what that means but ok

shrewd breach
#

huh?

bronze loom
bronze loom
# shrewd breach huh?

I have no idea on how that game works or what a book is for it but it doesn't matter I guess

shrewd breach
#

go fish

#

book is 4 cards that are the same

bronze loom
shrewd breach
#

game where you start with 7 cards, you ask another player if they have a card (that you also have), and repeat

bronze loom
#

basically just create rules when to do what?

shrewd breach
#

yeah pretty much, i just have to make 1 computer that asks other players for cards depending on what cards they have

bronze loom
#

well then you'd probably encode these rules as if statements

#

unless you can generalize tzem