Skip to content

Instantly share code, notes, and snippets.

@Filmaluco
Filmaluco / TicTacToeModel.kt
Created October 19, 2023 22:42 — forked from ansisec/TicTacToeModel.kt
Tic Tac Toe
class TicTacToeModel {
enum class Players {
None, P1, P2
}
private lateinit var board: Array<Array<Players>>
private var _winsP1 = 0
private var _winsP2 = 0
private var _currentPlayer = Players.None
private var _ctrl = 9
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
package pt.isec.pa.pong.ui;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.ActionEvent;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import pt.isec.pa.pong.model.Game;
package pt.isec.pa.pong.ui;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import pt.isec.pa.pong.model.Game;
class CommandsViewModel {
Game game;
10,15
E,4,5
v,2,2
E,0,0
E,9,9
E,0,14
v,1,0
E,2,0
E,2,1
E,1,1
public class FleetUI {
private final String licensePlateRegex = "[0-9]{2}[\\s-]{0,1}[0-9]{2}[\\s-]{0,1}[A-IK-PR-VZ]{2}|[0-9]{2}[\\s-]{0,1}[A-IK-PR-VZ]{2}[\\s-]{0,1}[0-9]{2}|[A-IK-PR-WYZ]{2}[\\s-]{0,1}[0-9]{2}[\\s-]{0,1}[A-IK-PR-WYZ]{2}";
final IFleet fleet;
final Scanner scr;
public FleetUI(IFleet fleet) {
this.fleet = fleet;
public interface IFleet {
boolean addVehicle(Vehicle vehicle);
boolean removeVehicle(String licencePlate);
String getName();
String toStringSortByNumberOfPassengers();
String toStringSortByMaxLoad();
@Filmaluco
Filmaluco / PAInput.java
Created March 9, 2023 20:23
input class
package pt.isec.pa.utils;
import java.util.Scanner;
public final class PAInput {
private PAInput() {}
private static Scanner sc;
static {
public class SomaParInteiros
{
public static void main(String args[])
{
int i1, i2;
System.out.println();
if(args.length != 2){
System.out.println("Devem ser indicados 2 parâmetros inteiros!");
public class ParInteiros {
private int i1, i2;
public ParInteiros(int i1, int i2) {
this.i1 = i1;
this.i2 = i2;
}
public int getI1() {
return i1;