1.1 --- a/.classpath Fri Jul 13 18:45:38 2012 +0400
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,6 +0,0 @@
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 --- a/.project Fri Jul 13 18:45:38 2012 +0400
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,17 +0,0 @@
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 --- a/src/ru/bosony/icfpc/Mine.java Fri Jul 13 18:45:38 2012 +0400
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,97 +0,0 @@
7.4 -package ru.bosony.icfpc;
7.5 -
7.6 -import java.nio.file.FileVisitOption;
7.7 -import java.util.LinkedHashMap;
7.8 -import java.util.Map;
7.9 -
7.10 -import ru.bosony.icfpc.cells.Cell;
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 - private int index = 0;
7.24 -
7.25 - public Mine(int n, int m, String content)
7.26 - {
7.27 - initCellPrototypes();
7.28 -
7.29 - cells = new Cell[2][n][m];
7.30 -
7.31 - int index = 0;
7.32 -
7.33 - for(int i=0; i<n; ++i)
7.34 - for(int j=0; j<m; ++j)
7.35 - {
7.36 - cells[index][i][j] = cellPrototypes.get(content.charAt(index++));
7.37 - }
7.38 - }
7.39 -
7.40 - private Cell[][] firstBuffer()
7.41 - {
7.42 - return cells[index];
7.43 - }
7.44 -
7.45 - private Cell[][] secondBuffer()
7.46 - {
7.47 - return cells[index==0 ? 1 : 0];
7.48 - }
7.49 -
7.50 - private void swapBuffers()
7.51 - {
7.52 - index = index==0 ? 1 : 0;
7.53 - }
7.54 -
7.55 - private void initCellPrototypes()
7.56 - {
7.57 - for(Cell c : Cell.values())
7.58 - {
7.59 - cellPrototypes.put(c.getASCII(), c);
7.60 - }
7.61 - }
7.62 -
7.63 - public void print()
7.64 - {
7.65 - for(int i=0; i<cells.length; ++i)
7.66 - {
7.67 - for(int j=0; j<cells[i].length; ++j)
7.68 - {
7.69 - System.out.print(firstBuffer()[i][j]);
7.70 - }
7.71 - System.out.println();
7.72 - }
7.73 - }
7.74 -
7.75 - public void updateAfterMove()
7.76 - {
7.77 - for(int i=0; i<cells.length; ++i)
7.78 - for(int j=0; j<cells[i].length; ++j)
7.79 - {
7.80 - secondBuffer()[i][j] = firstBuffer()[i][j];
7.81 - }
7.82 -
7.83 - for(int i=1; i<cells.length-1; ++i)
7.84 - for(int j=cells[i].length-1; j>1; --j)
7.85 - {
7.86 - switch(firstBuffer()[i][j])
7.87 - {
7.88 - case ROCK:
7.89 - {
7.90 - if(firstBuffer()[i][j-1] == Cell.EMPTY)
7.91 - {
7.92 - secondBuffer()[i][j] = Cell.EMPTY;
7.93 - }
7.94 - }
7.95 - break;
7.96 - }
7.97 - }
7.98 - }
7.99 -
7.100 -}
8.1 --- a/src/ru/bosony/icfpc/Start.java Fri Jul 13 18:45:38 2012 +0400
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,11 +0,0 @@
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 --- a/src/ru/bosony/icfpc/cells/Cell.java Fri Jul 13 18:45:38 2012 +0400
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,31 +0,0 @@
9.4 -package ru.bosony.icfpc.cells;
9.5 -
9.6 -public enum Cell
9.7 -{
9.8 - ROBOT('R'),
9.9 - ROCK('*'),
9.10 - EAGHT('.'),
9.11 - WALL('#'),
9.12 - LAMBDA('\\'),
9.13 - CLOSED_LAMBDA_LIFT('L'),
9.14 - OPEN_LAMBDA_LIFT('O'),
9.15 - EMPTY(' '),
9.16 - EARTH('.');
9.17 -
9.18 - private char ASCII;
9.19 -
9.20 - private Cell(char ASCII)
9.21 - {
9.22 - this.ASCII = ASCII;
9.23 - }
9.24 -
9.25 - public char getASCII()
9.26 - {
9.27 - return ASCII;
9.28 - }
9.29 - public void setASCII(char aSCII)
9.30 - {
9.31 - ASCII = aSCII;
9.32 - }
9.33 -
9.34 -}
10.1 --- a/src/ru/bosony/icfpc/cells/CellTypes.java Fri Jul 13 18:45:38 2012 +0400
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,14 +0,0 @@
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 -}