This commit is contained in:
2023-04-04 14:03:16 +02:00
parent 7021891e9c
commit e32d4de827
111 changed files with 1928 additions and 6 deletions

View File

@@ -0,0 +1,3 @@
public class Aléatoire{
}

Binary file not shown.

View File

@@ -0,0 +1,12 @@
import java.lang.Math;
import java.util.Random;
public class Aléatoire{
public static void main(String[] args) {
double nb1;
nb1 = Math.random();
Random nb2 = new Random();
System.out.println("random propose : "+ nb1);
System.out.println("nextDouble propose : "+ nb2.nextDouble());
}
}

View File

@@ -0,0 +1,52 @@
//HORVILLE Ewen Groupe N°4
public class Grille {
private short[][] Cases = new short[7][6];
private int joueurActuel;
public Grille() {
joueurActuel = 0;
}
public void jouer(int colonne) {
if (colonne < 1 && colonne > 7) {
System.out.println("N° de colonne invalide !");
return;
}
boolean placementValide = false;
for (int i = 5; i >= 0; i--) {
if (Cases[colonne-1][i] == 0) {
Cases[colonne-1][i] = (short)(joueurActuel+1);
joueurActuel = (joueurActuel + 1) % 2;
placementValide = true;
break;
}
}
if (!placementValide) {
System.out.println("Colonne n°" + colonne + " pleine !");
}
}
@Override
public String toString() {
String str = "";
for (int x = 0; x < 6; x++) {
for (int y = 0; y < 7; y++) {
str += "";
if (Cases[y][x] == 0) str += " ";
else if (Cases[y][x] == 1) str += "";
else if (Cases[y][x] == 2) str += "";
}
str += "\n";
}
str += "┴─┴─┴─┴─┴─┴─┴─┴";
return str;
}
}

View File

