Skip to content
Snippets Groups Projects
Pasch.java 606 B
Newer Older
mh16842's avatar
mh16842 committed
package pasch;

import java.util.Random;

public class Pasch {

	public static void main(String[] args) {
		int wuerfel1;
		int wuerfel2;
		int wuerfel3;
		int anzahlWuerfe = 0;

		while (true) {

			wuerfel1 = new Random().nextInt(6) + 1;
			wuerfel2 = new Random().nextInt(6) + 1;
			wuerfel3 = new Random().nextInt(6) + 1;

			anzahlWuerfe++;
			System.out.println("Wurf, " + anzahlWuerfe + " Gewuerfelt, " + wuerfel1 + ", " + wuerfel2 + ", " + wuerfel3);

			if (wuerfel1 == wuerfel2 && wuerfel1 == wuerfel3) {
				break;
			}

		}

		System.out.println("Pasch!");
	}

}