// Copyright Sven-Olof Nystrom Uppsala University 2025

class StockPile extends Pile {

    // The pile containing all cards at the start of the game.

    private ThrowPile throwPile;

    public StockPile(int x, int y, ThrowPile throwPile) {
        super(x,y);
        this.throwPile = throwPile;
    }
    
    public void click() {
        
        Card c = top();
        if (c!=null) {
            c.flip();
            throwPile.add(pop());
        }
        else {
            throwPile.turn(this);
        }
    }
}

