Qbasicnews.com
November 14, 2019, 04:05:06 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Password program  (Read 5604 times)
oracle
*/-\*
*****
Posts: 3652



WWW
« on: May 15, 2003, 08:10:36 PM »

If you guys have seen the passwords and asterisks (*) topic you'll know what this is about... Create the best password program. It should display characters as stars. This will probably be too easy for most, so make it as graphically pleasing as you can. Use screen 12 etc, include the mouse for bonus points etc. If you think the code is too long then pm it to me.
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: May 15, 2003, 08:20:15 PM »

like this?

Code:
CLS
DO
p$ = ""
DO WHILE p$ = ""
p$ = INKEY$
IF p$ = " " THEN b = 1
IF p$ = CHR$(13) THEN done = 1
IF p$ = CHR$(8) THEN
 IF LEN(pass$) <> 0 THEN
  MID$(pass$, LEN(pass$), 1) = " "
  MID$(a$, LEN(a$), 1) = " "
 END IF
 b = 1
 LOCATE 1, 1: PRINT a$;
END IF

LOOP
 pass$ = RTRIM$(pass$)
 a$ = RTRIM$(a$)
 IF done = 0 AND b = 0 THEN pass$ = pass$ + p$
 IF done = 0 AND b = 0 THEN a$ = a$ + "*"
 LOCATE 1, 1: PRINT a$;
 b = 0
LOOP UNTIL done = 1
PRINT
PRINT pass$


After typing hit enter
It then prints it out.
And click backspace to backspace.
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #2 on: May 15, 2003, 08:32:58 PM »

I'll hack up a quick one with arrow key support... shouldn't be too hard...  the mouse might be more challenging.  I haven't done that since my FirstBasic days...
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #3 on: May 16, 2003, 12:49:45 AM »

whitetiger is winning, but it is pretty poor really. No prompt, screen 0, no asterisk for space, accept the F keys as input, but it is functional. You get 5 challenge points.

Please do dig out your mouse commands. Or check the tutorials right here at qbnews for a mouse routine.
Logged

toonski84
__/--\__
*****
Posts: 2567



« Reply #4 on: May 16, 2003, 08:29:46 AM »

We lose points for not using our own fonts in a graphical screen mode?
Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Meg
Ancient QBer
****
Posts: 483


« Reply #5 on: May 16, 2003, 04:37:41 PM »

Code:
y% = CSRLIN
x% = POS(0)
accepted$ = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
p$ = ""
a$ = ""

DO
     LOCATE y%, x%
     PRINT "Enter Password: "; a$; " ";
     k$ = INPUT$(1)
     SELECT CASE k$
          CASE CHR$(8)
               IF LEN(p$) THEN
                    p$ = LEFT$(p$, LEN(p$) - 1)
                    a$ = LEFT$(a$, LEN(a$) - 1)
               END IF
          CASE CHR$(13)
               EXIT DO
          CASE ELSE
               IF POS(0) < 80 AND INSTR(accepted$, k$) THEN
                    p$ = p$ + k$
                    a$ = a$ + "*"
               END IF
     END SELECT
LOOP
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #6 on: May 17, 2003, 12:24:07 AM »

In my scoring method you can't lose points, but you will gain them for something like your own fonts too (as long as they look good  :wink: )

Edit: Meg's program...

Better. Doesn't accept F keys, accepts backspace, prompt, accepts and displays star for space key. However screen 0 and uninviting. Meg gets 11 challenge points.

Please guys, when you send something, make a default password and check that the password is correct, then display some sort of message based on the password given.

----- SCORE TABLE -----
Meg - - - - - - - - - - - 11
whitetiger0990 - - - - 5
Logged

Meg
Ancient QBer
****
Posts: 483


« Reply #7 on: May 17, 2003, 06:02:02 AM »

Here's a password program with a theme Smiley

Code:
TYPE BGType '*** BACKGROUND ARRAY ***
     YPos AS INTEGER
     cycl AS SINGLE
     chng AS SINGLE
     Speed AS INTEGER
     Blot AS INTEGER
END TYPE
DIM BG(1 TO 40) AS BGType

DECLARE SUB ShowMessage (Message$)
DECLARE SUB Background (BG() AS BGType)

SCREEN 13

FOR c% = 0 TO 63 '*** SET UP GREEN PALETTE ***
     OUT &H3C8, c%
     OUT &H3C9, 0
     OUT &H3C9, c%
     OUT &H3C9, 0
