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]}};

Recommended Answers

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.

Jump to Post

All 2 Replies

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.

Thread closed, please follow discussion here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.