<commit_before>package boundary;

import controller.PlayerRestartLevelCtrl;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import model.PlayerModel;
import model.Point;

/**
 * The view when a player loads up a level.
 *
 * @author <NAME>, <NAME>, and <NAME>
 */
public class PlayerLevelView extends JPanel {
  PlayerApplication app;
  PlayerModel model;
  public PlayerBoardView boardView;
  
  JLabel lblScoreNum;
  JLabel lblCounterNum;

  /**
   * Create a level view for the player application.
   *
   * The quit listener is invoked when the quit button is clicked, indicating
   * either that the player is done playing the level, or the builder is done
   * previewing the level.
   *
   * The PlayerApplication and PlayerModel are used to create the constituent
   * views and controllers.
   *
   * @param onQuit
   * @param app
   * @param model
   */
  public PlayerLevelView(ActionListener onQuit, PlayerApplication app,
      PlayerModel model) {
    this.app = app;
    this.model = model;

    setMinimumSize(new Dimension(600, 480));
    setPreferredSize(new Dimension(600, 480));
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    //Panel Left (Game Board)

    JPanel panelLeft = new JPanel();
    panelLeft.setAlignmentY(0);
    add(panelLeft);
    panelLeft.setLayout(new BoxLayout(panelLeft, BoxLayout.X_AXIS));
    boardView = new PlayerBoardView(app, model);
    boardView.setAlignmentY(0);
    panelLeft.add(boardView);

    //Panel Controls

    JPanel panelControls = new JPanel();
    panelControls.setAlignmentY(0);
    panelLeft.add(panelControls);
    panelControls.setLayout(new BoxLayout(panelControls, BoxLayout.Y_AXIS));

    JButton btnSwap = new JButton("\u2194");
    panelControls.add(btnSwap);

    JButton btnRemove = new JButton("\u2718");
    panelControls.add(btnRemove);

    JButton btnScramble = new JButton("\u27F2");
    panelControls.add(btnScramble);

    //Panel Right

    JPanel panelRight = new JPanel();
    panelRight.setAlignmentY(0);
    add(panelRight);
    panelRight.setLayout(new BoxLayout(panelRight, BoxLayout.Y_AXIS));

    //Panel Navigation

    JPanel panelNavigation = new JPanel();
    panelNavigation.setAlignmentX(0);
    panelRight.add(panelNavigation);
    panelNavigation.setLayout(new BoxLayout(panelNavigation, BoxLayout.X_AXIS));

    JButton btnRestart = new JButton("Restart");
    btnRestart.addActionListener(new PlayerRestartLevelCtrl(app, model));
    panelNavigation.add(btnRestart);

    JButton btnMainMenu = new JButton("Quit");
    btnMainMenu.addActionListener(onQuit);
    panelNavigation.add(btnMainMenu);

    //Panel Info

    JPanel panelInfo = new JPanel();
    panelInfo.setAlignmentX(0);

    panelRight.add(panelInfo);
    panelInfo.setLayout(new BoxLayout(panelInfo, BoxLayout.Y_AXIS));

    JLabel lblScore = new JLabel("Score");
    panelInfo.add(lblScore);

    lblScoreNum = new JLabel("12345");
    panelInfo.add(lblScoreNum);

    JLabel lblCounter = new JLabel("Moves Left");
    panelInfo.add(lblCounter);

    lblCounterNum = new JLabel("20");
    panelInfo.add(lblCounterNum);
  }
  
