Project

General

Profile

« Previous | Next » 

Revision a505bce0

Added by Leszek Koltunski over 1 year ago

Dino6 solver: skeleton.

View differences:

src/main/java/org/distorted/solvers/SolverDino6.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.main.R;
15
import org.distorted.objectlib.main.ObjectSignatures;
16
import org.distorted.objectlib.main.TwistyObject;
17
import org.distorted.objectlib.tablebases.ImplementedTablebasesList;
18
import org.distorted.objectlib.tablebases.TablebasesAbstract;
19

  
20
///////////////////////////////////////////////////////////////////////////////////////////////////
21

  
22
public class SolverDino6 extends SolverTablebase
23
{
24
  private static final int ERROR_EDGE_MISSING  = -1;
25
  private static final int ERROR_EDGE_CANNOT   = -2;
26
  private static final int ERROR_EDGE_TWISTED  = -3;
27

  
28
  private TablebasesAbstract mSolver;
29
  private int[] mFaceColors;
30
  private int mErrorColor1, mErrorColor2;
31

  
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33

  
34
  public SolverDino6(Resources res, TwistyObject object)
35
    {
36
    super(res,object);
37
    }
38

  
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40

  
41
  public int tablebaseIndex(TwistyObject object)
42
    {
43
    int[][] edges = new int[12][2];
44
    return 0;
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48

  
49
  private int getColorIndex3(int color)
50
    {
51
    switch(color)
52
      {
53
      case 0: return R.string.color_yellow3;
54
      case 1: return R.string.color_white3;
55
      case 2: return R.string.color_blue3;
56
      case 3: return R.string.color_green3;
57
      case 4: return R.string.color_red3;
58
      case 5: return R.string.color_orange3;
59
      }
60

  
61
    return -1;
62
    }
63

  
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

  
66
  private int getColorIndex6(int color)
67
    {
68
    switch(color)
69
      {
70
      case 0: return R.string.color_yellow6;
71
      case 1: return R.string.color_white6;
72
      case 2: return R.string.color_blue6;
73
      case 3: return R.string.color_green6;
74
      case 4: return R.string.color_red6;
75
      case 5: return R.string.color_orange6;
76
      }
77

  
78
    return -1;
79
    }
80

  
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

  
83
  private String edgeMissingError(Resources res, int color0, int color1)
84
    {
85
    int j0 = getColorIndex3(color0);
86
    int j1 = getColorIndex6(color1);
87

  
88
    String c0 = res.getString(j0);
89
    String c1 = res.getString(j1);
90

  
91
    return res.getString(R.string.solver_generic_missing_edge,c0,c1);
92
    }
93

  
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

  
96
  private String edgeTwistedError(Resources res, int color0, int color1)
97
    {
98
    int j0 = getColorIndex3(color0);
99
    int j1 = getColorIndex6(color1);
100

  
101
    String c0 = res.getString(j0);
102
    String c1 = res.getString(j1);
103

  
104
    return res.getString(R.string.solver_generic_twisted_edge,c0,c1);
105
    }
106

  
107
///////////////////////////////////////////////////////////////////////////////////////////////////
108

  
109
  public String error(int index, Resources res)
110
    {
111
    switch(index)
112
      {
113
      case ERROR_EDGE_MISSING  : return edgeMissingError(res,mErrorColor1,mErrorColor2);
114
      case ERROR_EDGE_TWISTED  : return edgeTwistedError(res,mErrorColor1,mErrorColor2);
115
      case ERROR_EDGE_CANNOT   : return res.getString(R.string.solver_generic_edges_cannot);
116
      }
117

  
118
    return null;
119
    }
120

  
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

  
123
  public int[][] solution(int index, Resources res)
124
    {
125
    if( mSolver==null )
126
      {
127
      mSolver = ImplementedTablebasesList.createUnpacked(ObjectSignatures.DINO_3);
128

  
129
      if( mSolver!=null )
130
        {
131
        mSolver.createTablebase(-1);
132
        }
133
      }
134

  
135
    return mSolver!=null ? mSolver.solution(index,null) : null;
136
    }
137
}  
138

  
src/main/java/org/distorted/solvers/SolverMain.java
116 116
      SolverTablebase solver = new SolverSkewb(mRes,mObject);
117 117
      solver.solve(screen);
118 118
      }
119
    else if( mSignature==ObjectSignatures.DINO_3 )
