Compare commits
44 Commits
8d88f01c9d
...
Brad_Graph
Author | SHA1 | Date | |
---|---|---|---|
37cc19f49a
|
|||
a6fc46a0ea
|
|||
78e50549d0 | |||
d4f254139c | |||
fbbda476b4 | |||
70fef807d5 | |||
90f25b1c26 | |||
5bfb2aba9b | |||
a99a53868b | |||
bb5e2ff401 | |||
895b20b680 | |||
5911d88918 | |||
49d2c5d7ab | |||
e4478c878c
|
|||
c585c54da2 | |||
1740ad2e13 | |||
04fd342a57 | |||
dfc6056767 | |||
1837d976aa | |||
f5bd36f4e0 | |||
716e874b7e | |||
3ab6ff1bfa | |||
f08ed98897 | |||
aafb5f5c66 | |||
bbfc5687d9 | |||
922497573b | |||
e55b17fcd8 | |||
08c4a08a01 | |||
207195c0c8 | |||
ec7692f8d3 | |||
5c4dc5c370 | |||
bc05260ba7 | |||
36c79daa4e | |||
5a45ab43ba | |||
c70e30b629 | |||
a55dcc678a | |||
d5b8da4f21 | |||
2ef6bdb9ed | |||
2d9a4d2aec | |||
acd786744b | |||
cc11b0d882 | |||
3b6c21f4b4 | |||
4608208b7f | |||
29b73a31b3 |
49
.drone.yml
Normal file
49
.drone.yml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: Check_Requirement
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: base_check
|
||||||
|
image: gradle:jdk11-alpine
|
||||||
|
commands:
|
||||||
|
- ./gradlew clean
|
||||||
|
- ./gradlew build
|
||||||
|
- ./gradlew test
|
||||||
|
|
||||||
|
- name: syntax_check
|
||||||
|
image: gradle:jdk11-alpine
|
||||||
|
commands:
|
||||||
|
- ./gradlew check
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: master_build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: make_archive
|
||||||
|
image: alpine:latest
|
||||||
|
volumes:
|
||||||
|
- name: archives
|
||||||
|
path: /build
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache git
|
||||||
|
- tar cvzf /build/$(git log -n 1 --format="%h")_school_archive.gz.tar app/ gradle/ gradlew/ gradlew.bat README.md settings.gradle
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
volumes:
|
||||||
|
- name: archives
|
||||||
|
host:
|
||||||
|
path: /srv/drone/school_project/archive/
|
||||||
|
depends_on:
|
||||||
|
- Check_Requirement
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: 9ca9095fdb69d7b89fda6b4db867877e76666c109607cc7b1e513814ad42bb7e
|
||||||
|
|
||||||
|
...
|
@ -4,3 +4,7 @@
|
|||||||
|
|
||||||
- [Première entrevue](./rapports/130223.md)
|
- [Première entrevue](./rapports/130223.md)
|
||||||
- [Deuxième entrevue](./rapports/200223.md)
|
- [Deuxième entrevue](./rapports/200223.md)
|
||||||
|
|
||||||
|
# Histoire
|
||||||
|
|
||||||
|
- [Plot Story](./histoire/plot_story.md)
|
60
JournalDeBord/src/histoire/plot_story.md
Normal file
60
JournalDeBord/src/histoire/plot_story.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
Intro histoire
|
||||||
|
|
||||||
|
|
||||||
|
Après notre premier quadri à l unif assez compliqué entre calculus, inégalités et physique
|
||||||
|
et la perte de temps dans les transports en commun.
|
||||||
|
Je décide de enfin me prendre un kot à Mons pour réussir ce quadri en beauté
|
||||||
|
|
||||||
|
intro à jouer
|
||||||
|
|
||||||
|
Faire les cartons de différentes cours
|
||||||
|
Calculus --> big carton( encombrant pas possible de tourner)
|
||||||
|
Algo 1 --> pc portable (fragile)
|
||||||
|
Math elem carton avec une inégalité dessus qui change dès qu on tourne la pièce)
|
||||||
|
Objet perso à chacun
|
||||||
|
Mat --> poids de sport
|
||||||
|
Eddy --> balle de basket,...
|
||||||
|
Anthony --> tenue de scout
|
||||||
|
|
||||||
|
Déménagement histoire :
|
||||||
|
|
||||||
|
Arrivé à l appartement :
|
||||||
|
La pièce est assez petite mais avec assez d'imagination je serai tout mettre
|
||||||
|
(j'aurais aimé déjà être en master pour faire une AI qui me aiderai à ranger tous
|
||||||
|
ça peut-etre que chatgpt pourrait m aider..)
|
||||||
|
|
||||||
|
Déménagement à jouer :
|
||||||
|
|
||||||
|
Galère à tout rangé --> (interaction avec le jouer)
|
||||||
|
--> en repensant c est peut-être pour ça que l ancien propriétaire et partie et que le prix était de si bas
|
||||||
|
Notion de jour donc cours unifs -> pas le temps de ranger dans le WK on doit terminer en semaine
|
||||||
|
|
||||||
|
continuité histoire
|
||||||
|
|
||||||
|
Après un long mardi terminer par le cours d algo 2 il est
|
||||||
|
tant de ranger le dernier carton dans la buanderie après une 10 minute de marche
|
||||||
|
j arrive à mon kot mais qlq chose à changer, la couleur de la porte n est plus la même.
|
||||||
|
De plus il faut tirer et plus poussé pour l ouvrir.
|
||||||
|
Après être rentré tous les cartons sont refait et l ordre des pièces à changer
|
||||||
|
|
||||||
|
à jouer
|
||||||
|
|
||||||
|
----> refaire des niveaux différents pour ranger les cartons
|
||||||
|
|
||||||
|
(intercation pendant le jeu)
|
||||||
|
-->Hormis la fatigue qui me gagne et se sentiment étrange par rapport à ce kot
|
||||||
|
je defais encore une fois tous mes cartons
|
||||||
|
(je ne sais pas comment mais tout mes exo en calculus ont été corrigées les cartons sont tous remplie de rouge lol)
|
||||||
|
|
||||||
|
Day 2 histoire
|
||||||
|
|
||||||
|
Après avoir défait le dernier carton dans le bureau je remarque une Trap mystérieuse mais il est déjà 23h et demain j'ai une longue journée qui m'attend (8-10 et 15h45-17h45)
|
||||||
|
La nuit passe --> rien ne bouge
|
||||||
|
(Level bonus)
|
||||||
|
(choix entre faire le petit dej ou allez directement en cours)
|
||||||
|
Après un bon petit déj --> puzzle cassé les oeuf au bonne endroit dans la poêle
|
||||||
|
mettre le bacon au bonne endroit
|
||||||
|
La journée se termine je croise les doigts pour que tout reste comme avant
|
||||||
|
Puis on ouvre la Trap est... space cat avec qlq level
|
||||||
|
ou reveil devant l examen de calculus
|
@ -1,3 +1,5 @@
|
|||||||
# School_Project
|
# School_Project
|
||||||
|
|
||||||
|
[](http://drone.herisson.ovh/undefined_name/School_Project)
|
||||||
|
|
||||||
School Project based on Cats Organized Neatly
|
School Project based on Cats Organized Neatly
|
@ -1,32 +1,222 @@
|
|||||||
/*
|
|
||||||
* This Java source file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
package school_project;
|
package school_project;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.scene.Group;
|
import javafx.scene.Group;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.Cursor;
|
||||||
|
import javafx.scene.input.KeyEvent;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Polygon;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
|
import javafx.animation.RotateTransition;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.util.Duration;
|
||||||
public class Controller extends Application{
|
public class Controller extends Application{
|
||||||
|
|
||||||
@Override
|
double x;
|
||||||
|
double y;
|
||||||
|
|
||||||
|
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
primaryStage.setTitle("test");
|
|
||||||
Button btn = new Button("test");
|
Polygon piece1 = new Polygon();
|
||||||
btn.setOnAction(event -> System.out.println("hey"));
|
Polygon piece2 = new Polygon();
|
||||||
|
Polygon piece3 = new Polygon();
|
||||||
|
Polygon piece4 = new Polygon();
|
||||||
|
Polygon piece5 = new Polygon();
|
||||||
|
Polygon piece6 = new Polygon();
|
||||||
|
Polygon piece7 = new Polygon();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
piece1.getPoints().addAll(new Double [] {
|
||||||
|
0.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,200.0,
|
||||||
|
100.0,200.0,
|
||||||
|
100.0,100.0,
|
||||||
|
0.0,100.0});
|
||||||
|
|
||||||
|
piece2.getPoints().addAll(new Double [] {
|
||||||
|
100.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,300.0,
|
||||||
|
100.0,300.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
piece3.getPoints().addAll(new Double [] {
|
||||||
|
0.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,200.0,
|
||||||
|
0.0,200.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
piece4.getPoints().addAll(new Double [] {
|
||||||
|
0.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,300.0,
|
||||||
|
0.0,300.0,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
piece5.getPoints().addAll(new Double [] {
|
||||||
|
0.0,0.0,
|
||||||
|
100.0,0.0,
|
||||||
|
100.0,100.0,
|
||||||
|
0.0,100.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
piece6.getPoints().addAll(new Double [] {
|
||||||
|
0.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,300.0,
|
||||||
|
100.0,300.0,
|
||||||
|
100.0,100.0,
|
||||||
|
0.0,100.0});
|
||||||
|
|
||||||
|
piece7.getPoints().addAll(new Double [] {
|
||||||
|
100.0,0.0,
|
||||||
|
200.0,0.0,
|
||||||
|
200.0,200.0,
|
||||||
|
100.0,200.0,
|
||||||
|
});
|
||||||
|
|
||||||
|
/*for(int i ; i<tab.lenght ; i++ ) {
|
||||||
|
for (int j , i<tab.widnth , j++) {
|
||||||
|
|
||||||
|
if (tab[0][0]==TRUE;) {
|
||||||
|
if(tab[
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Group root = new Group();
|
Group root = new Group();
|
||||||
root.getChildren().add(btn);
|
root.getChildren().addAll(piece2,piece1,piece3,piece4,piece5,piece6,piece7/*,....,pieceN*/);
|
||||||
|
Scene scene = new Scene(root,690,650,Color.WHEAT);
|
||||||
Scene scene = new Scene(root, 300,300);
|
root.getChildren().forEach(n -> makeDraggable((Polygon) n));
|
||||||
|
root.getChildren().forEach(n -> rotation((Polygon) n, scene));
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.setTitle("piece 1");
|
||||||
|
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
piece1.setFill(Color.LIMEGREEN);
|
||||||
|
piece1.setStroke(Color.BLACK);
|
||||||
|
piece1.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece2.setFill(Color.LIMEGREEN);
|
||||||
|
piece2.setStroke(Color.BLACK);
|
||||||
|
piece2.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece3.setFill(Color.LIMEGREEN);
|
||||||
|
piece3.setStroke(Color.BLACK);
|
||||||
|
piece3.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece4.setFill(Color.LIMEGREEN);
|
||||||
|
piece4.setStroke(Color.BLACK);
|
||||||
|
piece4.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece5.setFill(Color.LIMEGREEN);
|
||||||
|
piece5.setStroke(Color.BLACK);
|
||||||
|
piece5.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece6.setFill(Color.LIMEGREEN);
|
||||||
|
piece6.setStroke(Color.BLACK);
|
||||||
|
piece6.setStrokeWidth(3);
|
||||||
|
|
||||||
|
piece7.setFill(Color.LIMEGREEN);
|
||||||
|
piece7.setStroke(Color.BLACK);
|
||||||
|
piece7.setStrokeWidth(3);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//double click delayed bug to fix
|
||||||
|
//ftm just the last piece implemented can be rotated
|
||||||
|
public static void rotaterght (Node node) {
|
||||||
|
RotateTransition rotaterght = new RotateTransition();
|
||||||
|
//setting attributes for the RotateTransition
|
||||||
|
rotaterght.setByAngle(90);
|
||||||
|
rotaterght.autoReverseProperty();
|
||||||
|
rotaterght.setDuration(Duration.millis(1000));
|
||||||
|
rotaterght.setNode(node);
|
||||||
|
rotaterght.setAxis(Rotate.Z_AXIS);
|
||||||
|
rotaterght.play();}
|
||||||
|
|
||||||
|
public static void rotatelft (Node node) {
|
||||||
|
|
||||||
|
RotateTransition rotatelft = new RotateTransition();
|
||||||
|
|
||||||
|
rotatelft.setByAngle(-90);// minus to rotate to the left
|
||||||
|
rotatelft.autoReverseProperty();
|
||||||
|
rotatelft.setDuration(Duration.millis(1000));
|
||||||
|
rotatelft.setNode(node);
|
||||||
|
rotatelft.setAxis(Rotate.Z_AXIS);
|
||||||
|
rotatelft.play();}
|
||||||
|
|
||||||
|
public void rotation (Polygon node, Scene scene) {
|
||||||
|
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||||
|
public void handle(KeyEvent event) {// 'event' means corresponds to clicking on the clipboard
|
||||||
|
switch (event.getCode()) {// 'getCode' gets the code of the key pressed on the clipboard
|
||||||
|
case RIGHT: rotaterght(node); break;
|
||||||
|
//args to set
|
||||||
|
case LEFT: rotatelft(node); break;
|
||||||
|
default: System.out.println("this case hasn't been taken in charge yet");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void makeDraggable(Polygon node) {
|
||||||
|
node.setOnMousePressed(new EventHandler<MouseEvent>() {
|
||||||
|
@Override public void handle(MouseEvent mouseEvent) {
|
||||||
|
// record a (x,y) distance for the drag and drop operation.
|
||||||
|
x = node.getLayoutX() - mouseEvent.getSceneX();
|
||||||
|
y = node.getLayoutY() - mouseEvent.getSceneY();
|
||||||
|
node.requestFocus();
|
||||||
|
node.setFocusTraversable(true);
|
||||||
|
node.focusedProperty();
|
||||||
|
node.focusVisibleProperty();
|
||||||
|
/*node.setFocused(true);*/
|
||||||
|
node.setCursor(Cursor.CLOSED_HAND);
|
||||||
|
node.setFill(Color.AZURE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
node.setOnMouseReleased(new EventHandler<MouseEvent>() {
|
||||||
|
@Override public void handle(MouseEvent mouseEvent) {
|
||||||
|
node.setCursor(Cursor.HAND);
|
||||||
|
node.setFill(Color.LIMEGREEN);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
node.setOnMouseDragged(new EventHandler<MouseEvent>() {
|
||||||
|
@Override public void handle(MouseEvent mouseEvent) {
|
||||||
|
node.setLayoutX(mouseEvent.getSceneX() + x);
|
||||||
|
node.setLayoutY(mouseEvent.getSceneY() + y);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
node.setOnMouseEntered(new EventHandler<MouseEvent>() {
|
||||||
|
@Override public void handle(MouseEvent mouseEvent) {
|
||||||
|
node.setCursor(Cursor.HAND);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch();
|
launch(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package school_project;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class Map extends Shape{
|
|
||||||
private ArrayList<Piece> pieces;
|
|
||||||
|
|
||||||
public Map(boolean[][] matrix) {
|
|
||||||
super(matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: 2/27/23 Tests for Map
|
|
||||||
public void AddShape(Piece piece){
|
|
||||||
pieces.add(piece);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package school_project;
|
|
||||||
|
|
||||||
public class Piece extends Shape{
|
|
||||||
|
|
||||||
private int x,y; // Position in the Map Object
|
|
||||||
public Piece() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Piece(boolean[][] matrix) {
|
|
||||||
super(matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rotate the matrix of the piece. Used when the player right click
|
|
||||||
*
|
|
||||||
* @param times Set the amount of time the rotation should be executed. Should be set between 1 and 3.
|
|
||||||
*/
|
|
||||||
public void RotateRight(int times){
|
|
||||||
while(times > 0) {
|
|
||||||
boolean[][] temp_matrix = new boolean[width][height];
|
|
||||||
for (int i = 0; i < width; i++) {
|
|
||||||
for (int j = 0; j < height; j++) {
|
|
||||||
temp_matrix[i][j] = matrix[-j+height-1][i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
times--;
|
|
||||||
matrix = temp_matrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package school_project;
|
|
||||||
|
|
||||||
|
|
||||||
public class Shape {
|
|
||||||
|
|
||||||
protected boolean[][] matrix;
|
|
||||||
protected int height, width;
|
|
||||||
|
|
||||||
public Shape() {
|
|
||||||
matrix = new boolean[0][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape(boolean[][] matrix){
|
|
||||||
this.setShape(matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShape(boolean[][] matrix) throws IllegalArgumentException{
|
|
||||||
height = matrix.length;
|
|
||||||
width = matrix[0].length;
|
|
||||||
|
|
||||||
for (boolean[] row: matrix){
|
|
||||||
if(row.length != width){
|
|
||||||
throw new IllegalArgumentException("The argument should be a square matrix");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.matrix = matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean[][] getShape() {
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package school_project;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
class PieceTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void rotateRight() {
|
|
||||||
boolean[][] piece1_matrix = {
|
|
||||||
{true, false, false},
|
|
||||||
{false, true, false},
|
|
||||||
{true, true, false},
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean[][] piece1_matrix_result = {
|
|
||||||
{true, false, true},
|
|
||||||
{true, true, false},
|
|
||||||
{false, false, false},
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean[][] piece2_matrix = {
|
|
||||||
{true},
|
|
||||||
{false},
|
|
||||||
{true},
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean[][] piece2_matrix_result = {
|
|
||||||
{true, false, true},
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean[][] piece3_matrix_result = {
|
|
||||||
{false, false, false},
|
|
||||||
{false, true, true},
|
|
||||||
{true, false, true},
|
|
||||||
};
|
|
||||||
|
|
||||||
Piece piece1 = new Piece();
|
|
||||||
piece1.setShape(piece1_matrix);
|
|
||||||
|
|
||||||
Piece piece2 = new Piece(piece2_matrix);
|
|
||||||
|
|
||||||
Piece piece3 = new Piece(piece1_matrix);
|
|
||||||
|
|
||||||
Piece piece4 = new Piece(piece1_matrix);
|
|
||||||
|
|
||||||
piece1.RotateRight(1);
|
|
||||||
assertArrayEquals(piece1_matrix_result, piece1.getShape());
|
|
||||||
|
|
||||||
piece2.RotateRight(1);
|
|
||||||
assertArrayEquals(piece2_matrix_result, piece2.getShape());
|
|
||||||
|
|
||||||
piece3.RotateRight(3);
|
|
||||||
assertArrayEquals(piece3_matrix_result, piece3.getShape());
|
|
||||||
|
|
||||||
piece4.RotateRight(3);
|
|
||||||
assertNotEquals(piece1_matrix_result, piece4.getShape());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package school_project;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
class ShapeTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void setShape() {
|
|
||||||
boolean[][] matrix_shape1 = {
|
|
||||||
{true, false},
|
|
||||||
{true, true},
|
|
||||||
{true, false}
|
|
||||||
};
|
|
||||||
boolean[][] matrix_shape2 = {
|
|
||||||
{true, false, true},
|
|
||||||
{true, true, true},
|
|
||||||
{true, false, true},
|
|
||||||
};
|
|
||||||
boolean[][] matrix_shape3 = {
|
|
||||||
{true, false, true},
|
|
||||||
{true, true}
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean[][] matrix_shape4 = {
|
|
||||||
{true},
|
|
||||||
{false},
|
|
||||||
{true}
|
|
||||||
};
|
|
||||||
|
|
||||||
Shape shape1 = new Shape();
|
|
||||||
shape1.setShape(matrix_shape1);
|
|
||||||
assertEquals(3, shape1.getHeight());
|
|
||||||
assertEquals(2, shape1.getWidth());
|
|
||||||
|
|
||||||
Shape shape2 = new Shape(matrix_shape2);
|
|
||||||
assertEquals(3, shape2.getHeight());
|
|
||||||
assertEquals(3, shape2.getWidth());
|
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> new Shape(matrix_shape3));
|
|
||||||
|
|
||||||
Shape shape4 = new Shape(matrix_shape4);
|
|
||||||
assertEquals(3, shape4.getHeight());
|
|
||||||
assertEquals(1, shape4.getWidth());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
82
misc/pre-commit.sh
Executable file
82
misc/pre-commit.sh
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo 'Lovely Idea';
|
||||||
|
|
||||||
|
BASE_DIR="$(dirname $(readlink -f $0))/.."
|
||||||
|
cd $BASE_DIR
|
||||||
|
echo $BASE_DIR
|
||||||
|
|
||||||
|
function clean() {
|
||||||
|
echo "Cleaning the folder"
|
||||||
|
$BASE_DIR/gradlew clean
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
echo "Building the project"
|
||||||
|
$BASE_DIR/gradlew build
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
echo "Testing the project"
|
||||||
|
$BASE_DIR/gradlew test
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
echo "Running the project"
|
||||||
|
$BASE_DIR/gradlew run &
|
||||||
|
_PID=$!
|
||||||
|
sleep 3
|
||||||
|
killpid $_PID
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_syntax() {
|
||||||
|
echo "Checking the syntax"
|
||||||
|
echo 'TODO Tonitch: check syntax script'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_archive() {
|
||||||
|
echo "Creating the archive on the parent folder"
|
||||||
|
tar --create --gzip --exclude-vcs --exclude-vcs-ignores -f ../archive.tar.gz "${BASE_DIR}/{app/, gradle/, gralew, gradlew.bat, settings.gradle}"
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
|
||||||
|
clean )
|
||||||
|
clean ;;
|
||||||
|
|
||||||
|
build )
|
||||||
|
build ;;
|
||||||
|
|
||||||
|
test )
|
||||||
|
test ;;
|
||||||
|
|
||||||
|
run )
|
||||||
|
run ;;
|
||||||
|
|
||||||
|
syntax )
|
||||||
|
check_syntax ;;
|
||||||
|
|
||||||
|
archive )
|
||||||
|
clean &&
|
||||||
|
build &&
|
||||||
|
test &&
|
||||||
|
run &&
|
||||||
|
check_syntax &&
|
||||||
|
make_archive ;;
|
||||||
|
|
||||||
|
all )
|
||||||
|
clean &&
|
||||||
|
build &&
|
||||||
|
test &&
|
||||||
|
run &&
|
||||||
|
check_syntax ;;
|
||||||
|
* )
|
||||||
|
clean &&
|
||||||
|
build &&
|
||||||
|
test &&
|
||||||
|
check_syntax ;;
|
||||||
|
esac
|
77
prototypes/cat_puzzle.py
Normal file
77
prototypes/cat_puzzle.py
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import os
|
||||||
|
import rotate_matrix
|
||||||
|
def turn_piece(piece): #based on a matrix MxN ie [(0,0),(0,0),(0,0)] m = 3 and n = 2
|
||||||
|
new_piece = rotate_matrix.clockwise(piece)
|
||||||
|
return new_piece
|
||||||
|
|
||||||
|
game = True
|
||||||
|
while game:
|
||||||
|
print('Bienvenue dans le jeu cat puzzle')
|
||||||
|
|
||||||
|
choose_level = 0
|
||||||
|
while choose_level == 0:
|
||||||
|
choose_level = input('Choissisez un niveau à résoudre\n') #choose a level of the game
|
||||||
|
try:
|
||||||
|
choose_level = int(choose_level)
|
||||||
|
except ValueError:
|
||||||
|
choose_level= 0
|
||||||
|
print('Il me faut un nombre')
|
||||||
|
if choose_level!=1:
|
||||||
|
choose_level = 0
|
||||||
|
print('Il n\'existe que le niveau 1 pour l\'instant')
|
||||||
|
|
||||||
|
print('Découvrons ensemeble le niveau',choose_level) #make a first level
|
||||||
|
|
||||||
|
if choose_level ==1: #select the level one and print it
|
||||||
|
level_one = [(1,1,1),(1,1,0),(1,1,1)]
|
||||||
|
print(level_one[0])
|
||||||
|
print(level_one[1])
|
||||||
|
print(level_one[2])
|
||||||
|
|
||||||
|
|
||||||
|
print('Voilà les pièces que vous disposez pour complèter le puzzle') #make piece for resolve the puzzle
|
||||||
|
|
||||||
|
piece_for_level = {
|
||||||
|
1:[(1,1),(1,0)],2:[(1,0),(1,0),(1,0)],3:[(1,1)]}
|
||||||
|
|
||||||
|
|
||||||
|
print('Voilà la pièce 1:') #show the piece at the player
|
||||||
|
for i in piece_for_level[1]:
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
print('Voilà la pièce 2:')
|
||||||
|
for i in piece_for_level[2]:
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
print('Voilà la pièce 3:')
|
||||||
|
for i in piece_for_level[3]:
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
choose_piece = 0
|
||||||
|
while choose_piece ==0:
|
||||||
|
choose_piece = input('Choissisez la pièce que vous voulez bouger ? ') #choice of the piece to move
|
||||||
|
try:
|
||||||
|
choose_piece = int(choose_piece)
|
||||||
|
except ValueError:
|
||||||
|
choose_piece =0
|
||||||
|
print('J\'ai besoin d\'un nombre')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
move_piece = input('Voulez vous tournez la pièce ? (o/n)\n')
|
||||||
|
if move_piece== 'o':
|
||||||
|
print('Voilà la pièce tourner')
|
||||||
|
piece_turn = turn_piece(piece_for_level[choose_piece])
|
||||||
|
for i in piece_turn:
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
m = input('A quelle ligne voulez-vous mettre la pièce ? ')
|
||||||
|
n = input("A quelle colonne voulez-vous mettre la pièce ? ")
|
||||||
|
m,n=m-1,n-1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
game=False
|
||||||
|
|
||||||
|
|
||||||
|
os.system('pause')
|
Reference in New Issue
Block a user