Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

Horse Breeding: Try Your Luck

Discussion in 'Your Work' started by Biff, Mar 21, 2025.

Thread Status:
Not open for further replies.
  1. Biff

    Biff Well-Known Adventurer

    Messages:
    66
    Likes Received:
    53
    Trophy Points:
    49
    So I was bored and made this. It replicates Wynncraft's Horse breeding System. All the breeding is done in the background and at the end it will print out the amount of LE spent and the number of rounds of breeding (i.e. the number of brown horses you have bought).

    Notes: The code is my own (as evident by the horrendous coding practices), Yes I understand there are ways to improve it (some of which I may or may not have considered. It all is condensed into 2 lines because the Forums didn't use the indentation in the code. It is written in the language Java. Feel Free to report bugs or say your best (and worst) runs on the simulator.

    The code:
    import java.util.Random;
    public class HorseBreeding {public static void main(String[] args){int brownHorses = 0;int blackHorses = 0;int chestnutHorses = 0;int whiteHorses = 0;int rounds = 0;Random randInt = new Random();int probability;while (whiteHorses == 0){rounds++;brownHorses++;while (brownHorses > 1 || blackHorses > 1 || chestnutHorses > 1){if (brownHorses > 1){brownHorses -= 2;probability = randInt.nextInt(10);if (probability < 2){chestnutHorses++;} else {brownHorses++;}}if (chestnutHorses > 1) {chestnutHorses -= 2;probability = randInt.nextInt(10);if (probability < 2) {whiteHorses++;} else if (probability < 5) {blackHorses++;} else{chestnutHorses++;}}if (blackHorses > 1) {blackHorses -= 2;probability = randInt.nextInt(10);if (probability < 2) {chestnutHorses++;} else if (probability < 5) {brownHorses++;} else{blackHorses++; }}}}System.out.println("You got a White Horse in "+rounds+" rounds of breeding. You paid "+(rounds*0.375f)+" LE.");System.out.println("Brown Horses: "+brownHorses);System.out.println("Black Horses: "+blackHorses);System.out.println("Chestnut Horses: "+chestnutHorses);System.out.println("White Horses: "+whiteHorses);}}
    ________________________________
    My Own try's

    Best: 11 rounds, 4.125 LE
    Worse: 102 rounds, 38.25 LE
     
    culpitisn'taword and IDEKWILAT like this.
Thread Status:
Not open for further replies.