Project

General

Profile

« Previous | Next » 

Revision f6e46300

Added by Leszek Koltunski over 3 years ago

Progress with any size Kilominx.

View differences:

src/main/java/org/distorted/objects/TwistyKilominx.java
48 48

  
49 49
///////////////////////////////////////////////////////////////////////////////////////////////////
50 50

  
51
  int getNumStickerTypes(int numLayers)
51
  private int numCubitsPerCorner(int numLayers)
52 52
    {
53
    return 1;
53
    return 3*((numLayers-3)/2)*((numLayers-5)/2) + (numLayers>=5 ? 1 : 0);
54 54
    }
55 55

  
56 56
///////////////////////////////////////////////////////////////////////////////////////////////////
57 57

  
58
  float[] getCuts(int numLayers)
58
  private int numCubitsPerEdge(int numLayers)
59 59
    {
60
    return new float[] { -0.5f , 0.5f };
60
    return numLayers<5 ? 0 : numLayers-4;
61 61
    }
62 62

  
63 63
///////////////////////////////////////////////////////////////////////////////////////////////////
64 64

  
65
  float[][] getCubitPositions(int numLayers)
65
  int getNumStickerTypes(int numLayers)
66 66
    {
67
    return CORNERS;
67
    return numLayers == 3 ? 1 : numLayers/2 + 1;
68 68
    }
69 69

  
70 70
///////////////////////////////////////////////////////////////////////////////////////////////////
......
75 75
    }
76 76

  
77 77
///////////////////////////////////////////////////////////////////////////////////////////////////
78
// TODO
79

  
80
  float[] getCuts(int numLayers)
81
    {
82
    return new float[] { -0.5f , 0.5f };
83
    }
84

  
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86
// TODO
87

  
88
  float[][] getCubitPositions(int numLayers)
89
    {
90
    return CORNERS;
91
    }
92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94
// TODO
78 95

  
79 96
  private int getQuat(int cubit)
80 97
    {
......
82 99
    }
83 100

  
84 101
///////////////////////////////////////////////////////////////////////////////////////////////////
102
// TODO
85 103

  
86 104
  MeshBase createCubitMesh(int cubit, int numLayers)
87 105
    {
......
95 113
    }
96 114

  
97 115
///////////////////////////////////////////////////////////////////////////////////////////////////
116
// TODO
98 117

  
99 118
  int getFaceColor(int cubit, int cubitface, int numLayers)
100 119
    {
......
102 121
    }
103 122

  
104 123
///////////////////////////////////////////////////////////////////////////////////////////////////
124
// TODO
105 125

  
106 126
  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
107 127
    {
......
126 146

  
127 147
///////////////////////////////////////////////////////////////////////////////////////////////////
128 148
// PUBLIC API
129
// The Kilominx is solved if and only if:
130
//
131
// All cubits are rotated with the same quat.
132 149

  
133 150
  public boolean isSolved()
134 151
    {
135
    int q = CUBITS[0].mQuatIndex;
152
    int index = CUBITS[0].mQuatIndex;
136 153

  
137
    for(int i=0; i<NUM_CUBITS; i++)
154
    for(int i=1; i<NUM_CUBITS; i++)
138 155
      {
139
      if( CUBITS[i].mQuatIndex != q ) return false;
156
      if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
140 157
      }
141 158

  
142 159
    return true;
......
146 163

  
147 164
  public int getObjectName(int numLayers)
148 165
    {
149
    return R.string.minx2;
166
    if( numLayers==3 ) return R.string.minx2;
167
    if( numLayers==5 ) return R.string.minx4;
168

  
169
    return 0;
150 170
    }
151 171

  
152 172
///////////////////////////////////////////////////////////////////////////////////////////////////
153 173

  
154 174
  public int getInventor(int numLayers)
155 175
    {
156
    return R.string.minx2_inventor;
176
    if( numLayers==3 ) return R.string.minx2_inventor;
177
    if( numLayers==5 ) return R.string.minx4_inventor;
178

  
179
    return 0;
157 180
    }
158 181

  
159 182
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyMegaminx.java
586 586
  public int getObjectName(int numLayers)
587 587
    {
588 588
    if( numLayers==3 ) return R.string.minx3;
589
    if( numLayers==5 ) return R.string.minx4;
589
    if( numLayers==5 ) return R.string.minx5;
590 590

  
591 591
    return 0;
592 592
    }
......
596 596
  public int getInventor(int numLayers)
597 597
    {
598 598
    if( numLayers==3 ) return R.string.minx3_inventor;
599
    if( numLayers==5 ) return R.string.minx4_inventor;
599
    if( numLayers==5 ) return R.string.minx5_inventor;
600 600

  
601 601
    return 0;
602 602
    }
src/main/res/values/strings.xml
91 91
    <string name="din43" translatable="false">Dino Cube (4 color)</string>
92 92
    <string name="minx2" translatable="false">Kilominx</string>
93 93
    <string name="minx3" translatable="false">Megaminx</string>
94
    <string name="minx4" translatable="false">Gigaminx</string>
94
    <string name="minx4" translatable="false">Master Kilominx</string>
95
    <string name="minx5" translatable="false">Gigaminx</string>
95 96

  
96 97
    <string name="bandaged_fused"  translatable="false">Fused Cube</string>
97 98
    <string name="bandaged_2bar"   translatable="false">2Bar Cube</string>
......
117 118
    <string name="din43_inventor" translatable="false">Robert Webb, 1985</string>
118 119
    <string name="minx2_inventor" translatable="false">Thomas de Bruin, 2008</string>
119 120
    <string name="minx3_inventor" translatable="false">Ferenc Szlivka, 1982</string>
120
    <string name="minx4_inventor" translatable="false">Tyler Fox, 2006</string>
121
    <string name="minx4_inventor" translatable="false">David Gugl, 2010</string>
122
    <string name="minx5_inventor" translatable="false">Tyler Fox, 2006</string>
121 123

  
122 124
    <string name="bandaged_fused_inventor"  translatable="false">who knows</string>
123 125
    <string name="bandaged_2bar_inventor"   translatable="false">who knows</string>

Also available in: Unified diff