NEXT c%

accepted$ = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
p$ = ""
a$ = ""

DO
     LOCATE 12, 7: COLOR 40: PRINT "Enter Password: "; a$; " ";
   
     DO
          CALL Background(BG()) '*** MOVE STREAKS ***
          k$ = INKEY$
     LOOP UNTIL k$ <> ""
   
     SELECT CASE k$
          CASE CHR$(8) '*** BACKSPACE ***
               IF LEN(p$) THEN
                    p$ = LEFT$(p$, LEN(p$) - 1)
                    a$ = LEFT$(a$, LEN(a$) - 1)
               END IF
          CASE CHR$(13) '*** ENTER ***
               EXIT DO
          CASE ELSE
               IF LEN(a$) < 9 AND INSTR(accepted$, k$) THEN
                    p$ = p$ + k$
                    a$ = a$ + "*"
               END IF
     END SELECT
LOOP

IF p$ = "matrix" THEN
     Message$ = " SECURITY ACCESS GRANTED "
ELSE
     Message$ = " WARNING: SYSTEM FAILURE "
END IF
CALL ShowMessage(Message$) '*** FLASH MESSAGE ***

SUB Background (BG() AS BGType)
     FOR column% = 1 TO 40
          IF BG(column%).YPos THEN '*** STREAK EXISTS ***
               LOCATE BG(column%).YPos, column%
               COLOR INT(BG(column%).cycl)
               IF (column% < 6 OR column% > 32) OR (BG(column%).YPos < 11 OR BG(column%).YPos > 13) THEN
                    IF BG(column%).Blot THEN '*** ERASING STREAK ***
                         PRINT " ";
                    ELSE
                         PRINT CHR$(INT(RND * 94) + 33); '*** DRAWING STREAK ***
                    END IF
               END IF
               IF INT(RND * BG(column%).Speed) = 0 THEN BG(column%).YPos = BG(column%).YPos + 1
               IF BG(column%).YPos = 24 THEN
                    IF BG(column%).Blot THEN '*** END ERASER ***
                         BG(column%).YPos = 0
                         BG(column%).Blot = 0
                    ELSE
                         BG(column%).YPos = 1 '*** START ERASER ***
                         BG(column%).Blot = 1
                    END IF
               ELSE
                    BG(column%).cycl = BG(column%).cycl + BG(column%).chng
                    IF BG(column%).cycl > 63 THEN '*** LOOP COLOR ***
                         BG(column%).cycl = 63
                         BG(column%).chng = -.1
                    END IF
                    IF BG(column%).cycl < 0 THEN '*** LOOP COLOR ***
                         BG(column%).cycl = 0
                         BG(column%).chng = .1
                    END IF
               END IF
          ELSE
               IF INT(RND * 550) = 0 THEN '*** CREATE STREAK ***
                    BG(column%).YPos = 1
                    BG(column%).cycl = INT(RND * 61) + 1
                    BG(column%).chng = .1 * (-1) ^ (INT(RND * 2))
                    BG(column%).Speed = (INT(RND * 10) + 1) * 5
               END IF
          END IF
     NEXT column%
END SUB

SUB ShowMessage (Message$)
     c% = 0
     ch% = 1
     DO
          c% = c% + ch%
          IF c% = 63 THEN ch% = -1
          IF c% = 0 THEN ch% = 1
          LOCATE 12, 7
          COLOR c%
          PRINT Message$
          FOR t = 1 TO 15000: NEXT t
     LOOP UNTIL INKEY$ <> ""
END SUB


correct password = "matrix"

*peace*

Meg.
Logged
Meg
Ancient QBer
****
Posts: 483


.
« Reply #8 on: May 17, 2003, 06:13:48 AM »

**deleted post**
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #9 on: May 18, 2003, 03:41:09 AM »

Excellent! That's what I'm posting about! Lets see some more of those!

Remember: Bonus points for mouse control.

Meg's new program: Has a theme, checks for correct entry and displays appropriate response, accepts proper keys (but not tidle). Your new total is 31 points, well done.

C'mon other would-be challengers: give Meg a hard time!

----- SCORE TABLE -----
Meg - - - - - - - - - - - 31
whitetiger0990 - - - - 5
Logged

Meg
Ancient QBer
****
Posts: 483


« Reply #10 on: May 19, 2003, 11:24:28 PM »

title reiterated.

*peace*

Meg.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!