H
Heidemaus
Gast
hallo, ich hab seit einem halben ja informatik, wo wir java machen. Leider hab ich einen sehr unfähigen lehrer und wollte fragen ob ihr mir weiterhelfen könnt
also wir sollen ein schachbrett generiern dort eine dame drauf setzen und anzeigen lassen was alles gefährtet ist . hier ist mein bisheriger quellcode, womit ich es schon schaffe das die horizontale gefährdung angezeigt wird, aber das mit der senkrechten und hoizontalen bekomme ich nicht hin
Danke schon mal im vorraus
Java:
public class damenproblem
{
public static void loeschen (int Feld [] [], int leer)
{int laufx = 0;
int laufy =0;
while (laufx <= 7)
{laufy=0;
while ( lauf<=0)
{
Feld [laufx][laufy]=leer;
laufy=laufy+1;
}
laufx=laufx+1
}
}
public static void Dame_setzbar (int Feld [][], int x, int y, int frei)
{ return true;}
public static void Dame_setzen ( int Feld [][], int x, int y, int figur, int Gefahr)
{*
Feld [x][y]= figur;
int laufx = 0;
while (laufx <=7)
{
if ( Feld [laufx][y]!=figur)
{Feld [laufx][y]= Gefahr;
}
laufx=laufx+1;
}
}
public static void Zeile_drucken ( int Feld [][], int y, int F_figur, int F_Dame, int F_bedroht)
{*
int laufx=0;
while (laufx<=7)
{
if ( Feld [laufx] [y]==F_figur)
{System.out.print(".");
}
else if (Feld*[laufx] [y]==F_bedroht)
{System.out.print("X");
}
else*
{System.out.print("D");
}
laufx=laufx+1;
}
System.out.println();
}
public static void Brett_drucken (*int Feld [][], int F_frei, int F_Dame, int F_bedroht)
{*Zeile_drucken ( int Feld,0, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,1, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,2, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,3, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,4, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,5, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,6, int F_frei, int F_Dame, int F_bedroht);
Zeile_drucken ( int Feld,7, int F_frei, int F_Dame, int F_bedroht);
public static void main ( String [] args)
{
int Schachbrett [][];
int frei =0;
int Dame = 1;
int bedroht = 2;
boolean Antwort;
Schachbrett = new int [8][8];
loeschen ( Schachbrett, frei);
Dame_setzen ( Schachbrett, 3,3,Dame, bedroht);
Brett_drucken ( Schachbrett, frei, Dame, bedroht);
Antwort= Dame_setzbar ( Schachbrett, 7,4, frei);
}
}
Danke schon mal im vorraus