Skip to content

Refactor: Melhoria global do Puzzle do 8 [Estágio] #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eight_game/target/*
18 changes: 16 additions & 2 deletions jogo-oito/.classpath → eight_game/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,36 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-18">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
3 changes: 3 additions & 0 deletions eight_game/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions eight_game/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions eight_game/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions eight_game/.idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions eight_game/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions eight_game/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions eight_game/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions eight_game/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jogo-oito/.project → eight_game/.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jogo-do-oito-do-estagiario-gpt</name>
<name>eight_game</name>
<comment></comment>
<projects>
</projects>
Expand Down
4 changes: 4 additions & 0 deletions eight_game/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=18
org.eclipse.jdt.core.compiler.compliance=18
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=18
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
30 changes: 30 additions & 0 deletions eight_game/nbactions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>clean</goal>
<goal>javafx:run</goal>
</goals>
</action>
<action>
<actionName>jlink</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:jlink</goal>
</goals>
</action>
<action>
<actionName>debug</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run@debug</goal>
</goals>
<properties>
<jpda.listen>true</jpda.listen>
</properties>
</action>
</actions>
71 changes: 71 additions & 0 deletions eight_game/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.j0suetm</groupId>
<artifactId>eight_game</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>21-ea+17</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>21-ea+21</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>21-ea+21</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit5</artifactId>
<version>4.0.16-alpha</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>com.j0suetm.eight_game.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
24 changes: 24 additions & 0 deletions eight_game/src/main/java/com/j0suetm/eight_game/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* file: App.java
* author: Josué Teodoro Moreira <[email protected]>
* date: Jun 16, 2023
*/

package com.j0suetm.eight_game;

import javafx.application.Application;
import javafx.stage.Stage;

public class App extends Application {
private Game game;

@Override
public void start(Stage stage) {
this.game = new Game("Jogo do 8 - Josué Teodoro", 600, 640, true);
game.show(stage);
}

public static void main(String[] args) {
launch(args);
}
}
95 changes: 95 additions & 0 deletions eight_game/src/main/java/com/j0suetm/eight_game/Game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* file: Game.java
* author: Josué Teodoro Moreira <[email protected]>
* date: Jun 16, 2023
*/

package com.j0suetm.eight_game;

import com.j0suetm.eight_game.components.Board;
import com.j0suetm.eight_game.components.RestartButton;

import javafx.geometry.Point2D;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class Game {
private Board board;
private String title;
private Point2D size;
private RestartButton restartButton;
private Stage stage;
private Scene scene;
private StackPane stackPane;

public Game(String title, int width, int height, boolean shouldShuffle) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ola Josue.
Veja a revisão deste pull request anterior.
#13

Obrigado por tentar resolver o desafio.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eu que agradeço pela oportunidade.

this.title = title;
this.size = new Point2D(width, height);

this.board = new Board(width, height - 40, shouldShuffle);
this.restartButton = new RestartButton((int)this.size.getX(), 40);
this.restartButton.addEventHandler(this.board);

this.stackPane = new StackPane(this.restartButton.getButton(), this.board.getGridPane());
this.stackPane.setAlignment(Pos.BOTTOM_CENTER);

this.scene = new Scene(this.stackPane, this.size.getX(),this.size.getY());
}

public void show(Stage stage) {
this.stage = stage;
this.stage.setTitle(this.title);
this.stage.setScene(this.scene);
this.stage.show();
}

public Scene getScene() {
return scene;
}

public void setScene(Scene scene) {
this.scene = scene;
}

public StackPane getStackPane() {
return stackPane;
}

public void setStackPane(StackPane stackPane) {
this.stackPane = stackPane;
}

public Board getBoard() {
return board;
}

public void setBoard(Board board) {
this.board = board;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public Point2D getSize() {
return size;
}

public void setSize(Point2D size) {
this.size = size;
}

public RestartButton getRestartButton() {
return restartButton;
}

public void setRestartButton(RestartButton restartButton) {
this.restartButton = restartButton;
}
}
Loading