/home/caleb/ASDV-Java/Semester 3/Assignments/MP1_FX_CalebFontenot/src/mp1_fx_calebfontenot/TicTacToe.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package mp1_fx_calebfontenot;


import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

/**
 *
 * @author caleb
 */
public class TicTacToe extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        final String BASE_URL = "https://files.calebfontenot.com/";
        Image imageX = new Image(BASE_URL + "image/x.gif");
        Image imageO = new Image(BASE_URL + "image/o.gif");

        GridPane pane = new GridPane();
        pane.setAlignment(Pos.CENTER);
        pane.setHgap(5);
        pane.setVgap(5);

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int status = (int) (Math.random() * 3);
                if (status == 0) {
                    pane.add(new ImageView(imageX), j, i);
                } else if (status == 1) {
                    pane.add(new ImageView(imageO), j, i);
                }
            }
        }
        
        // Create a scene and place it in the stage
        Scene scene = new Scene(pane);
        primaryStage.setTitle("Tic Tac Toe"); // Set the stage title
        primaryStage.setScene(scene); // Place the scene in the stage
        primaryStage.show(); // Display the stage
    }
    public static void main(String[] args) {
        launch(args);
    }
}