I think the bug is gone now. Let's focus on the features again.

I'm planning to make the machine more understandable ("live"-rotor movements etc.)
This commit is contained in:
vanitasvitae 2015-02-16 13:56:05 +01:00
parent 664f77fe9c
commit 8fecb6f7b7
3 changed files with 5 additions and 5 deletions

View File

@ -16,8 +16,8 @@ public class Enigma
private Rotor r3;
//Slot for the reflector
private Rotor reflector;
//Standard configuration (rotors 1-3, reflector A, all three rotors set to position 1)
private static final int[] STANDARD_CONFIGURATION = {1,2,3,1,1,1,1};
//Standard configuration (rotors 1-3, reflector B, all three rotors set to position 1)
private static final int[] STANDARD_CONFIGURATION = {1,2,3,2,1,1,1};
/**
* Create new Enigma with given configuration.

View File

@ -120,7 +120,7 @@ public class MainActivity extends Activity
w1.setSelection(0);
w2.setSelection(1);
w3.setSelection(2);
reversingRotor.setSelection(0);
reversingRotor.setSelection(1);
w1pos.setSelection(0);
w2pos.setSelection(0);
w3pos.setSelection(0);

View File

@ -144,7 +144,7 @@ public class Rotor
public int encryptForward(int x)
{
return this.rotor[(26+x+ringsetting)%26];
} //TODO: Verify "+ringsetting"
}
/**encrypt in backward direction (coming from the reversing rotor)
* @param x incoming character
@ -152,7 +152,7 @@ public class Rotor
*/
public int encryptBackward(int x)
{
if(this.rrotor == null) return this.rotor[(26+x+ringsetting)%26]; //TODO: Verify "+ringsetting"
if(this.rrotor == null) return this.rotor[(26+x+ringsetting)%26];
else return this.rrotor[(26+x)%26];
}