בורג – הבדלי גרסאות

תוכן שנמחק תוכן שנוסף
אין תקציר עריכה
שורה 42:
 
 
import java.util.Scanner;
 
class Main {
 
  public static void main(String[] args) {
 
  Scanner obj = new Scanner(System.in);
 
  //הגדרת קבוע //
 
  int BOARD_SIZE = 26;
 
  //הגדרת משתנים //
 
  boolean[] board = new boolean[BOARD_SIZE];
 
  char cellStatus;
 
  int pawn;
 
  //קלט הלוח //
 
  System.out.println("Enter the board details: Type M for a cell with a mine, and F for a free cell: ");
 
  for (int i = 0; i < board.length; i++)
 
  {
 
    System.out.print("Enter status of cell number " + (i+1));
 
    cellStatus = obj.nextLine().charAt(0);
 
    board[i] = (cellStatus == 'F');
 
  }
 
  //  קלט מיקום השחקן והתאמתו לאופן שמירת הלוח //
 
  System.out.print("Enter the pawn position: ");
 
  pawn = obj.nextInt();
 
  //פלט //
 
  System.out.println("Throws that lead to empty positions: ");
 
    for (int i = 0 ; i<=6 ; i++){
 
      if(pawn + i<=25)
 
    if (board[pawn + i]== true)
 
      System.out.println(i+1);
 
   
 
  }
 
  }// main
 
}
 
==היסטוריה==