Jeu de cartes

Signaler
-
Bonjour,
Je dois réalisé un jeu de 52 cartes avec une table 1D.
Le but est de créer le jeu suivant :
Lorsqu'un joueur pose une carte, par exemple le 5, le joueurs suivant peut poser soit un 4 à droite du 5, soit un 6 à gauche.
Cependant, je ne suis vraiment pas compétent en Java, ce qui fait que je me suis vite perdu dans ce que j'ai fait et je finis par ne plus savoir où je veux aller.
Est-ce que vous pourriez m'aider s'il vous plaît ?

Voici mes lignes de code:
- Carte
public class Card {

	   private String value;
	   private String color;
	   public final int J = 11;
	   public final int Q = 12;
	   public final int K = 13;
	   public final int A = 14;
		
	public Card(String color, String value) {
		this.color = color;
		this.value = value;
	 }
	
	 public String getValue()
	   {
	      return this.value;
	   }
	 

	   public String getColor()
	   {
	      return this.color;
	   }

	   @Override
	   public String toString()
	   {
	      return this.value + " of " + this.color;
	   }
}


- Paquet de cartes

public class Deck {
	
	    private ArrayList<Card> Deck;
	    static public final String[] NAME_COLOR = {"Spades", "Diamonds", "Treas", "Hearts"};
	    static public final String[] NAME_VALUE = {"2", "3", "4","5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
	    Color color;
	    int value;
	        
	    
	public void New_deck(){
		
	this.Deck = new ArrayList<Card>();          
        for (String color : NAME_COLOR) {
    	    for (String value : NAME_VALUE) {
			Deck.add(new Card(color, value));
    	    }
    	}
	}
}


- Joueur
public class Player {
	
    int Players_number;
    int Cards_number = 52;
    private String name;
    private ArrayList<Card> hand;
    private ArrayList<Player> players;
    
    public Player(String name) {
    	this.name = name;
    	this.hand = new ArrayList<Card>();
        }
    
    public String getName(){
    	return this.name;
        }

	public void player_number(){
	    Scanner Sc_Players = new Scanner(System.in);
	    System.out.println("How many players ?");
	    int Players_number = Sc_Players.nextInt();       
	    System.out.println("The game starts with " + Cards_number + "cards and " + Players_number + "players. Let's go ! ");
	    Sc_Players.close();
	    this.players = new ArrayList<Player>();
	}

	 public void add(Card card) {
			this.hand.add(card);
	 }
	 
	 @Override
	    public String toString(){
		String s = name + " it's your turn, your hand is :\n";
		for (Card card : hand)
		    s += card + "\n";
		return s;
	    }
}


- Jeu de cartes
enum Color {SPADES, TREES, HEARTS, DIAMONDS}

public class CardGame {
	
    static public final String[] NAME_COLOR = {"Spades", "Diamonds", "Treas", "Hearts"};
    static public final String[] NAME_VALUE = {"2", "3", "4","5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
    public final int J = 11;
    public final int Q = 12;
    public final int K = 13;
    public final int A = 14;
    int Cards_number = 52;
    private ArrayList<Card> table;
    private Deck deck1;
    private ArrayList<Player> players;
    private Scanner scan;
    private Player player;
    private ArrayList<Card> deck;
    
   
    public CardGame(){
    	this.deck1 = new Deck();
    	this.scan = new Scanner(System.in);
    	this.table = new ArrayList<Card>();
    	player.player_number();
        }
    
 
    
    public void distribute(ArrayList<Player> players) {
        ArrayList <Integer> Deck = new ArrayList <Integer> (Cards_number);                        
        int length = 0;
        while (length < Cards_number){
            int n = (int) (Math.random() * Cards_number);
            if (!Deck.contains(n)) 
                Deck.add(n);
                length += 1;
            }
        }
    
    public void dealDeck(){
    	this.distribute(this.players);
        }
    

    @Override
    public String toString(){
	String s = "";
	for (Card card : deck)
	    s += card + "\n";
	return s;
    }
}


Comme vous pouvez le voir c'est un peu brouillon ...