/* * Created by SharpDevelop. * User: Forbrig * Date: 25.11.2023 * Time: 20:26 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Linq; namespace WuerfelFabrik { public class CubeGame { private char[] ctypes=new char[] {'t','t','t','t'}; private AbstrCubeA cubea1, cubea2; private AbstrCubeB cubeb1, cubeb2; private int anzahl=0; public static void Main(string[]args) { CubeGame cg=new CubeGame(); cg.getConfig(); cg.createCubes(); cg.run(); } private void getConfig() { string text; int help; string h; // Wuerfelarten von Spielern erfragen for (int i=0; i<4; i++) { help=i/2+1; h =help.ToString(); if (i%2==0) { Console.WriteLine("Spieler "+ h +":"); } help=i+1; h =help.ToString(); Console.Write("Wuerfeltyp des "+ h +". Wuerfel: <[b]ars|[d]ots|[t]ext> "); text=Console.ReadLine(); if ( text.Length > 0) this.ctypes[i]=text.First(); } //Durchlaufanzahl erfragen Console.Write("Anzahl der Durchlaeufe: "); text=Console.ReadLine(); this.anzahl=Int32.Parse(text); } /** * Spielwürfel erzeugen */ private void createCubes() { AbstrCubeFactory cf; cf=new CubeFactory1(); this.cubea1=cf.makeCubeA(this.cubea1, new Output(this.ctypes[0])); this.cubeb1=cf.makeCubeB(this.cubeb1, new Output(this.ctypes[1])); cf=new CubeFactory2(); this.cubea2=cf.makeCubeA(this.cubea2, new Output(this.ctypes[2])); this.cubeb2=cf.makeCubeB(this.cubeb2, new Output(this.ctypes[3])); } /** * Spiel ablaufen lassen */ private void run() { Random myObject = new Random(); int ranNum; string text; int paschCount1=0, paschCount2=0; for (int i=0; i