17). Write a program that displays a tic-tac-toe board. A cell may be X, O, or empty. What to display at each cell is randomly decided. The X and O are images in the files X.gif and O.gif. Note:Due to some reason .gif files were not supporting in my program so instead of .gif images I have used .jpg format images of O and X. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class Program_17 extends Application { @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Tic-Tac-Toe by kt"); GridPane gridPane = new GridPane(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int n = (int) (Math.random() * 3); if (n == 0) gridP...
Comments