@@ -0,0 +1,48 @@
public class MaGrille {
private String[][] Grille;
private int i, j, ligne, colonne, tour = 0;
public MaGrille(int li, int col) {
this.ligne = li;
this.colonne = col;
}
public MaGrille Gvide(int l, int c) {
MaGrille newGrille = new MaGrille(this.ligne, this.colonne);
String[][] grille = new String[newGrille.ligne][newGrille.colonne];
for(i=0;i<grille.length;i++) {
for(j=0;j<grille[i].length;j++) {
grille[i][j] = " ";
}
}
this.Grille = grille;
return null;
}
public String toString() {
String str = "";
for (i=0;i<Grille.length;i++) {
str += "";
for (j=0;j<Grille[i].length;j++) {
str += Grille[i][j] + "";
}
str += "\n";
}
return str + "┴─┴─┴─┴─┴─┴─┴─┴";
}
public void Jouer(int colonne) {
for (i=Grille.length-1;i>0;i--) {
if (Grille[i][colonne-1] == " ") {
if (tour%2 == 0) {
this.Grille[i][colonne-1] = "o";
tour++;
}
else {
this.Grille[i][colonne-1] = "x";
tour++;
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
public class Puissance {
public static void main(String[] args) {
MaGrille grille = new MaGrille(6, 7);
grille.Gvide(6, 7);
grille.Jouer(3);
grille.Jouer(4);
grille.Jouer(4);
grille.Jouer(6);
grille.Jouer(4);
grille.Jouer(6);
System.out.println(grille.toString());
}
}

View File

@@ -0,0 +1,15 @@
//HORVILLE Ewen Groupe N°4
public class Puissance {
public static void main(String[] args) {
Grille g = new Grille();
g.jouer(3);
g.jouer(4);
g.jouer(4);
g.jouer(6);
g.jouer(4);
g.jouer(6);
System.out.println(g);
}
}

View File

@@ -0,0 +1,292 @@
{
"_type": "Project",
"_id": "AAAAAAFF+h6SjaM2Hec=",
"name": "Untitled",
"ownedElements": [
{
"_type": "UMLModel",
"_id": "AAAAAAFF+qBWK6M3Z8Y=",
"_parent": {
"$ref": "AAAAAAFF+h6SjaM2Hec="
},
"name": "Model",
"ownedElements": [
{
"_type": "UMLClassDiagram",
"_id": "AAAAAAFF+qBtyKM79qY=",
"_parent": {
"$ref": "AAAAAAFF+qBWK6M3Z8Y="
},
"name": "Main",
"defaultDiagram": true,
"ownedViews": [
{
"_type": "UMLClassView",
"_id": "AAAAAAGHKCIlSPo2MVY=",
"_parent": {
"$ref": "AAAAAAFF+qBtyKM79qY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"subViews": [
{
"_type": "UMLNameCompartmentView",
"_id": "AAAAAAGHKCIlSfo3DSc=",
"_parent": {
"$ref": "AAAAAAGHKCIlSPo2MVY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"subViews": [
{
"_type": "LabelView",
"_id": "AAAAAAGHKCIlSfo48Ks=",
"_parent": {
"$ref": "AAAAAAGHKCIlSfo3DSc="
},
"visible": false,
"font": "Arial;13;0",
"top": -16,
"height": 13
},
{
"_type": "LabelView",
"_id": "AAAAAAGHKCIlSvo5dwo=",
"_parent": {
"$ref": "AAAAAAGHKCIlSfo3DSc="
},
"font": "Arial;13;1",
"left": 437,
"top": 255,
"width": 230,
"height": 13,
"text": "Grille"
},
{
"_type": "LabelView",
"_id": "AAAAAAGHKCIlSvo6CzE=",
"_parent": {
"$ref": "AAAAAAGHKCIlSfo3DSc="
},
"visible": false,
"font": "Arial;13;0",
"top": -16,
"width": 73.67724609375,
"height": 13,
"text": "(from Model)"
},
{
"_type": "LabelView",
"_id": "AAAAAAGHKCIlSvo7yPk=",
"_parent": {
"$ref": "AAAAAAGHKCIlSfo3DSc="
},
"visible": false,
"font": "Arial;13;0",
"top": -16,
"height": 13,
"horizontalAlignment": 1
}
],
"font": "Arial;13;0",
"left": 432,
"top": 248,
"width": 240,
"height": 25,
"stereotypeLabel": {
"$ref": "AAAAAAGHKCIlSfo48Ks="
},
"nameLabel": {
"$ref": "AAAAAAGHKCIlSvo5dwo="
},
"namespaceLabel": {
"$ref": "AAAAAAGHKCIlSvo6CzE="
},
"propertyLabel": {
"$ref": "AAAAAAGHKCIlSvo7yPk="
}
},
{
"_type": "UMLAttributeCompartmentView",
"_id": "AAAAAAGHKCIlSvo8Uko=",
"_parent": {
"$ref": "AAAAAAGHKCIlSPo2MVY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"subViews": [
{
"_type": "UMLAttributeView",
"_id": "AAAAAAGHKCJMvPpheJY=",
"_parent": {
"$ref": "AAAAAAGHKCIlSvo8Uko="
},
"model": {
"$ref": "AAAAAAGHKCJMuPpekSE="
},
"font": "Arial;13;0",
"left": 437,
"top": 278,
"width": 230,
"height": 13,
"text": "+Attribute1",
"horizontalAlignment": 0
},
{
"_type": "UMLAttributeView",
"_id": "AAAAAAGHKCMAjvpq7Tw=",
"_parent": {
"$ref": "AAAAAAGHKCIlSvo8Uko="
},
"model": {
"$ref": "AAAAAAGHKCMAffpn4Pg="
},
"font": "Arial;13;0",
"left": 437,
"top": 293,
"width": 230,
"height": 13,
"text": "+Attribute2",
"horizontalAlignment": 0
}
],
"font": "Arial;13;0",
"left": 432,
"top": 273,
"width": 240,
"height": 38
},
{
"_type": "UMLOperationCompartmentView",
"_id": "AAAAAAGHKCIlS/o9i6E=",
"_parent": {
"$ref": "AAAAAAGHKCIlSPo2MVY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"subViews": [
{
"_type": "UMLOperationView",
"_id": "AAAAAAGHKCObzvp6IIc=",
"_parent": {
"$ref": "AAAAAAGHKCIlS/o9i6E="
},
"model": {
"$ref": "AAAAAAGHKCObvPp3kUs="
},
"font": "Arial;13;0",
"left": 437,
"top": 316,
"width": 230,
"height": 13,
"text": "+Operation1()",
"horizontalAlignment": 0
}
],
"font": "Arial;13;0",
"left": 432,
"top": 311,
"width": 240,
"height": 23
},
{
"_type": "UMLReceptionCompartmentView",
"_id": "AAAAAAGHKCIlS/o+pRA=",
"_parent": {
"$ref": "AAAAAAGHKCIlSPo2MVY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"visible": false,
"font": "Arial;13;0",
"top": -8,
"width": 10,
"height": 10
},
{
"_type": "UMLTemplateParameterCompartmentView",
"_id": "AAAAAAGHKCIlTPo/W/0=",
"_parent": {
"$ref": "AAAAAAGHKCIlSPo2MVY="
},
"model": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"visible": false,
"font": "Arial;13;0",
"top": -8,
"width": 10,
"height": 10
}
],
"font": "Arial;13;0",
"containerChangeable": true,
"left": 432,
"top": 248,
"width": 240,
"height": 216,
"nameCompartment": {
"$ref": "AAAAAAGHKCIlSfo3DSc="
},
"attributeCompartment": {
"$ref": "AAAAAAGHKCIlSvo8Uko="
},
"operationCompartment": {
"$ref": "AAAAAAGHKCIlS/o9i6E="
},
"receptionCompartment": {
"$ref": "AAAAAAGHKCIlS/o+pRA="
},
"templateParameterCompartment": {
"$ref": "AAAAAAGHKCIlTPo/W/0="
}
}
]
},
{
"_type": "UMLClass",
"_id": "AAAAAAGHKCIlRfo0xPg=",
"_parent": {
"$ref": "AAAAAAFF+qBWK6M3Z8Y="
},
"name": "Grille",
"attributes": [
{
"_type": "UMLAttribute",
"_id": "AAAAAAGHKCJMuPpekSE=",
"_parent": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"name": "Attribute1",
"type": ""
},
{
"_type": "UMLAttribute",
"_id": "AAAAAAGHKCMAffpn4Pg=",
"_parent": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"name": "Attribute2",
"type": ""
}
],
"operations": [
{
"_type": "UMLOperation",
"_id": "AAAAAAGHKCObvPp3kUs=",
"_parent": {
"$ref": "AAAAAAGHKCIlRfo0xPg="
},
"name": "Operation1"
}
]
}
]
}
]
}

Binary file not shown.

View File

@@ -0,0 +1,43 @@
import javax.swing.*;
import java.awt.*;
public class CrocsCars extends JComponent{
private Image pingouin;
public CrocsCars(){
super();
this.pingouin = Toolkit.getDefaultToolkit().getImage("tuile.png");
}
@Override
protected void paintComponent(Graphics pinceau){
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()){
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.drawImage(this.pingouin, 0, 0,this);
secondPinceau.drawImage(this.pingouin, 512, 0,this);
secondPinceau.drawImage(this.pingouin, 0, 512,this);
secondPinceau.drawImage(this.pingouin, 512, 512,this);
if(this.getHeight() >= 1024){
secondPinceau.drawImage(this.pingouin, 0, 1024,this);
secondPinceau.drawImage(this.pingouin, 512, 1024,this);
if(this.getWidth() >= 1024){
secondPinceau.drawImage(this.pingouin, 1024, 1024,this);
}
if(this.getWidth() >= 1024){
secondPinceau.drawImage(this.pingouin, 1024, 0,this);
secondPinceau.drawImage(this.pingouin, 1024, 512,this);
if(this.getHeight() >= 1024){
secondPinceau.drawImage(this.pingouin, 1024, 1024,this);
}
}
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,14 @@
import javax.swing.*;
import java.awt.*;
public class Tuile{
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(1920,1080);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CrocsCars cadre = new CrocsCars();
fenetre.add(cadre);
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,29 @@
import java.awt.;
import javax.swing.;
public class TileBackground extends JComponent {
private Image tile;
private int tileScale;
public TileBackground(int tileScale, String imagePath) {
super();
this.tile = Toolkit.getDefaultToolkit().getImage(imagePath);
this.tileScale = tileScale;
}
@Override
protected void paintComponent(Graphics brush) {
Graphics newBrush = brush.create();
if (this.isOpaque()) {
newBrush.setColor(this.getBackground());
newBrush.fillRect(0, 0, this.getWidth(), this.getHeight());
}
int horizontalReps = this.getWidth() / this.tileScale + 1;
int verticalReps = this.getHeight() / this.tileScale + 1;
for (int x = 0; x < horizontalReps; x++) {
for (int y = 0; y < verticalReps; y++) {
newBrush.drawImage(this.tile, x * tileScale, y * tileScale, tileScale, tileScale, this);
}
}
}
}

View File

@@ -0,0 +1,13 @@
import javax.swing.*;
public class Tuile2 {
public static void main(String[] args) {
JFrame f = new JFrame("Tuile");
f.setLocation(150, 150);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
TileBackground tb = new TileBackground(150, "./tuile.jpg");
f.add(tb);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

View File

@@ -0,0 +1,21 @@
import java.awt.*;
import javax.swing.*;
public class Fermeture{
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(800, 800);
Oui yeet = new Oui();
while(yeet.checkVrai()!= true){
fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
fenetre.setVisible(true);
}
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.addWindowListener(yeet);
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,28 @@
import java.awt.event.*;
import javax.swing.*;
public class Oui implements WindowListener{
private int a;
public Oui(){
super();
this.a=0;
}
public void windowActivated(WindowEvent evenement){} // premier plan
public void windowClosed(WindowEvent evenement){} // après fermeture
public void windowClosing(WindowEvent evenement){} // avant fermeture
public void windowDeactivated(WindowEvent evenement){} // arrière-plan
public void windowDeiconified(WindowEvent evenement){} // restauration
public void windowOpened(WindowEvent evenement){}
public void windowIconified(WindowEvent e){
this.a=1;
}
public boolean checkVrai(){
if (this.a == 1){
return true;
}
else{
return false;
}
}
}