[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

http://pastebin.com/djpNv5id I feel like such a retarded pie

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 54
Thread images: 4

File: 1415811689697.png (845KB, 960x717px) Image search: [Google]
1415811689697.png
845KB, 960x717px
http://pastebin.com/djpNv5id
I feel like such a retarded piece of shit for being unable to do this project.
Should I just kill myself now?
This is my first programming course, and I've been making an effort, but just none of it makes any sense.
Please just ridicule me. I know you are better than me in basically every conceivable way.
>>
>>57718202
>http://pastebin.com/djpNv5id
that's a lot of words. you should condense it down to the main criteria need to make the program
>>
>>57718202
I truly desired to attain the knowledge to be able to problem-solve with programming but it was just not within my grasp this semester.
Instead of killing myself I think I'll take the better professor in the spring.
I just wish so much that I could figure this out. It's been killing me.
>>
>>57718251
Are you male or female?
>>
>>57718242
Make a poker hand evaluating method.
Make a draw card method.
Make a draw hand method.
Do this without using any objects or anything that operates on entire arrays.
>>
>>57718202
make us a tl;dr and we'll do your stupid homework
>>
>>57718293
>>57718302
lol do you want to learn programming or do you want us to do your stupid homework

really sounds like you just want us to do your homework
>>
>>57718266
I'm male. I just always wanted to understand everything so when something comes up that I can't understand I just want to walk face first into oncoming traffic.
I know it's a really stupid ideal to want to know everything and that the consequences of failure can be used to strength one's resolve but I still feel sickened by personal failings such as this.
>>
>>57718202
I feel so sorry for the janitor
>>
>>57718332
I really don't want it to be that way. I wish that I had learned enough programming to be able to do this project 100% but I'm a fucking failure that should jump off a bridge because I don't understand stuff without explicit examples or other retard training wheels.
>>
>>57718338
>when something comes up that I can't understand I just want to walk face first into oncoming traffic.
well that's a good attitude to have. to learn new things you have to be willing to immerse yourself in the unknown and stumble your way through.
>>
>>57718360
>because I don't understand stuff without explicit examples
You shouldn't restrict yourself in order to learn things, use whatever crutch you need. build yourself up but don't set your standards so high at the start that you can't make any progress at all.

now if you didn't pay attention in class or do homework at all and are trying to understand it all now.... well that's another matter lol
>>
>>57718367
Thanks for the reassurance.
I've honestly been to dozens of tutoring sessions and meet with my professor an equitable amount of times but this project and the labs and the tests just escape me.
I'm going to bomb the fuck out of the final too.

Let's just start with this section if anyone wants to help me come to terms with this shit.

>You program should represent a card by storing the card’s kind and suit as follows. A card’s kind should be the integer 1 if it is an Ace, the integer 2 if it is a two, the integer 3 if it is a three, etc., the integer 10 if is a ten, the integer 11 if it is a Jack, the integer 12 if it is Queen, and the integer 13 if it is a King. The card’s suit should be the integer 0 if it is a Diamond, 1 if it is a Heart, 2 if it is a Club, and 3 if it is a Spade. So a card consists of two pieces of data, but we would like to be able to treat a card a single “thing” (for example, we would like to be able to return a “card” from a method). Thus, your program should use an array (one-dimensional) of integers with two elements to represent a card. The first element represents the card’s kind and the second element represents the card’s suit.

>Write a method with the following header which generates a random card by randomly generating integers in the appropriate ranges for the card’s kind and suit. (Note that zero is valid for the suit but not for the kind.) The method should return a reference to an array of integers containing two elements – the first element represents the card’s kind and the second the card’s suit.
public static int[] drawCard()

>To represent a 5-card hand, use a two-dimensional array with 5 rows and 2 columns. The 5 rows represent the 5 cards. You can think of each row as a one-dimensional array representing one card. That is, the first column represents each card’s kind. The second column represents each card’s suit.
>>
>>57718418
No, I've been a good student I was out for around three weeks due to medical concerns but I've been back into 100% since early October and yet no epiphany, no edification, no solace has come to me over this subject matter.
The grades aren't what's important to me. The grades should reflect my understanding of the material. I just wish my understanding was of a higher caliber.
I wouldn't even be here conversing with you if I were a derelict student.
>>
>>57718448
You gotta be retarded if you don't realize cards are a number and a suit, two values. It is just saying make 5 random cards, 10 values, easy as shit.
>>
>>57718448
I mean, I think the first two greentexts are simple but I just need to check because everything is so open-ended that I'm almost sure I've done it wrong.
>>57718515
I am retarded. There must be something wrong with me. But I've got some code and that part does seem simple enough, just need some checking and reassurance because I'm out of my gourd on this project.
Besides, multiple people asked for me to condense it down and simplify it so is it really fair for you to join me in calling me retarded when I've only done just that?
>>
>>57718543
They even give you the header and everything you need, it isn't open ended.

public static int[] drawCard(){
generate random suit
generate random number
return both as a 1d array}

and the 2d array is just five of those 1d arrays(cards)

and if you can't make the 2d array it is just a 5 repetitions loop that generates a random card each time and slaps it into the 2d array.
>>
>>57718656
That's what I've got then
int [] card = {2};
card[0] = (int)(13*Math.random() + 1);
card[1] = (int)(4*Math.random());
return card;
>>
>>57718656
Also, I didn't read the whole pastebin but you might want to make sure there aren't duplicates.
>>
>>57718515
That's actually pretty confusing the way they're making him do it IMO. I don't know why he can't just use structs or something. He has to make and return 2 dimensional arrays.

>>57718448
>The card’s suit should be the integer 0 if it is a Diamond, 1 if it is a Heart, 2 if it is a Club, and 3 if it is a Spade
are you allowed to use enums here?
>>
>>57718656
It's just what comes later. I don't understand how to make sure every card is unique even. I thought about using while loops but my professor said that was a dumb idea so I just completely erased a half hour of work or better.
>>
>>57718293
just use a fuckton of variables, if and else if
>>
>>57718699
No enums. No a lot of things that would be actual solutions to the problem, such as manipulating objects, operating on entire arrays etc.
>>
>>57718727
>No enums
lol that's just unneededly confusing. 2d arrays no enums no structs
>>
>>57718448

Make a class called Card
Make another class called Deck
public class Card{

int suit;
int number;

public Class(int suit, int number){
this.suit=suit;
this.number = number;
}

public class Deck{

Card[] myDeck;

public Deck(){

GenerateDeck();

}

public void GenerateDeck(){
for (int i =0;i<13;i++){
for (int j =0;j<4;j++){
myDeck = new Card(i,j);
}
}
}}
}


Now you have your deck of cards. Hopefully you can do something from here.
>>
>>57718756
i think he has to use arrays and numbers to represent the cards and suits, not allowed to use classes
>>
>>57718350
Every time I see one of those pictures I wonder what the most elegant way out of this might be.
>>
Jesus christ talk about a fucking longwinded description
>>
>>57718702
Every time you draw a card you compare it to the previous cards using a loop and an if statement. Make a while loop that redraws while the cards are the same.
>>
>>57718894
Yeah I don't think I like this professor at all.
Or were you calling me long-winded because I don't like me either.
>>
>>57718919
replace the if with while, typo
>>
>>57718840

That's so bad lmao. It seems like the teacher wants OP to do everything in main file too given that all the functions are static.

Thank god I'm not in school anymore.
>>
>>57718941
This is most likely a first/second year programming class where using classes and stuff is even more work.
>>
>>57718756
Sorry if I could use classes I would have already.
I feel as if I'm being taught purposefully wrong just so we can't google up recipes for problems
>>
>>57718931
Chin up, anon. I was talking about your professor
>>
>>57718859
flushall();
>>
>>57718962
You're really not. The last part of the problem where you are supposed to do tons of hands and comparisons doesn't lend itself to a 52 card deck.
>>
>>57718964
Yeah, I should have a better outlook.
Worst case scenario is a retake it in the spring with the better professor and actually make use of ratemyprofessor for the rest of my two years of college.
>>
File: 1465176622088.png (402KB, 593x540px) Image search: [Google]
1465176622088.png
402KB, 593x540px
>>57718202
I literally did this project for my intro oop class. Want it faggot?
>>
>>57719026
I would suck your kirino-posting dick.
But I actually wouldn't gain much info since we can't use OOP programming the fucking cunt fuck.
>>
File: 1478762590398.png (704KB, 1280x720px) Image search: [Google]
1478762590398.png
704KB, 1280x720px
>>57719052
>no oop
Actually, never mind, it's not that helpful. We did blackjack, not poker. I can still post the Card and Deck classes and maybe help you convert that to structs.
Poker and blackjack aren't that different, right?
>>
>>57719107
>structs
not allowed to use them. also he's using java so there's not structs anyway
>>
>>57719107
Sure go for it I'm up for anything at this point.
>>
I got tired of trying to explain it in english. I included an output hand method for looking at the cards. If you can't figure out the rest then you need to read your textbook.

public static void main(String[] args) {
outputHand();
}

public static int[] drawCard(){
Random rand = new Random();
int[] card = new int[2];
card[0]= rand.nextInt(13) + 1;//Random[1-13]
card[1]= rand.nextInt(4); //random [0-3]
return(card);
}
public static int[][] drawHand(){
int[][] hand = new int[5][2];
int[] tempCard=drawCard();
for (int i=0; i<5; i++)
{
hand[i][0] = tempCard[0];
hand[i][1] = tempCard[1];
for (int j=0; j<i; j++)
{
while(hand[j][0]==hand[i][0] && hand[j][1]==hand[i][1])
{
tempCard=drawCard();
hand[i][0] = tempCard[0];
hand[i][1] = tempCard[1];
}
}
}
return(hand);
}

public static void outputHand(){
int[][] hand = drawHand();
for(int i = 0; i<5; i++)
{
System.out.println(hand[i][0]);
System.out.println(hand[i][1]);
System.out.println();
}
}
>>
>>57719443
Thanks this actually works. I altered it some to my personal style and still got it working so I'm learning lol.
Now I just need to understand how to classify hand then generate 10 million hands.
>>
>>57719598
And formatting it but I think that's just if 13 output K kind of stuff.
>>
File: 1479707742804.png (27KB, 787x591px) Image search: [Google]
1479707742804.png
27KB, 787x591px
>>57719372
Little late, had to dig it out of my assignment folder. Check this file.
>>
>>57720168
I still here watching my thread and all of my hopes and dreams die.
>>
Is this how I classify a Royal Flush?
if (hand[0][1] == hand[1][1] == hand[2][1] == hand[3][1] == hand[4][1] &&
hand [i][0] == 13 || hand [i][0] == 12 || hand [i][0] == 11 || hand [i][0] == 10 || hand [i][0] == 1)
rFlush ++;
return 17;
>>
>>57720267
Cat the file faggot.
>>
>>57720411
I already did faggot. Thanks for the post but the projects are a bit to different for me to wrap my faggoty little brain around.
>>
Why aren't they just treating cards as a single value from 1 to 52 and then using /4 for the value and %4 for the suit in display methods?
>>
>>57720505
My professor is a spreg or something fuck if I know why I'm being taught these retard things that literally aren't how programmers do these things.
>>
>>57720322
I really don't think this is right but I'm just dumb.
Thread posts: 54
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.