120
      {
121
      SolverTablebase solver = new SolverDino6(mRes,mObject);
122
      solver.solve(screen);
123
      }
119 124
    else
120 125
      {
121 126
      screen.displayErrorDialog(mRes.getString(R.string.solver_generic_not_implemented));
src/main/res/values-de/strings.xml
92 92
    <string name="solver_generic_missing_corner">Die %1$s-%2$s-%3$s Ecke fehlt!</string>
93 93
    <string name="solver_generic_missing_vertex">Der %1$s-%2$s-%3$s Oktaeder fehlt!</string>
94 94
    <string name="solver_generic_missing_edge">Die %1$s-%2$s Kante fehlt!</string>
95
    <string name="solver_generic_twisted_edge">Die Kante %1$s-%2$s muss verdreht werden!</string>
95 96
    <string name="solver_generic_missing_corner2">Die %1$s-%2$s Ecke fehlt!</string>
96 97
    <string name="solver_generic_corners_cannot">Ecken können nicht verdreht werden, sodass alle Seiten einfarbig sind!</string>
97 98
    <string name="solver_generic_vertices_cannot">Oktaederstücke können nicht so verdreht werden, sodass alle Seiten einfarbig sind!</string>
99
    <string name="solver_generic_edges_cannot">Kanten können nicht verdreht werden, sodass alle Seiten einfarbig sind!</string>
98 100
    <string name="solver_generic_c_v_dont_match">Oktaederstücke und Tetraederecken passen nicht zusammen!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">Es gibt nur %1$d %2$s Facelets.</string>
src/main/res/values-es/strings.xml
92 92
    <string name="solver_generic_missing_corner">¡Falta la esquina %1$s-%2$s-%3$s!</string>
93 93
    <string name="solver_generic_missing_vertex">¡Falta el octaedro %1$s-%2$s-%3$s!</string>
94 94
    <string name="solver_generic_missing_edge">¡Falta la pieza del borde %1$s-%2$s!</string>
95
    <string name="solver_generic_twisted_edge">¡El borde %1$s-%2$s necesita ser retorcido!</string>
95 96
    <string name="solver_generic_missing_corner2">¡Falta la esquina %1$s-%2$s!</string>
96 97
    <string name="solver_generic_corners_cannot">¡Las esquinas no se pueden torcer para que todos los lados sean monocromáticos!</string>
97 98
    <string name="solver_generic_vertices_cannot">¡Las piezas octaédricas no se pueden torcer para que todos los lados sean monocromáticos!</string>
99
    <string name="solver_generic_edges_cannot">¡Los bordes no se pueden torcer para que todos los lados sean monocromáticos!</string>
98 100
    <string name="solver_generic_c_v_dont_match">¡Las piezas octaédricas y las esquinas tetraédricas no coinciden!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">Solo hay %1$d facetas %2$s.</string>
src/main/res/values-fr/strings.xml
92 92
    <string name="solver_generic_missing_corner">Coin %1$s-%2$s-%3$s manquant !</string>
93 93
    <string name="solver_generic_missing_vertex">L\'octaèdre %1$s-%2$s-%3$s manque !</string>
94 94
    <string name="solver_generic_missing_edge">La pièce de bordure %1$s-%2$s manque!</string>
95
    <string name="solver_generic_twisted_edge">Le bord %1$s-%2$s doit être tordu !</string>
95 96
    <string name="solver_generic_missing_corner2">Coin %1$s-%2$s manquant !</string>
96 97
    <string name="solver_generic_corners_cannot">Les coins ne peuvent pas être tordus afin que tous les côtés soient monochromes !</string>
97 98
    <string name="solver_generic_vertices_cannot">Les pièces octaédriques ne peuvent pas être tordues afin que tous les côtés soient monochromes !</string>
99
    <string name="solver_generic_edges_cannot">Les bords ne peuvent pas être tordus pour que tous les côtés soient monochromes !</string>
98 100
    <string name="solver_generic_c_v_dont_match">Les pièces octaédriques et les coins tétraédriques ne correspondent pas !</string>
99 101

  
100 102
    <string name="solver_cube3_error1">Il n\'y a que %1$d facettes %2$s.</string>
src/main/res/values-ja/strings.xml
92 92
    <string name="solver_generic_missing_corner">%1$s%2$s%3$sのコーナーがない!</string>
93 93
    <string name="solver_generic_missing_vertex">%1$s-%2$s-%3$s八面体がありません!</string>
94 94
    <string name="solver_generic_missing_edge">%1$s%2$sボーダーピースはありません!</string>
95
    <string name="solver_generic_twisted_edge">%1$s-%2$s エッジをねじる必要があります!</string>
95 96
    <string name="solver_generic_missing_corner2">%1$s%2$sのコーナーがない!</string>
96 97
    <string name="solver_generic_corners_cannot">すべての面がモノクロになるようにコーナーをねじることはできません。</string>
97 98
    <string name="solver_generic_vertices_cannot">すべての面が単色になるように、八面体のピースをねじることはできません。</string>
99
    <string name="solver_generic_edges_cannot">すべての面が単色になるようにエッジをねじることはできません。</string>
98 100
    <string name="solver_generic_c_v_dont_match">八面体のピースと四面体の角が一致しません!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">%2$s小顔は%1$dつだけ</string>
src/main/res/values-ko/strings.xml
91 91
    <string name="solver_generic_missing_center">%1$s 중앙이 사라졌습니다!</string>
92 92
    <string name="solver_generic_missing_corner">%1$s-%2$s-%3$s 모서리 금지!</string>
93 93
    <string name="solver_generic_missing_vertex">%1$s-%2$s-%3$s 팔면체가 없습니다!</string>
94
    <string name="solver_generic_missing_edge">%1$s%2$s 테두리 조각이 없습니다!</string>
94
    <string name="solver_generic_missing_edge">%1$s-%2$s 테두리 조각이 없습니다!</string>
95
    <string name="solver_generic_twisted_edge">%1$s-%2$s 가장자리를 꼬아야 합니다!</string>
95 96
    <string name="solver_generic_missing_corner2">%1$s-%2$s 모서리 금지!</string>
96 97
    <string name="solver_generic_corners_cannot">모든면이 단색이되도록 모서리를 비틀 수 없습니다!</string>
97 98
    <string name="solver_generic_vertices_cannot">팔면체 조각은 뒤틀릴 수 없으므로 모든면이 단색입니다!</string>
99
    <string name="solver_generic_edges_cannot">모든 면이 단색이 되도록 가장자리를 비틀 수 없습니다!</string>
98 100
    <string name="solver_generic_c_v_dont_match">팔면체 조각과 사면체 모서리가 일치하지 않습니다!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">%2$s작은 얼굴은  %1$d개뿐입니다.</string>
src/main/res/values-pl/strings.xml
92 92
    <string name="solver_generic_missing_corner">Brakuje %1$s-%2$s-%3$s rogu!</string>
93 93
    <string name="solver_generic_missing_vertex">Brakuje %1$s-%2$s-%3$s ośmiokątu!</string>
94 94
    <string name="solver_generic_missing_edge">Brakuje %1$s-%2$s krawędzi!</string>
95
    <string name="solver_generic_twisted_edge">Krawędz %1$s-%2$s musi byc obrócona!</string>
95 96
    <string name="solver_generic_missing_corner2">Brakuje %1$s-%2$s rogu!</string>
96
    <string name="solver_generic_corners_cannot">Narożników nie można skręcić tak, aby wszystkie boki były monochromatyczne!</string>
97
    <string name="solver_generic_vertices_cannot">Części ośmiościennych nie można skręcić tak, aby wszystkie boki były monochromatyczne!</string>
97
    <string name="solver_generic_corners_cannot">Narożników nie da się skręcić tak, aby wszystkie boki były monochromatyczne!</string>
98
    <string name="solver_generic_vertices_cannot">Części ośmiościennych nie da się skręcić tak, aby wszystkie boki były monochromatyczne!</string>
99
    <string name="solver_generic_edges_cannot">Krawędzi nie da się skręcić tak, aby wszystkie boki były monochromatyczne!</string>
98 100
    <string name="solver_generic_c_v_dont_match">Części ośmiościenne i czworościenne rogi nie pasują do siebie!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">Jest tylko %1$d %2$s ścian.</string>
src/main/res/values-ru/strings.xml
92 92
    <string name="solver_generic_missing_corner">Нет %1$s-%2$s-%3$s угла!</string>
93 93
    <string name="solver_generic_missing_vertex">Нет %1$s-%2$s-%3$s октаэдра!</string>
94 94
    <string name="solver_generic_missing_edge">Нет %1$s-%2$s ребра!</string>
95
    <string name="solver_generic_twisted_edge">Ребрo %1$s-%2$s нужно скрутить!</string>
95 96
    <string name="solver_generic_missing_corner2">Нет %1$s-%2$s угла!</string>
96 97
    <string name="solver_generic_corners_cannot">Углы нельзя скручивать так, чтобы все стороны были однотонными!</string>
97 98
    <string name="solver_generic_vertices_cannot">Восьмигранные фигуры нельзя скрутить так, чтобы все стороны были однотонными!</string>
99
    <string name="solver_generic_edges_cannot">Ребр нельзя скрутить так, чтобы все стороны были однотонными!</string>
98 100
    <string name="solver_generic_c_v_dont_match">Восьмигранные фигуры и четырехгранные углы не совпадают!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">Всего %1$d %2$s граней!</string>
src/main/res/values-zh-rCN/strings.xml
98 98
    <string name="solver_generic_missing_corner">没有%1$s-%2$s-%3$s的角落!</string>
99 99
    <string name="solver_generic_missing_vertex">没有%1$s-%2$s-%3$s八面体!</string>
100 100
    <string name="solver_generic_missing_edge">没有1$s-%2$s边!</string>
101
    <string name="solver_generic_twisted_edge">边缘 %1$s-%2$s 需要扭曲!</string>
101 102
    <string name="solver_generic_missing_corner2">没有%1$s-%2$s的角落!</string>
102 103
    <string name="solver_generic_corners_cannot">角不能扭曲,这样所有的面都是单色的!</string>
103 104
    <string name="solver_generic_vertices_cannot">八面体块不能扭曲,所以所有面都是单色的!</string>
105
    <string name="solver_generic_edges_cannot">边缘不能扭曲,所以所有的面都是单色的!</string>
104 106
    <string name="solver_generic_c_v_dont_match">八面体块和四面体角不匹配!</string>
105 107

  
106 108
    <string name="solver_cube3_error1">只有%1$d个%2$s小面</string>
src/main/res/values-zh-rTW/strings.xml
92 92
    <string name="solver_generic_missing_corner">沒有%1$s-%2$s-%3$s的角落!</string>
93 93
    <string name="solver_generic_missing_vertex">沒有%1$s-%2$s-%3$s八面體!</string>
94 94
    <string name="solver_generic_missing_edge">沒有1$s-%2$s邊!</string>
95
    <string name="solver_generic_twisted_edge">邊緣 %1$s-%2$s 需要扭曲!</string>
95 96
    <string name="solver_generic_missing_corner2">沒有%1$s-%2$s的角落!</string>
96 97
    <string name="solver_generic_corners_cannot">角不能扭曲,這樣所有的面都是單色的!</string>
97 98
    <string name="solver_generic_vertices_cannot">八面體塊不能扭曲,所以所有面都是單色的!</string>
99
    <string name="solver_generic_edges_cannot">邊緣不能扭曲,所以所有的面都是單色的!</string>
98 100
    <string name="solver_generic_c_v_dont_match">八面體塊和四面體角不匹配!</string>
99 101

  
100 102
    <string name="solver_cube3_error1">只有%1$d個%2$s小臉</string>
src/main/res/values/strings.xml
112 112
    <string name="solver_generic_missing_corner">The %1$s-%2$s-%3$s corner is missing!</string>
113 113
    <string name="solver_generic_missing_vertex">The %1$s-%2$s-%3$s octahedron piece is missing!</string>
114 114
    <string name="solver_generic_missing_edge">The %1$s-%2$s edge is missing!</string>
115
    <string name="solver_generic_twisted_edge">The %1$s-%2$s edge needs to be twisted!</string>
115 116
    <string name="solver_generic_missing_corner2">The %1$s-%2$s corner is missing!</string>
116 117
    <string name="solver_generic_corners_cannot">Corners cannot be twisted so that all faces are monochromatic!</string>
117 118
    <string name="solver_generic_vertices_cannot">Octahedral pieces cannot be twisted so that all faces are monochromatic!</string>
119
    <string name="solver_generic_edges_cannot">Edges cannot be twisted so that all faces are monochromatic!</string>
118 120
    <string name="solver_generic_c_v_dont_match">Octahedral pieces and tetrahedral corners do not match!</string>
119 121

  
120 122
    <string name="solver_cube3_error1">There are only %1$d %2$s facelets.</string>

Also available in: Unified diff