• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to shuffle  RSS feed

 
marvin kho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys I really need help now. Im just a beginner and dont understand codes. And I just copy this code from my friend for our project. Can you help me how to shuffle the numbers every new game? And if you can help explain the codes. Thank you so much. I will really appreciate your help. Heres my the code.

 
marvin kho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one can help?
 
Paweł Baczyński
Bartender
Posts: 2085
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Marvin!

Welcome to the Ranch!

First of all, Ranch Office is for asking questions / talking about the Ranch itself. For questions about Java please use Beginning Java or Java in General forums.

Second, please UseCodeTags (← click this) when posting code.

Third, please remember that PatienceIsAVirtue.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

PatienceIsAVirtue (← click) - you've only waited 22 minutes for an answer
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
marvin kho wrote:Hi guys I really need help now. Im just a beginner and dont understand codes. And I just copy this code from my friend for our project.

And there's your first mistake, because that code is WRONG.

Can you help me how to shuffle the numbers every new game?

Sure we can - if we know what the "game" is.

And if you can help explain the codes....

That, I fear, will be an exercise in futility because, as I say, the code is wrong ... badly wrong.

My advice: Back up and explain what you are trying to do.
Maybe even better: Give us the instructions as they were given to you (or your friend).

Then we can help you; but we won't just give you the answer. What we will do is to help you do it yourself.

And when you've done that, I suggest that you show your code to your friend (or not).

Winston
 
marvin kho
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The game is Memory game. Pairing the same number.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
marvin kho wrote:The game is Memory game. Pairing the same number.

OK, so I assume that your "grid" (which would appear to be a 4x4 grid) is made up of "pairs" of distinct numbers - yes?

So: How is the game played? I know it; but describe it to me. It's normally played with two people, but your version would appear to be one where the "computer" is simply a referee (and, presumably, scorer).

And try to describe it without using Java. This is a game that's been around for a very long time - probably long before computers were even a twinkle in Babbage's eye - so explain it in English (or your native language), NOT in Java.

Once you've got that description - believe me - you'll be in a much better position to START coding.

And the first place to start might be: How do you populate your grid? - ie, how do you generate a "grid" for your player to use? Your friend's code populates it statically, which might be fine for testing; but when it comes to the real game, you're going to want to be able to produce different grids for each game, aren't you?

For more info, have a look at the StopCoding (←click→) and WhatNotHow pages.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!