Project

General

Profile

Download (2.86 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / solvers / cube3 / SolverColor.java @ ac1900c3

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2008 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.solvers.cube3;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
// Names the colors of the cube facelets
24

    
25
class SolverColor
26
  {
27
  public static final int U=0;
28
  public static final int R=1;
29
  public static final int F=2;
30
  public static final int D=3;
31
  public static final int L=4;
32
  public static final int B=5;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
  public static String toString(int i)
37
    {
38
    switch(i)
39
      {
40
      case U: return "U";
41
      case R: return "R";
42
      case F: return "F";
43
      case D: return "D";
44
      case L: return "L";
45
      case B: return "B";
46
      default: return "?";
47
      }
48
    }
49

    
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

    
52
  public static int toInt(String s)
53
    {
54
	  switch(s.charAt(0))
55
      {
56
      case 'U': return U;
57
      case 'R': return R;
58
      case 'F': return F;
59
      case 'D': return D;
60
      case 'L': return L;
61
      case 'B': return B;
62
      default: return -1;
63
      }  
64
    }
65
  }
(1-1/8)