mine
authoraxmet
Fri, 13 Jul 2012 18:13:05 +0400
changeset 080446fa5641a
child 1 f83e1e778061
mine
.classpath
.project
bin/ru/bosony/icfpc/Mine.class
bin/ru/bosony/icfpc/Start.class
bin/ru/bosony/icfpc/cells/Cell.class
bin/ru/bosony/icfpc/cells/CellTypes.class
src/ru/bosony/icfpc/Mine.java
src/ru/bosony/icfpc/Start.java
src/ru/bosony/icfpc/cells/Cell.java
src/ru/bosony/icfpc/cells/CellTypes.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.classpath	Fri Jul 13 18:13:05 2012 +0400
     1.3 @@ -0,0 +1,6 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<classpath>
     1.6 +	<classpathentry kind="src" path="src"/>
     1.7 +	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     1.8 +	<classpathentry kind="output" path="bin"/>
     1.9 +</classpath>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/.project	Fri Jul 13 18:13:05 2012 +0400
     2.3 @@ -0,0 +1,17 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<projectDescription>
     2.6 +	<name>icfpc-2012</name>
     2.7 +	<comment></comment>
     2.8 +	<projects>
     2.9 +	</projects>
    2.10 +	<buildSpec>
    2.11 +		<buildCommand>
    2.12 +			<name>org.eclipse.jdt.core.javabuilder</name>
    2.13 +			<arguments>
    2.14 +			</arguments>
    2.15 +		</buildCommand>
    2.16 +	</buildSpec>
    2.17 +	<natures>
    2.18 +		<nature>org.eclipse.jdt.core.javanature</nature>
    2.19 +	</natures>
    2.20 +</projectDescription>
     3.1 Binary file bin/ru/bosony/icfpc/Mine.class has changed
     4.1 Binary file bin/ru/bosony/icfpc/Start.class has changed
     5.1 Binary file bin/ru/bosony/icfpc/cells/Cell.class has changed
     6.1 Binary file bin/ru/bosony/icfpc/cells/CellTypes.class has changed
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/ru/bosony/icfpc/Mine.java	Fri Jul 13 18:13:05 2012 +0400
     7.3 @@ -0,0 +1,59 @@
     7.4 +package ru.bosony.icfpc;
     7.5 +
     7.6 +import java.util.LinkedHashMap;
     7.7 +import java.util.Map;
     7.8 +
     7.9 +import ru.bosony.icfpc.cells.Cell;
    7.10 +import ru.bosony.icfpc.cells.CellTypes;
    7.11 +
    7.12 +/**
    7.13 + * Шахта
    7.14 + * 
    7.15 + * @author akhmetovlz
    7.16 + *
    7.17 + */
    7.18 +public class Mine
    7.19 +{
    7.20 +	private Map<Character, Cell> cellPrototypes = new LinkedHashMap<Character, Cell>();
    7.21 +	
    7.22 +	private Cell cells[][];
    7.23 +	
    7.24 +	public Mine(int n, int m, String content)
    7.25 +	{
    7.26 +		initCellPrototypes();
    7.27 +		
    7.28 +		cells = new Cell[n][m];
    7.29 +		
    7.30 +		int index = 0;
    7.31 +		
    7.32 +		for(int i=0; i<n; ++i)
    7.33 +		for(int j=0; j<m; ++j)
    7.34 +		{
    7.35 +			cells[i][j] = new Cell( cellPrototypes.get(content.charAt(index++)) );
    7.36 +		}
    7.37 +	}
    7.38 +	
    7.39 +	private void initCellPrototypes()
    7.40 +	{
    7.41 +		cellPrototypes.put('*', new Cell(CellTypes.ROCK, '*'));
    7.42 +		cellPrototypes.put('\\', new Cell(CellTypes.LAMBDA, '\\'));
    7.43 +		cellPrototypes.put('#', new Cell(CellTypes.WALL, '#'));
    7.44 +		cellPrototypes.put('R', new Cell(CellTypes.ROBOT, 'R'));
    7.45 +		cellPrototypes.put('L', new Cell(CellTypes.CLOSED_LAMBDA_LIFT, 'L'));
    7.46 +		cellPrototypes.put('O', new Cell(CellTypes.OPEN_LAMBDA_LIFT, 'O'));
    7.47 +		cellPrototypes.put(' ', new Cell(CellTypes.SPACE, ' '));
    7.48 +		cellPrototypes.put('.', new Cell(CellTypes.EARTH, '.'));
    7.49 +	}	
    7.50 +
    7.51 +	void print()
    7.52 +	{
    7.53 +		for(int i=0; i<cells.length; ++i)
    7.54 +		{
    7.55 +			for(int j=0; j<cells[i].length; ++j)
    7.56 +			{
    7.57 +				System.out.print(cells[i][j].getASCII());
    7.58 +			}
    7.59 +			System.out.println();
    7.60 +		}
    7.61 +	}
    7.62 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/ru/bosony/icfpc/Start.java	Fri Jul 13 18:13:05 2012 +0400
     8.3 @@ -0,0 +1,11 @@
     8.4 +package ru.bosony.icfpc;
     8.5 +
     8.6 +public class Start
     8.7 +{
     8.8 +	public static void main(String[] args)
     8.9 +	{
    8.10 +		String content = "################***...R......##***... ...*..##\\\\\\... ..\\\\\\.##...... ...*..##..     .. ...##.... .... ...##.... .... ...##.. .       ..##..*. .. .....##.... .. .....##.\\.. .......*##.............##.........   .##############L#";
    8.11 +		Mine mine = new Mine(15, 15, content);
    8.12 +		mine.print();
    8.13 +	}
    8.14 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/ru/bosony/icfpc/cells/Cell.java	Fri Jul 13 18:13:05 2012 +0400
     9.3 @@ -0,0 +1,39 @@
     9.4 +package ru.bosony.icfpc.cells;
     9.5 +
     9.6 +public class Cell
     9.7 +{
     9.8 +	
     9.9 +	private CellTypes type;
    9.10 +	private char ASCII;
    9.11 +	
    9.12 +	public Cell(CellTypes type, char ASCII)
    9.13 +	{
    9.14 +		this.type = type;
    9.15 +		this.ASCII = ASCII;
    9.16 +	}
    9.17 +	
    9.18 +	public Cell(Cell cell)
    9.19 +	{
    9.20 +		this.type = cell.type;
    9.21 +		this.ASCII = cell.ASCII;
    9.22 +	}
    9.23 +	
    9.24 +	public CellTypes getType()
    9.25 +	{
    9.26 +		return type;
    9.27 +	}
    9.28 +	public void setType(CellTypes type)
    9.29 +	{
    9.30 +		this.type = type;
    9.31 +	}
    9.32 +	
    9.33 +	public char getASCII()
    9.34 +	{
    9.35 +		return ASCII;
    9.36 +	}
    9.37 +	public void setASCII(char aSCII)
    9.38 +	{
    9.39 +		ASCII = aSCII;
    9.40 +	}
    9.41 +	
    9.42 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/ru/bosony/icfpc/cells/CellTypes.java	Fri Jul 13 18:13:05 2012 +0400
    10.3 @@ -0,0 +1,14 @@
    10.4 +package ru.bosony.icfpc.cells;
    10.5 +
    10.6 +public enum CellTypes
    10.7 +{
    10.8 +	ROBOT,
    10.9 +	ROCK,
   10.10 +	EAGHT,
   10.11 +	WALL,
   10.12 +	LAMBDA,
   10.13 +	CLOSED_LAMBDA_LIFT,
   10.14 +	OPEN_LAMBDA_LIFT,
   10.15 +	SPACE,
   10.16 +	EARTH
   10.17 +}