Compare commits
	
		
			4 Commits
		
	
	
		
			Brad_Graph
			...
			8d88f01c9d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						8d88f01c9d
	
				 | 
					
					
						|||
| 
						
						
							
						
						e983c5aa13
	
				 | 
					
					
						|||
| 
						
						
							
						
						498529f29a
	
				 | 
					
					
						|||
| 
						
						
							
						
						e06abe60de
	
				 | 
					
					
						
							
								
								
									
										49
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								.drone.yml
									
									
									
									
									
								
							@ -1,49 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
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
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
...
 | 
					 | 
				
			||||||
@ -3,8 +3,4 @@
 | 
				
			|||||||
# Rapports 
 | 
					# Rapports 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [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)
 | 
					 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
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,5 +1,3 @@
 | 
				
			|||||||
# 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,222 +1,32 @@
 | 
				
			|||||||
package school_project;  
 | 
					/*
 | 
				
			||||||
 | 
					 * This Java source file was generated by the Gradle 'init' task.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					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.Cursor;
 | 
					import javafx.scene.control.Button;
 | 
				
			||||||
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{
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	double x;
 | 
					 | 
				
			||||||
	double y;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	 
 | 
					 | 
				
			||||||
	public void start(Stage primaryStage) throws Exception {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		Polygon piece1 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece2 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece3 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece4 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece5 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece6 = new Polygon();
 | 
					 | 
				
			||||||
		Polygon piece7 = new Polygon();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					public class Controller extends Application {
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		 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();  
 | 
					 | 
				
			||||||
	        root.getChildren().addAll(piece2,piece1,piece3,piece4,piece5,piece6,piece7/*,....,pieceN*/);  
 | 
					 | 
				
			||||||
	        Scene scene = new Scene(root,690,650,Color.WHEAT);  
 | 
					 | 
				
			||||||
	        root.getChildren().forEach(n -> makeDraggable((Polygon) n));
 | 
					 | 
				
			||||||
	        root.getChildren().forEach(n -> rotation((Polygon) n, scene));
 | 
					 | 
				
			||||||
	        primaryStage.setScene(scene);  
 | 
					 | 
				
			||||||
	        primaryStage.setTitle("piece 1"); 
 | 
					 | 
				
			||||||
	        
 | 
					 | 
				
			||||||
	        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) {
 | 
					    @Override
 | 
				
			||||||
		 	node.setOnMousePressed(new EventHandler<MouseEvent>() {
 | 
					    public void start(Stage primaryStage) throws Exception {
 | 
				
			||||||
			  @Override public void handle(MouseEvent mouseEvent) {
 | 
					        primaryStage.setTitle("test");
 | 
				
			||||||
			    // record a (x,y) distance for the drag and drop operation.
 | 
					        Button btn = new Button("test");
 | 
				
			||||||
			    x = node.getLayoutX() - mouseEvent.getSceneX();
 | 
					        btn.setOnAction(event -> System.out.println("hey"));
 | 
				
			||||||
			    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);
 | 
					 | 
				
			||||||
			  }
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		 }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					        Group root = new Group();
 | 
				
			||||||
	public static void main(String[] args) {  
 | 
					        root.getChildren().add(btn);
 | 
				
			||||||
        launch(args);  
 | 
					
 | 
				
			||||||
 | 
					        Scene scene = new Scene(root, 300,300);
 | 
				
			||||||
 | 
					        primaryStage.setScene(scene);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        primaryStage.show();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
 | 
					       launch();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										20
									
								
								app/src/main/java/school_project/Map.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								app/src/main/java/school_project/Map.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										31
									
								
								app/src/main/java/school_project/Piece.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								app/src/main/java/school_project/Piece.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					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;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										40
									
								
								app/src/main/java/school_project/Shape.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								app/src/main/java/school_project/Shape.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										60
									
								
								app/src/test/java/school_project/PieceTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								app/src/test/java/school_project/PieceTest.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					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());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										48
									
								
								app/src/test/java/school_project/ShapeTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								app/src/test/java/school_project/ShapeTest.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					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
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
								
							
										
											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-7.6-bin.zip
 | 
					distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
 | 
				
			||||||
networkTimeout=10000
 | 
					networkTimeout=10000
 | 
				
			||||||
zipStoreBase=GRADLE_USER_HOME
 | 
					zipStoreBase=GRADLE_USER_HOME
 | 
				
			||||||
zipStorePath=wrapper/dists
 | 
					zipStorePath=wrapper/dists
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
 | 
				
			|||||||
    case $MAX_FD in #(
 | 
					    case $MAX_FD in #(
 | 
				
			||||||
      max*)
 | 
					      max*)
 | 
				
			||||||
        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
 | 
					        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
 | 
				
			||||||
        # shellcheck disable=SC3045 
 | 
					        # shellcheck disable=SC3045
 | 
				
			||||||
        MAX_FD=$( ulimit -H -n ) ||
 | 
					        MAX_FD=$( ulimit -H -n ) ||
 | 
				
			||||||
            warn "Could not query maximum file descriptor limit"
 | 
					            warn "Could not query maximum file descriptor limit"
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
 | 
				
			|||||||
      '' | soft) :;; #(
 | 
					      '' | soft) :;; #(
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
 | 
					        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
 | 
				
			||||||
        # shellcheck disable=SC3045 
 | 
					        # shellcheck disable=SC3045
 | 
				
			||||||
        ulimit -n "$MAX_FD" ||
 | 
					        ulimit -n "$MAX_FD" ||
 | 
				
			||||||
            warn "Could not set maximum file descriptor limit to $MAX_FD"
 | 
					            warn "Could not set maximum file descriptor limit to $MAX_FD"
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
 | 
				
			|||||||
@ -1,82 +0,0 @@
 | 
				
			|||||||
#!/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
 | 
					 | 
				
			||||||
@ -1,77 +0,0 @@
 | 
				
			|||||||
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