Commit 8d10692b authored by erreiip's avatar erreiip
Browse files

Add seed in PieceFactory

parent a960afa0
Loading
Loading
Loading
Loading
+85 B (5.56 KiB)

File changed.

No diff preview for this file type.

+0 −2
Changes for jeuAssemblage/src/view/component/GamePanel.java: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -10,8 +10,6 @@ import view.component.board.PieceBoard;
import view.utils.SwingUtils;

import java.awt.Graphics;
import java.awt.BorderLayout;


public class GamePanel extends JPanel {
	
+0 −1
Changes for jeuAssemblage/src/view/component/GameSummary.java: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ public class GameSummary extends JPanel {
        double paddingWidth  = this.getWidth () - (componentSize * ((xEnd - xBegin)  * 1d));
        double paddingHeight = this.getHeight() - (componentSize * ((yEnd - yBegin) * 1d));

        //TODO METTRE A JOUR LA METHODE
        Graphics2D g2d = (Graphics2D) g;
        g2d.setColor(Color.WHITE);
        int[][] matrices = this.controller.getPlayBoard();
+10 −1
Changes for piece_puzzle/src/pieces/PieceFactory.java: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
package pieces;

import java.util.Random;

import pieces.letters.*;

public class PieceFactory {

    public static final int NUMBER_PIECE = 5;
    private static Random random;

    public static void setSeed(long seed) {
        random = new Random(seed);
    }

    public static Piece createPiece() {
        int rand = (int) (Math.random() * 5);
        if ( random == null ) return null;
        
        int rand = random.nextInt(NUMBER_PIECE);
        
        switch ( rand ) {
            case 0: {