  public void drawMove(Point curr, Point prev) {
	     int x1 = curr.x * 10;
	     int y1 = curr.y * 10;
	     int x2 = prev.x * 10;
	     int y2 = prev.y * 10;
	     
		 BufferedImage blob = app.loader.getResource("selected.png");
		 BufferedImage blob_tlc = blob.getSubimage(0, 0, blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_trc = blob.getSubimage((blob.getWidth()/3)*2, 0, blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_blc = blob.getSubimage(0,(blob.getHeight()/3)*2,blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_brc = blob.getSubimage((blob.getWidth()/3)*2, (blob.getHeight()/3)*2, blob.getWidth()/3, blob.getHeight()/3);
		 
		this.getGraphics().drawImage(blob_tlc, x1, y1, null);
		this.getGraphics().drawImage(blob_blc, x1 , y1 + (blob.getHeight()/3) * 2, null);
		this.getGraphics().drawImage(blob_trc, x1 + blob_trc.getWidth(), y1, null);
		this.getGraphics().drawImage(blob_brc, x1 + blob_brc.getWidth(), y1 + (blob.getHeight()/3) * 2, null);
  }
  
  public void update() {
	  lblScoreNum.setText(Integer.toString(model.score));
	  lblCounterNum.setText(Integer.toString(model.counter));
	  this.revalidate();
	  this.repaint();
  }
}<commit_msg>Fix score and counter not referencing the model<commit_after>package boundary;

import controller.PlayerRestartLevelCtrl;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import model.PlayerModel;
import model.Point;

/**
 * The view when a player loads up a level.
 *
 * @author <NAME>, <NAME>, and <NAME>
 */
public class PlayerLevelView extends JPanel {
  PlayerApplication app;
  PlayerModel model;
  public PlayerBoardView boardView;
  
  JLabel lblScoreNum;
  JLabel lblCounterNum;

  /**
   * Create a level view for the player application.
   *
   * The quit listener is invoked when the quit button is clicked, indicating
   * either that the player is done playing the level, or the builder is done
   * previewing the level.
   *
   * The PlayerApplication and PlayerModel are used to create the constituent
   * views and controllers.
   *
   * @param onQuit
   * @param app
   * @param model
   */
  public PlayerLevelView(ActionListener onQuit, PlayerApplication app,
      PlayerModel model) {
    this.app = app;
    this.model = model;

    setMinimumSize(new Dimension(600, 480));
    setPreferredSize(new Dimension(600, 480));
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    //Panel Left (Game Board)

    JPanel panelLeft = new JPanel();
    panelLeft.setAlignmentY(0);
    add(panelLeft);
    panelLeft.setLayout(new BoxLayout(panelLeft, BoxLayout.X_AXIS));
    boardView = new PlayerBoardView(app, model);
    boardView.setAlignmentY(0);
    panelLeft.add(boardView);

    //Panel Controls

    JPanel panelControls = new JPanel();
    panelControls.setAlignmentY(0);
    panelLeft.add(panelControls);
    panelControls.setLayout(new BoxLayout(panelControls, BoxLayout.Y_AXIS));

    JButton btnSwap = new JButton("\u2194");
    panelControls.add(btnSwap);

    JButton btnRemove = new JButton("\u2718");
    panelControls.add(btnRemove);

    JButton btnScramble = new JButton("\u27F2");
    panelControls.add(btnScramble);

    //Panel Right

    JPanel panelRight = new JPanel();
    panelRight.setAlignmentY(0);
    add(panelRight);
    panelRight.setLayout(new BoxLayout(panelRight, BoxLayout.Y_AXIS));

    //Panel Navigation

    JPanel panelNavigation = new JPanel();
    panelNavigation.setAlignmentX(0);
    panelRight.add(panelNavigation);
    panelNavigation.setLayout(new BoxLayout(panelNavigation, BoxLayout.X_AXIS));

    JButton btnRestart = new JButton("Restart");
    btnRestart.addActionListener(new PlayerRestartLevelCtrl(app, model));
    panelNavigation.add(btnRestart);

    JButton btnMainMenu = new JButton("Quit");
    btnMainMenu.addActionListener(onQuit);
    panelNavigation.add(btnMainMenu);

    //Panel Info

    JPanel panelInfo = new JPanel();
    panelInfo.setAlignmentX(0);

    panelRight.add(panelInfo);
    panelInfo.setLayout(new BoxLayout(panelInfo, BoxLayout.Y_AXIS));

    JLabel lblScore = new JLabel("Score");
    panelInfo.add(lblScore);

    lblScoreNum = new JLabel("12345");
    panelInfo.add(lblScoreNum);

    JLabel lblCounter = new JLabel("Moves Left");
    panelInfo.add(lblCounter);

    lblCounterNum = new JLabel("20");
    panelInfo.add(lblCounterNum);
    
    update();
  }
  
  public void drawMove(Point curr, Point prev) {
	     int x1 = curr.x * 10;
	     int y1 = curr.y * 10;
	     int x2 = prev.x * 10;
	     int y2 = prev.y * 10;
	     
		 BufferedImage blob = app.loader.getResource("selected.png");
		 BufferedImage blob_tlc = blob.getSubimage(0, 0, blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_trc = blob.getSubimage((blob.getWidth()/3)*2, 0, blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_blc = blob.getSubimage(0,(blob.getHeight()/3)*2,blob.getWidth()/3, blob.getHeight()/3);
		 BufferedImage blob_brc = blob.getSubimage((blob.getWidth()/3)*2, (blob.getHeight()/3)*2, blob.getWidth()/3, blob.getHeight()/3);
		 
		this.getGraphics().drawImage(blob_tlc, x1, y1, null);
		this.getGraphics().drawImage(blob_blc, x1 , y1 + (blob.getHeight()/3) * 2, null);
		this.getGraphics().drawImage(blob_trc, x1 + blob_trc.getWidth(), y1, null);
		this.getGraphics().drawImage(blob_brc, x1 + blob_brc.getWidth(), y1 + (blob.getHeight()/3) * 2, null);
  }
  
  public void update() {
	  lblScoreNum.setText(Integer.toString(model.score));
	  lblCounterNum.setText(Integer.toString(model.counter));
	  this.revalidate();
	  this.repaint();
  }
}
{'fraction_non_alphanumeric': 0.12344180915609487, 'fraction_numerical': 0.01765030336458908, 'mean_word_length': 3.9649507119386636, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2203013', 'n_tokens_mistral': 3091, 'n_tokens_neox': 2930, 'n_words': 642}