Java simple roulette game using 2 classes

broken image

The cylinder is always spun before the first shot, but it may or may not be spun after putting If the gun fires with a trigger pull, this is considered a successful suicide. Roulette by putting two bullets in a six-chamber cylinder and pulls the trigger twice. The gun is unloaded by removing all cartridges from the cylinder.Īccording to the legend, a suicidal Russian imperial military officer plays a game of Russian When the trigger is pulled the gun will fire if there is a bullet in position 0, which is justĬounterclockwise from the loading position. To randomize the cylinder's position, the cylinder is spun, which causes the cylinder to takeĪ random position from 1 to 6 chamber rotations clockwise from its starting position. The cylinder is then rotated one chamber clockwise. A cartridge containing a bullet is placed in the empty chamber.ģ. Is seen, the cylinder is rotated one chamber clockwise and the next chamberĢ. Check the first chamber to the right of the trigger for a bullet. It is loaded with the following procedure:ġ. The following is supposedly a question given to mathematics graduates seeking jobs on Wall Street:Ī revolver handgun has a revolving cylinder with six chambers for bullets. You are encouraged to solve this task according to the task description, using any language you may know.

broken image