Commit ff90c2ff authored by christof@ilja.athome.local's avatar christof@ilja.athome.local Committed by Christof Musik

initial ci

parents
interface Block {
public static final int NONE = 0;
public static final int FIXED = 1;
public static final int MOVEABLE = 2;
public static final int TARGET = 3;
public static final int MOVEABLE_ON_TARGET = 4;
public static final int CURSOR = 5;
public static final int CURSOR_ON_TARGET = 6;
public static final int OUT_SPACE = 7;
}
\ No newline at end of file
import java.util.*;
import java.io.*;
class HighScoreItem implements Comparable, Serializable{
private int score;
private int movements;
private int pushes;
private String name;
private GregorianCalendar date;
public HighScoreItem () {
}
public HighScoreItem (String n, int s, int m, int p) {
score = s;
name = n;
movements = m;
pushes = p;
date = new GregorianCalendar();
}
public String toString() {
return score+"\t"+name+"\t"+date;
}
public int getScore() {
return score;
}
public String getName() {
return name;
}
public String getDate() {
String s = date.get(Calendar.YEAR)+"/"+(date.get(Calendar.MONTH)+1)+"/"+date.get(Calendar.DATE);
return s;
}
public String getTooltipText() {
String s = "Movements: "+movements+" Pushes: "+pushes+" set on "+getDate();
return s;
}
public int compareTo(Object o) {
if (((HighScoreItem)o).getScore()==score) return 0;
else if (((HighScoreItem)o).getScore() > score) return 1;
else if (((HighScoreItem)o).getScore() < score) return -1;
return 0;
}
}
\ No newline at end of file
import java.util.*;
import java.io.*;
class HighScores implements Serializable{
private int level;
private int max_items;
private TreeMap scores = new TreeMap();
public HighScores(int level, int max) {
this.level = level;
max_items = max;
}
public void add (HighScoreItem item) {
scores.put(new Integer(item.getScore()), item);
if (scores.size() > max_items) scores.remove(scores.lastKey());
}
public void add (int m, String s, GregorianCalendar gc) {
//add(new HighScoreItem(s,m, playfield.movements, playfield.pushes));
}
}
class LevelNotFoundException extends Exception {
public LevelNotFoundException() {
super("Level not found!");
}
public LevelNotFoundException(String s) {
super(s);
}
}
\ No newline at end of file
Manifest-Version: 1.0
Created-By: 1.4.1 (Blackdown Java-Linux Team)
Main-Class: Sokoban
This diff is collapsed.
This diff is collapsed.
import java.io.*;
import javax.swing.filechooser.FileFilter;
class SokobanFileFilter extends FileFilter {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = getExtension(f);
if (extension != null && extension.equals("sok")) {
return true;
} else {
return false;
}
//~ return false;
}
public String getDescription() {
return "Sokoban Saved Games";
}
public static String getExtension(File f) {
String ext = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i+1).toLowerCase();
}
return ext;
}
}
\ No newline at end of file
T1.gif

1.84 KB

import java.awt.*;
import java.io.*;
class UndoMove implements Serializable{
public Point cursor;
public Point newblock;
public Point oldblock;
public int newtype;
public int oldtype;
public boolean blockmoved = false;
public UndoMove(int x, int y) {
cursor = new Point (x,y);
blockmoved = false;
}
public UndoMove(Point p) {
cursor = p;
blockmoved = false;
}
public UndoMove(Point p, Point nb, Point ob, int ot, int nt) {
cursor = p;
blockmoved = true;
oldblock = ob;
newblock = nb;
oldtype = ot;
newtype = nt;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment