Project

General

Profile

« Previous | Next » 

Revision 9a39aabf

Added by Leszek Koltunski over 1 year ago

Beginnings of Skewb Diamond solver.

View differences:

src/main/java/org/distorted/solvers/SolverMain.java
96 96
      SolverTablebase solver = new SolverPyraminx(mRes,mObject);
97 97
      solver.solve(screen);
98 98
      }
99
    else if( mSignature==ObjectSignatures.DIAM_2 )
100
      {
101
      SolverTablebase solver = new SolverSkewbDiamond(mRes,mObject);
102
      solver.solve(screen);
103
      }
99 104
    else
100 105
      {
101 106
      screen.displayErrorDialog(mRes.getString(R.string.solver_generic_not_implemented));
src/main/java/org/distorted/solvers/SolverSkewbDiamond.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

  
10
package org.distorted.solvers;
11

  
12
import android.content.res.Resources;
13

  
14
import org.distorted.objectlib.main.ObjectType;
15
import org.distorted.objectlib.main.TwistyObject;
16
import org.distorted.objectlib.tablebases.ImplementedTablebasesList;
17
import org.distorted.objectlib.tablebases.TablebasesAbstract;
18

  
19
///////////////////////////////////////////////////////////////////////////////////////////////////
20

  
21
public class SolverSkewbDiamond extends SolverTablebase
22
{
23
  private static final int ERROR_CORNER_FR_MISSING = -1;
24
  private static final int ERROR_CORNER_BR_MISSING = -2;
25
  private static final int ERROR_CORNER_BL_MISSING = -3;
26
  private static final int ERROR_CORNER_FL_MISSING = -4;
27
  private static final int ERROR_CORNER_TO_MISSING = -5;
28
  private static final int ERROR_CORNER_BO_MISSING = -6;
29

  
30
  private static final int ERROR_CENTER_0_MISSING = -7;
31
  private static final int ERROR_CENTER_1_MISSING = -8;
32
  private static final int ERROR_CENTER_2_MISSING = -9;
33
  private static final int ERROR_CENTER_3_MISSING = -10;
34
  private static final int ERROR_CENTER_4_MISSING = -11;
35
  private static final int ERROR_CENTER_5_MISSING = -12;
36
  private static final int ERROR_CENTER_6_MISSING = -13;
37
  private static final int ERROR_CENTER_7_MISSING = -14;
38

  
39
  private static final int ERROR_TWO_CORNERS      = -15;
40
  private static final int ERROR_TWO_CENTERS      = -16;
41
  private static final int ERROR_CORNER_TWIST     = -17;
42

  
43
  private TablebasesAbstract mSolver;
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

  
47
  public SolverSkewbDiamond(Resources res, TwistyObject object)
48
    {
49
    super(res,object);
50
    }
51

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

  
54
  public int tablebaseIndex(TwistyObject object)
55
    {
56
    return 0;
57
    }
58

  
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
61
  public String error(int index, Resources res)
62
    {
63
    switch(index)
64
      {
65
  /*
66
 private static final int ERROR_CORNER_FR_MISSING = -1;
67
  private static final int ERROR_CORNER_BR_MISSING = -2;
68
  private static final int ERROR_CORNER_BL_MISSING = -3;
69
  private static final int ERROR_CORNER_FL_MISSING = -4;
70
  private static final int ERROR_CORNER_TO_MISSING = -5;
71
  private static final int ERROR_CORNER_BO_MISSING = -6;
72

  
73
  private static final int ERROR_CENTER_0_MISSING = -7;
74
  private static final int ERROR_CENTER_1_MISSING = -8;
75
  private static final int ERROR_CENTER_2_MISSING = -9;
76
  private static final int ERROR_CENTER_3_MISSING = -10;
77
  private static final int ERROR_CENTER_4_MISSING = -11;
78
  private static final int ERROR_CENTER_5_MISSING = -12;
79
  private static final int ERROR_CENTER_6_MISSING = -13;
80
  private static final int ERROR_CENTER_7_MISSING = -14;
81

  
82
  private static final int ERROR_TWO_CORNERS      = -15;
83
  private static final int ERROR_TWO_CENTERS      = -16;
84
  private static final int ERROR_CORNER_TWIST     = -17;
85

  
86
   */
87
      }
88

  
89
    return null;
90
    }
91

  
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

  
94
  public int[][] solution(int index, Resources res)
95
    {
96
    if( mSolver==null )
97
      {
98
      mSolver = ImplementedTablebasesList.createUnpacked(ObjectType.DIAM_2);
99
      if( mSolver!=null ) mSolver.createTablebase();
100
      }
101

  
102
    return mSolver!=null ? mSolver.solution(index) : null;
103
    }
104
}  
105

  

Also available in: Unified diff