Results 1 to 5 of 5
  1. #1
    SrJustEasy is offline Member
    Join Date
    Dec 2016
    Posts
    5
    Rep Power
    0

    Default Enigma machine - any tips?

    Hi guys,
    I want to make a project with a simulator of an enigma machine, the one used in the world war 2, but i actually don't know where to begin, because i don't know java very well.
    Here's how it works : https://en.wikipedia.org/wiki/Enigma_machine

    In particular, having an array like that char[] sRotor = {'G','N','U','A','H','O','V','B','I','P','W','C',' J','Q','X','D','K','R','Y','E','L','S','Z','F','M' ,'T'};, how can i say, in few codes, if a letter is x, turn it into y, if a letter is z, turn it into t... This for all the letters, creating like pairs.

    Then, talking about the rotors, when someone presses a letter, the first rotor should move, changing completely the code; when the first rotor changes from 26 (the last letter of the alphabet) to 1, the second rotor should move. Obviously, the same for the second and the third rotor. How can i write that?

    Excuse me for my english, i'm italian :)
    Thanks so much!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,967
    Rep Power
    32

    Default Re: Enigma machine - any tips?

    How can i write that?
    Spend some more time designing the details of the program before trying to write it.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    ShadowWalker is offline Senior Member
    Join Date
    Mar 2013
    Location
    Greece
    Posts
    183
    Rep Power
    7

    Default Re: Enigma machine - any tips?

    because i don't know java very well.
    What exactly do you know? Do you know how to take user's input? initialize variables? manipulate Strings? Also knowing how the characters are stored and some information about ASCII code would be very useful here.

    Give us what you have already done (code) and where did you stack and we will be able to help you.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Enigma machine - any tips?

    First, if this were advanced java you wouldn't be doing it (by your own words). In any event, it will take more than a few lines of code to do this. But the first thing you need to do is to fully understand how the enigma machine worked. This is best done by working thru examples by hand using paper and pencil.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Enigma machine - any tips?

    These link have examples you might be looking for to get you started. Maybe even peek at the code for inspiration.

    https://codereview.stackexchange.com...ine-simulation
    https://github.com/amirbawab/Enigma-machine-simulator
    https://github.com/mww/enigma-java
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Tips for doing this better?
    By theunlockeRRR in forum New To Java
    Replies: 6
    Last Post: 08-15-2016, 02:39 PM
  2. Any tips on building online 2d game? (Just tips)
    By Lionlev in forum Networking
    Replies: 0
    Last Post: 10-16-2012, 12:56 AM
  3. Why JVM varies machine to machine?
    By vivekjan17 in forum New To Java
    Replies: 4
    Last Post: 02-27-2012, 11:56 AM
  4. Replies: 0
    Last Post: 02-07-2011, 01:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •