954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Checking Arrays

Hi i wanted to know how to implement a checking system so that whenever my program randomizes a horse it will always be unique. Thanks!

import java.util.Scanner;
public class Horses
{
public static void main(String args[])
{
String[][] horses = {{"Black ","White ","Gray ","Old ","Young ",
"Pink ","Yellow ","Brown ","Orange ","Cyan ",
"Purple ","Tan ","Cerulean ","Silver ","Gold ",
"Red ","Green ","Blue ","Maroon ","Marigold ",
"Iron ","Paper ","Wood ","Zinc ","Metal "},
{"Stallion"}
};

boolean check9 = false;
String[][] horsePlace = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
, pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])}};

String[][] horsePlace2 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
, pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])}};

String[][] horsePlace3 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
, pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])}};

String[][] horsePlace4 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
, pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])}};

String[][] horsePlace5 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
, pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])}};


String[][] Placement = {{"1. "},
{"2. "},
{"3. "},
{"4. "},
{"5. "}};

String[][] heat1 = {{Placement[0][0] + horsePlace[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace[0][1] + horses[1][0]},
{Placement[2][0] + horsePlace[0][2] + horses[1][0]},
{Placement[3][0] + horsePlace[0][3] + horses[1][0]},
{Placement[4][0] + horsePlace[0][4] + horses[1][0]}};


String[][] heat2 = {{Placement[0][0] + horsePlace2[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace2[0][1] + horses[1][0]},
{Placement[2][0] + horsePlace2[0][2] + horses[1][0]},
{Placement[3][0] + horsePlace2[0][3] + horses[1][0]},
{Placement[4][0] + horsePlace2[0][4] + horses[1][0]}};

String[][] heat3 = {{Placement[0][0] + horsePlace3[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace3[0][1] + horses[1][0]},
{Placement[2][0] + horsePlace3[0][2] + horses[1][0]},
{Placement[3][0] + horsePlace3[0][3] + horses[1][0]},
{Placement[4][0] + horsePlace3[0][4] + horses[1][0]}};

String[][] heat4 = {{Placement[0][0] + horsePlace4[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace4[0][1] + horses[1][0]},
{Placement[2][0] + horsePlace4[0][2] + horses[1][0]},
{Placement[3][0] + horsePlace4[0][3] + horses[1][0]},
{Placement[4][0] + horsePlace4[0][4] + horses[1][0]}};

String[][] heat5 = {{Placement[0][0] + horsePlace5[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace5[0][1] + horses[1][0]},
{Placement[2][0] + horsePlace5[0][2] + horses[1][0]},
{Placement[3][0] + horsePlace5[0][3] + horses[1][0]},
{Placement[4][0] + horsePlace5[0][4] + horses[1][0]}};

String[][] heat6 = {{Placement[0][0] + horsePlace[0][0] + horses[1][0]},
{Placement[1][0] + horsePlace2[0][0] + horses[1][0]},
{Placement[2][0] + horsePlace3[0][0] + horses[1][0]},
{Placement[3][0] + horsePlace4[0][0] + horses[1][0]},
{Placement[4][0] + horsePlace5[0][0] + horses[1][0]}};

String[][] heat7 = {{Placement[0][0] + horsePlace[0][1] + horses[1][0]},
{Placement[1][0] + horsePlace[0][2] + horses[1][0]},
{Placement[2][0] + horsePlace2[0][0] + horses[1][0]},
{Placement[3][0] + horsePlace3[0][0] + horses[1][0]},
{Placement[4][0] + horsePlace2[0][1] + horses[1][0]}};

Eragah
Newbie Poster
17 posts since Dec 2011
Reputation Points: 10
Solved Threads: 1
 

since in your other thread, I gave you this as a suggestion, what have you tried so far?
and why did you start another thread? you could have asked issues about that in your other thread.

stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
 

Thread closed, please follow discussion here

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: