diff --git a/.gitignore b/.gitignore index 8e1ffaa..d0ec2ae 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ MooBreeder.jar *.class +*.dat diff --git a/.gitignore b/.gitignore index 8e1ffaa..d0ec2ae 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ MooBreeder.jar *.class +*.dat diff --git a/Cow.java b/Cow.java index 8ac2e88..cab68c9 100755 --- a/Cow.java +++ b/Cow.java @@ -111,40 +111,15 @@ public String rateCow(String use) { int rating = 0; - if (use == "dairy") { - rating = rateDairyCow(); - } - else if (use == "plowing") { - rating = ratePlowCow(); - } - else if (use == "meat") { - rating = rateMeatCow(); - } - else { - rating = 0; - System.out.println("ERROR No such use: "+use); - } + String trait = ""; + if (use == "dairy") trait = "milk"; + else if (use == "plowing") trait = "strength"; + else if (use == "meat") trait = "meat"; + else System.out.println("ERROR No such use: "+use); + rating = (traits.get(trait)*2) - (int) (Math.pow(traits.get("aggression"),2)); return "This is a "+rating2string(rating)+" cow for "+use+"."; } - private int rateDairyCow() - { - //TODO - return 0; - } - - private int rateMeatCow() - { - //TODO - return 0; - } - - private int ratePlowCow() - { - //TODO - return 0; - } - /* * Return a string rating for values between 0 and 20. */ @@ -158,7 +133,7 @@ else if (rating < 15) return "fairly good"; else if (rating < 18) return "pretty good"; else if (rating < 20) return "very good"; - else return "brilliant"; + else return "excellent"; } private String makeName(String sex, int id) diff --git a/.gitignore b/.gitignore index 8e1ffaa..d0ec2ae 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ MooBreeder.jar *.class +*.dat diff --git a/Cow.java b/Cow.java index 8ac2e88..cab68c9 100755 --- a/Cow.java +++ b/Cow.java @@ -111,40 +111,15 @@ public String rateCow(String use) { int rating = 0; - if (use == "dairy") { - rating = rateDairyCow(); - } - else if (use == "plowing") { - rating = ratePlowCow(); - } - else if (use == "meat") { - rating = rateMeatCow(); - } - else { - rating = 0; - System.out.println("ERROR No such use: "+use); - } + String trait = ""; + if (use == "dairy") trait = "milk"; + else if (use == "plowing") trait = "strength"; + else if (use == "meat") trait = "meat"; + else System.out.println("ERROR No such use: "+use); + rating = (traits.get(trait)*2) - (int) (Math.pow(traits.get("aggression"),2)); return "This is a "+rating2string(rating)+" cow for "+use+"."; } - private int rateDairyCow() - { - //TODO - return 0; - } - - private int rateMeatCow() - { - //TODO - return 0; - } - - private int ratePlowCow() - { - //TODO - return 0; - } - /* * Return a string rating for values between 0 and 20. */ @@ -158,7 +133,7 @@ else if (rating < 15) return "fairly good"; else if (rating < 18) return "pretty good"; else if (rating < 20) return "very good"; - else return "brilliant"; + else return "excellent"; } private String makeName(String sex, int id) diff --git a/MooBreeder.java b/MooBreeder.java index 7dc9d2d..27c1f91 100755 --- a/MooBreeder.java +++ b/MooBreeder.java @@ -252,11 +252,11 @@ { Box cowBox = new Box(BoxLayout.Y_AXIS); cowBox.setBorder(new BevelBorder(BevelBorder.RAISED)); - cowBox.add(Box.createVerticalStrut(5)); + cowBox.add(Box.createVerticalStrut(7)); //If there is no cow here, display an empty panel if (c == null) { cowBox.add(new JLabel(" ", JLabel.CENTER)); - cowBox.add(Box.createVerticalStrut(5)); + cowBox.add(Box.createVerticalStrut(9)); return cowBox; } //Genealogy labels @@ -266,17 +266,17 @@ ", Father: "+c.getParents()[0]+ ", Mother: "+c.getParents()[1]); cowBox.add(name); - cowBox.add(Box.createVerticalStrut(3)); + cowBox.add(Box.createVerticalStrut(5)); cowBox.add(genealogy); cowBox.add(Box.createVerticalStrut(3)); //Trait and rating labels HashMap t = c.getTraits(); - JLabel tl1 = new JLabel("Milk: "+t.get("milk")+" Meat: "+t.get("meat")); - JLabel tl2 = new JLabel("Strength: "+t.get("strength")+" Aggression: "+ + JLabel tl1 = new JLabel("Milk: "+t.get("milk")+", Meat: "+t.get("meat")); + JLabel tl2 = new JLabel("Strength: "+t.get("strength")+", Aggression: "+ t.get("aggression")); cowBox.add(tl1); cowBox.add(tl2); - cowBox.add(Box.createVerticalStrut(3)); + cowBox.add(Box.createVerticalStrut(5)); JLabel rl = new JLabel(c.rateCow(goal)); cowBox.add(rl); //Final stuff