wongzlll
Posts: 5
Joined: Fri Mar 01, 2019 2:51 pm

Battleship game

Sat Mar 23, 2019 5:07 pm

Hi,

I am working on a project on a battleship game.

Requirement:

File handling:
A file is used to store user information to simulate register and login function.

Once the program starts
 New user registration: enter user name (make sure it is unique), date of birth, password to store in the file

String operation
The password must meet the following common criteria:
• The length of the password is more than 8 characters
• At least one upper case letter
• At least one lower case letter
• At least one digit
• At least one special symbol (punctuation)
• Cannot contain user name

Exception handling for file operation
If the file cannot be found, need handle the exception. E.g., New text file will be created if there is no pre-existing file.

Existing user needs enter user name and password to login. User name and password must match the one stored in the file to login. The users can try three times before the account is locked. Once the account is locked, the user has to answer question to activate the account, in our system, the question is date of birth.

For the creating new username and password, how do i go about doing to fit the criteria as shown above?

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Battleship game

Sat Mar 23, 2019 5:25 pm

Does your homework assignment specify what programming language is to be used for your project?

wongzlll
Posts: 5
Joined: Fri Mar 01, 2019 2:51 pm

Re: Battleship game

Sat Mar 23, 2019 6:11 pm

B.Goode wrote:
Sat Mar 23, 2019 5:25 pm
Does your homework assignment specify what programming language is to be used for your project?
python

Andyroo

Re: Battleship game

Sat Mar 23, 2019 6:40 pm

I’ll not give code examples but a few pointers to help :lol:

For the password checks, you could ether code each check the hard way using loops or look at the regex functions of the match function.

For checking files and handling the errors look at the try except functions

As for the date of birth check - consider 8th October 1965 and 10/8/65 and 8/10/1965 and 08/10/65 or even 8-10-65
They are all correct ways of entering the date depending on where you live etc!

Return to “Python”