<commit_before>/* 
	JCavernApplet.java

	Title:			JCavern And Glen
	Author:			<NAME>
	Description:	
*/

package jcavern;

import java.awt.*;
import java.net.*;
import java.awt.event.*;
import java.applet.*;

/**
 * JCavernApplet is the launcher for the java version of cavern and glen.
 *
 * @author	<NAME>
 */
public class JCavernApplet extends Applet
{
	/** * A view of the game world */
	private WorldView			mWorldView;
	
	/** * A view of the player statistics */
	private PlayerView			mPlayerView;
	
	/** * A view of the player statistics */
	private MissionView			mMissionView;
	
	/** * A model of the game world */
	private World				mWorld;
	
	/** * The representation of the player */
	private Player				mPlayer;
	
	private static TextArea		gLogView;

	/**
	 * Creates game world, player, viewers.
	 */
	public JCavernApplet()
	{
	}
	
	public static void log(String aString)
	{
		if (gLogView != null)
		{
			gLogView.append(aString);
			gLogView.append("\n");
		}
	}

	/**
	 * Installs KeyListener for keyboard commands.
	 */
	public void start()
	{
		mWorldView.requestFocus();
        mWorldView.addKeyListener(new KeyboardCommandListener(mWorld, mWorldView, mPlayer, mMissionView));
	}

	// Get applet information
	public String getAppletInfo() 
	{
		return "JCavern 0.0, <NAME>";
	}

	// Initialize the applet
	public void init()
	{
		setBackground(Color.black);
		setForeground(Color.orange);
		setFont(new Font("Monospaced", Font.PLAIN, 12));

		System.out.println("jcavern applet document base " + getDocumentBase());

		try
		{
			MonsterFactory.loadPrototypes(new URL(getDocumentBase(), "./monster.dat"));
			Treasure.loadPrototypes(new URL(getDocumentBase(), "./treasure.dat"));
	
			// Create a player and a view of the player
			mPlayer  = new Player("Bill");
			mPlayerView = new PlayerView(mPlayer);
			mPlayer.setMission(MonsterFactory.createMission(mPlayer));
			mMissionView = new MissionView(mPlayer.getMission());
	
			// Create a world  and a view of the world
			mWorld = new World();
			mWorld.populateFor(mPlayer);
			mWorldView = new WorldView(mWorld);
	
			gLogView = new TextArea("Welome to JCavern", 5, 60, TextArea.SCROLLBARS_NONE);
			gLogView.setEditable(false);
			gLogView.setBackground(Color.black);
			gLogView.setForeground(Color.orange);
			
			mWorldView.setSize(500, 220);		
			add(mWorldView);
			mWorld.addObserver(mWorldView);
			
			mPlayerView.setSize(500, 50);		
			add(mPlayerView);
			mPlayer.addObserver(mPlayerView);
			
			mMissionView.setSize(500, 50);		
			add(mMissionView);
			mPlayer.getMission().addObserver(mMissionView);
			
			add(gLogView);
			
		}
		catch(JCavernInternalError jcie)
		{
			System.out.println("JCaverApplet.init internal error " + jcie);
		}<commit_msg>added code for loading game board images changed spacing of world view added CavernOrange added code for accessing current applet<commit_after>/* 
	JCavernApplet.java

	Title:			JCavern And Glen
	Author:			<NAME>
	Description:	
*/

package jcavern;

import java.awt.*;
import java.net.*;
import java.util.Hashtable;
import java.awt.event.*;
import java.applet.*;

/**
 * JCavernApplet is the launcher for the java version of cavern and glen.
 *
 * @author	<NAME>
 */
public class JCavernApplet extends Applet
{
	public static final Color		CavernOrange = new Color(0xFF, 0x99, 0x00);
	
	/** * A view of the game world */
	private WorldView				mWorldView;
	
	/** * A view of the player statistics */
	private PlayerView				mPlayerView;
	
	/** * A view of the player statistics */
	private MissionView				mMissionView;
	
	/** * A model of the game world */
	private World					mWorld;
	
	/** * The representation of the player */
	private Player					mPlayer;
	
	/** * A text view list of messages. */
	private static TextArea			gLogView;
	
	/** * A table of messages */
	private static Hashtable		gImages;

	private static JCavernApplet	gApplet;

	/**
	 * Creates game world, player, viewers.
	 */
	public JCavernApplet()
	{
		gImages = new Hashtable();
		gApplet = this;
	}
	
	public static void log(String aString)
	{
		if (gLogView != null)
		{
			gLogView.append(aString);
			gLogView.append("\n");
		}
	}
	
	public static JCavernApplet current()
	{
		return gApplet;
	}

	public Image getBoardImage(String aName)
	{
		return (Image) gImages.get(aName);
	}
	
	/**
	 * Installs KeyListener for keyboard commands.
	 */
	public void start()
	{
		mWorldView.requestFocus();
        mWorldView.addKeyListener(new KeyboardCommandListener(mWorld, mWorldView, mPlayer, mMissionView));
	}

	// Get applet information
	public String getAppletInfo() 
	{
		return "JCavern 0.0, <NAME>";
	}

	// Initialize the applet
	public void init()
	{
		setBackground(Color.black);
		setForeground(Color.orange);
		setFont(new Font("Monospaced", Font.PLAIN, 12));

		System.out.println("jcavern applet document base " + getDocumentBase());

		try
		{	
			// get data from server
			
			gImages.put("monster", getImage(new URL(getDocumentBase(), "bin/images/monster.gif")));
			gImages.put("player", getImage(new URL(getDocumentBase(), "bin/images/player.gif")));
			gImages.put("tree", getImage(new URL(getDocumentBase(), "bin/images/tree.gif")));
			gImages.put("tree2", getImage(new URL(getDocumentBase(), "bin/images/tree2.gif")));
			gImages.put("eyeball", getImage(new URL(getDocumentBase(), "bin/images/eyeball.gif")));

			MonsterFactory.loadPrototypes(new URL(getDocumentBase(), "bin/monster.dat"));
			Treasure.loadPrototypes(new URL(getDocumentBase(), "bin/treasure.dat"));
	
			// Create a player and a view of the player
			mPlayer  = new Player("Bill");
			mPlayerView = new PlayerView(mPlayer);
			mPlayer.setMission(MonsterFactory.createMission(mPlayer));
			mMissionView = new MissionView(mPlayer.getMission());
	
			// Create a world  and a view of the world
			mWorld = new World();
			mWorldView = new WorldView(mWorld);
	
			gLogView = new TextArea("Welome to JCavern\n", 5, 60, TextArea.SCROLLBARS_NONE);
			gLogView.setEditable(false);
			gLogView.setBackground(Color.black);
			gLogView.setForeground(CavernOrange);
			
			mWorldView.setSize(500, 300);		
			add(mWorldView);
			mWorld.addObserver(mWorldView);
			
			mPlayerView.setSize(500, 50);		
			add(mPlayerView);
			mPlayer.addObserver(mPlayerView);
			
			mMissionView.setSize(500, 50);		
			add(mMissionView);
			mPlayer.getMission().addObserver(mMissionView);
			
			add(gLogView);

			mWorld.populateFor(mPlayer);
		}
		catch(JCavernInternalError jcie)
		{
			System.out.println("JCaverApplet.init internal error " + jcie);
		}
{'fraction_non_alphanumeric': 0.12354383813611282, 'fraction_numerical': 0.008430410790925812, 'mean_word_length': 3.735123367198839, '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': '228577', 'n_tokens_mistral': 2548, 'n_tokens_neox': 2166, 'n_words': 522}