Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2019
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Game Board Errors

    Hello, I'm trying to get this code to work but am having trouble with the RandomLocation method.

    package boardgametester;

    import games.board.*;
    import games.utilities.*;

    public class BoardGameTester {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    RandomLocation rl = new RandomLocation();
    Board ticTacToe = new Board(3,3);

    ticTacToe.setCell(Mark.CROSS, Mark.NOUGHT, rl.getRandom(3), rl.getRandom(3));

    System.out.println("TIC TAC TOE BOARD");
    System.out.println(ticTacToe.toString());

    FileManager.writeToFileAsync(ticTacToe.toString(),
    "ttt.txt");

    RandomLocation rl = new RandomLocation();
    Board connectFour = new Board(6,7);

    connectFour.setCell(Mark.YELLOW, Mark.RED, rl.getRandom(6), rl.getRandom(7));

    System.out.println("CONNECT FOUR BOARD");
    System.out.println(connectFour.toString());

    FileManager.writeToFileAsync(connectFour.toString(),
    "c4.txt");

    RandomLocation rl = new RandomLocation();
    Board mastermind = new Board(5,8);

    mastermind.setCell(Mark.YELLOW, Mark.RED, Mark.GREEN, Mark.BLUE, Mark.MAGENTA, Mark.ORANGE, rl.getRandom(5), rl.getRandom(8));

    System.out.println("MASTERMIND BOARD");
    System.out.println(connectFour.toString());

    FileManager.writeToFileAsync(mastermind.toString(),
    "mm.txt");
    }

  2. #2
    New Coder
    Join Date
    Jan 2016
    Location
    Malaysia
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What is the problem you get?


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •