Package com.test.pm

Source Code of com.test.pm.TestMainApp01

package com.test.pm;

import com.rosiminc.pm.game.PipesManiaGame;
import com.rosiminc.pm.game.Tile;
import java.io.*;
import java.util.Scanner;

public class TestMainApp01 {

 
  private static String chars;

  public static void main(String[] args)
  {
    PipesManiaGame game = new PipesManiaGame(5,10);
   
    Tile[][] board = game.getBoard();
   
    displayBoard(board);
   
  }

  private static void displayBoard(Tile[][] board) {
    for(Tile[] tileArray: board)
    {
      System.out.println("");
      for(Tile tile: tileArray)
      {
        System.out.print(" " + getTileString(tile));
       
      }
    }
  }

  private static char getTileString(Tile tile) {

    int num = tile.getTileNumber();
   
    if(chars == null)
      createChars();
    return chars.charAt(num);
  }

  private static void createChars() {
   
    Scanner reader = null;
    try {
      reader = new Scanner(new FileInputStream(new File("Characters.txt")));
      chars = reader.nextLine();
      reader.close();
     
    } catch (FileNotFoundException e) {
      chars = "abcdefghijklmnop";
    }
  }
}
TOP

Related Classes of com.test.pm.TestMainApp01

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.