New Start in Infrastructur & GameFunctionality Packages

MAIN
wafialwakil 2024-03-03 09:56:35 +01:00
parent 7fc0489186
commit 98b5793015
9 changed files with 0 additions and 295 deletions

View File

@ -1,195 +1,8 @@
package GameFunctionality; package GameFunctionality;
import Infrastructur.Cards;
import Infrastructur.Figure;
import Infrastructur.Gameboard; import Infrastructur.Gameboard;
public class Gamesystem { public class Gamesystem {
private Gameboard gameboard;
private int currentPlayer;
private boolean isGameOver;
public Gamesystem(int numberOfPlayers, int numberOfPiecesPerPlayer) {
this.gameboard = new Gameboard(numberOfPlayers, numberOfPiecesPerPlayer);
this.currentPlayer = 1; // Start mit Spieler 1
this.isGameOver = false;
}
private boolean checkMove (int i, int j) {
boolean isAllowedMove = false;
char[][] board = gameboard.getBoard();
if (board[i][j] == 'O' || board[i][j] == 'X') {
isAllowedMove = true;
}
return isAllowedMove;
}
private Cards[] deckErstellen() {
// create Deck Cards
Cards[] deck = new Cards[52];
for(int i=0; i<4; i++) {
deck[i]=Cards.ZWEI;
}
for(int i=4; i<8; i++) {
deck[i]=Cards.DREI;
}
for(int i=8; i<12; i++) {
deck[i]=Cards.VIER;
}
for(int i=12; i<16; i++) {
deck[i]=Cards.FÜNF;
}
for(int i=16; i<20; i++) {
deck[i]=Cards.SECHS;
}
for(int i=20; i<24; i++) {
deck[i]=Cards.SIEBEN;
}
for(int i=24; i<28; i++) {
deck[i]=Cards.ACHT;
}
for(int i=28; i<32; i++) {
deck[i]=Cards.NEUN;
}
for(int i=32; i<36; i++) {
deck[i]=Cards.ZEHN;
}
for(int i=36; i<40; i++) {
deck[i]=Cards.BUBE;
}
for(int i=40; i<44; i++) {
deck[i]=Cards.DAME;
}
for(int i=44; i<48; i++) {
deck[i]=Cards.KÖNIG;
}
for(int i=48; i<52; i++) {
deck[i]=Cards.ACE;
}
// shuffle Deck Cards
// Array mischen mit dem Fisher-Yates-Algorithmus
for (int i = deck.length - 1; i > 0; i--) {
int index = (int) (Math.random() * (i + 1));
Cards card = deck[index];
deck[index] = deck[i];
deck[i] = card;
}
return deck;
}
private void deckFunctinality(Cards card, Figure figure) {
// move 2 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.ZWEI) {
}
// move 3 steps forwardon (Clockwise) the Game-Board 'O' with your own Figure
if(card == Cards.DREI) {
}
// move 4 steps backward (Counterclockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.VIER) {
}
// move 5 steps forward (Clockwise) on the Game-Board 'O' with any Figure on the Field
if(card == Cards.FÜNF) {
}
// move 6 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.SECHS) {
}
// move in sum of 7 steps forward (Clockwise) on the Game-Board 'O' with two of your own Figures
if(card == Cards.SIEBEN) {
}
// move 8 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.ACHT) {
}
// move 9 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.NEUN) {
}
// move 10 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
// OR skip the turn of the next Player
if(card == Cards.ZEHN) {
}
// exchange places of one of your pieces with one of another player pieces
if(card == Cards.BUBE) {
}
// move 12 steps forward (Clockwise) on the Game-Board 'O' with your own Figure
if(card == Cards.DAME) {
}
// move 13 steps forward (Clockwise) with your own Figure and destroy every Piece on the Way
// OR take one Figure or Piece out from your Home to your Base
if(card == Cards.KÖNIG) {
}
// move 1 or 11 steps forward (Clockwise) with your own Figure
// OR take one Figure or Piece out from your Home to your Base
if(card == Cards.ACE) {
}
}
public void startGame() {
// Initialisierung und Startlogik
System.out.println("Spiel gestartet mit " + gameboard.getNumberOfPlayers() + " Spielern.");
}
public void makeMove(int player, int x, int y) {
// Prüfung, ob der Zug gültig ist und Aktualisierung des Spielbretts
if (isGameOver) {
System.out.println("Spiel ist bereits zu Ende.");
return;
}
if (player != currentPlayer) {
System.out.println("Es ist nicht die Reihe von Spieler " + player);
return;
}
// Hier könnte die Logik implementiert werden, um einen Zug zu machen
// Beispiel: gameboard.setPiece(x, y, player);
// Prüfung auf Gewinn oder Niederlage nach jedem Zug
checkForWin();
// Spielerwechsel
currentPlayer = (currentPlayer % gameboard.getNumberOfPlayers()) + 1;
}
private void checkForWin() {
// Implementierung der Logik zur Überprüfung des Gewinnzustands
// Wenn ein Gewinnzustand erkannt wird, isGameOver auf true setzen
}
public boolean isGameOver() {
return isGameOver;
}
public int getCurrentPlayer() {
return currentPlayer;
}
} }

View File

@ -1,7 +0,0 @@
package Infrastructur;
public enum Cards {
ZWEI, DREI, VIER, FÜNF, SECHS, SIEBEN, ACHT, NEUN, ZEHN, BUBE, DAME, KÖNIG, ACE
}

View File

@ -1,7 +0,0 @@
package Infrastructur;
public enum Figure {
BLAU, GELB, ROT, GRÜN
}

View File

@ -1,8 +0,0 @@
package Infrastructur;
public abstract class Karten {
//Attributes=> Werte von 0 bis 13
private int wert ;
private Cards myType;
}

View File

@ -1,28 +0,0 @@
package Infrastructur;
import java.util.ArrayList;
import java.util.Collection;
public class KartenDeck {
private ArrayList<Karten> karten = new ArrayList<Karten>();
public void kartenInitialisieren()
{
//Hier kann man alle Karten initialisieren..
for(int i = 0;i<4;i++){
for(int j = 0;j<13;j++)
{
// karten.add()
}
}
}
public Collection getKartenDeck()
{
return karten;
}
}

View File

@ -1,11 +0,0 @@
package Infrastructur;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class Player {
private Figure myCharacter;
private ArrayList<Stone> myStones;
private ArrayList<Karten> myCards;
}

View File

@ -1,11 +0,0 @@
package Infrastructur;
public class Stone {
private Figure chracter;
// If location -1 => it's not out, if location 0 => Strongest in game
int location;
}

View File

@ -1,12 +0,0 @@
package Infrastructur;
public class TauschKarte extends ZahlenKarte{
//Die Bubbe
//Ich glaube die Bubbe ist auch eine Zahlenkarte => Bewegt den Stein
public void tauschen()
{
}
}

View File

@ -1,24 +0,0 @@
package Infrastructur;
public class ZahlenKarte extends Karten {
//Hier kannst du deine Karten initialisieren... Diese Karten sind, die zum Laufen sind
//Ich glaube, die 3,2,8,9,Dame
private int wert;
private Cards myType;
public int getWert() {
return wert;
}
public Cards getMyType() {
return myType;
}
public void setWert(int wert) {
this.wert = wert;
}
public void setMyType(Cards myType) {
this.myType = myType;
}
}