Kirjautuminen

Haku

Tehtävät

Keskustelu: Koodit: QB: Rahapeli

gamehouse [27.04.2008 18:42:30]

#

Koodasin tälläisen, kun oli tylsää ja sen jälkeenkin parantelin koodia. Voittojen tarkastusta voisi parantaa ja kokeilinkin laittaa tarkastusta aliohjelmaan, mutta ei onnistunut :(

Muista pitää Caps Lock päällä pelatessasi!
En jaksanut kommentoida, koska alunperin tämän ei olisi pitänyt lähteä Ohjelmointiputkaan...

' Hedelmäpeli/rahapeli v.0.3
' Englanninkielinen
' -----------------
' Mark Mäkinen 2008

DIM INRAHA AS LONG


RAHA = 0
INRAHA = 10000


RANDOMIZE TIMER

CLS

ALKU:

LOCATE 12, 30: PRINT "INSERT COINS"
LOCATE 14, 25: PRINT "'+' INSERTS MONEY"
LOCATE 15, 25: PRINT "'I' SHOWS INFO"
LOCATE 17, 25: PRINT "PRESS ENTER, WHEN READY"
LOCATE 1, 70: PRINT "COINS: "; RAHA

DO
A$ = INKEY$
LOOP UNTIL A$ <> ""

SELECT CASE A$

CASE CHR$(13)
GOTO APELI

CASE "+"
PLAY "C64D64F64"
RAHA = RAHA + 1

CASE "I"
GOTO INFOA

CASE CHR$(27)
CLS
END

END SELECT

GOTO ALKU

APELI:
CLS
PELI:
COLOR 7
VOITTO = 0
CLS

IF RAHA = 0 THEN GOTO GAMEOVER
IF INRAHA = 0 THEN GOTO BEAT
PRINT "************************************"
PRINT "*                                  *"
PRINT "*     [ ]       [ ]        [ ]     *"
PRINT "*                                  *"
PRINT "*       PC- COINGAME V.0.3         *"
PRINT "************************************"
PRINT

PRINT "ENTER = START | MONEY IN AUTOMAT: "; INRAHA; " | COINS: "; RAHA


DO
G$ = INKEY$
LOOP UNTIL G$ <> ""

SELECT CASE G$

CASE CHR$(13)

RAHA = RAHA - 1

PLAY "C50D50E50F50G50A50"
FIRST = INT((5 - 1 + 1) * RND + 1)
COLOR 4: LOCATE 3, 7: PRINT FIRST
COLOR 7

PLAY "P9"

PLAY "C50D50E50F50G50A50"
SECOND = INT((5 - 1 + 1) * RND + 1)
COLOR 4: LOCATE 3, 17: PRINT SECOND
COLOR 7

PLAY "P9"

PLAY "C50D50E50F50G50A50"
THIRD = INT((5 - 1 + 1) * RND + 1)
COLOR 4: LOCATE 3, 28: PRINT THIRD
COLOR 7


IF FIRST = 1 THEN
IF SECOND = 1 THEN
IF THIRD = 1 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 3 COINS!"
INRAHA = INRAHA - 3
RAHA = RAHA + 3
END IF
END IF
END IF

IF FIRST = 1 THEN
IF SECOND = 2 THEN
IF THIRD = 3 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 6 COINS!"
INRAHA = INRAHA - 6
RAHA = RAHA + 6
END IF
END IF
END IF

IF FIRST = 5 THEN
IF SECOND = 5 THEN
IF THIRD = 5 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT "; INRAHA; " COINS!"
SLEEP 3
RAHA = RAHA + INRAHA
INRAHA = 0
END IF
END IF
END IF

IF FIRST = 3 THEN
IF SECOND = 2 THEN
IF THIRD = 1 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 12 COINS!"
INRAHA = INRAHA - 12
RAHA = RAHA + 12
END IF
END IF
END IF

IF FIRST = 2 THEN
IF SECOND = 3 THEN
IF THIRD = 2 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 10 COINS!"
INRAHA = INRAHA - 10
RAHA = RAHA + 10
END IF
END IF
END IF

IF FIRST = 3 THEN
IF SECOND = 3 THEN
IF THIRD = 3 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 20 COINS!"
INRAHA = INRAHA - 20
RAHA = RAHA + 20
END IF
END IF
END IF

IF FIRST = 3 THEN
IF SECOND = 1 THEN
IF THIRD = 3 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 15 COINS!"
INRAHA = INRAHA - 15
RAHA = RAHA + 15
END IF
END IF
END IF

IF FIRST = 3 THEN
IF SECOND = 4 THEN
IF THIRD = 5 THEN
PLAY "F64E64D64C64"
VOITTO = 1
COLOR 2: LOCATE 7, 1: PRINT "YOU GOT 40 COINS!"
INRAHA = INRAHA - 40
RAHA = RAHA + 40
END IF
END IF
END IF



IF VOITTO = 0 THEN INRAHA = INRAHA + 1

CASE CHR$(27)

CLS
END


END SELECT

SLEEP 2

GOTO PELI

GAMEOVER:

PLAY "F5E5D5C5"
CLS
COLOR 4: PRINT "GAME OVER..."
PRINT
PRINT "PC- COINGAME BY: MARK MŽKINEN 2008"
SLEEP 2
CLS
COLOR 7
PLAY "C12F12"
PRINT "NEW GAME?"
PRINT
PRINT "ENTER = YES! | ESC = NO!"

NEWKYSY:

DO
NEW$ = INKEY$
LOOP UNTIL NEW$ <> ""

SELECT CASE NEW$

CASE CHR$(13)
PLAY "G64F64"
CLS
GOTO ALKU

CASE CHR$(27)
PLAY "G64F64"

CLS
END

END SELECT

GOTO NEWKYSY

BEAT:

CLS
PLAY "C64D64E64F64G64A64G64F64E64D64C64C64D64E64F64G64A64G64F64E64D64C64"
PRINT "!!!!!!!!!!!!!!!!!!!!!"
PRINT "!!YOU GOT ALL MONEY!!"
PRINT "!!!!!!!!!!!!!!!!!!!!!"
PRINT
PRINT "PC- COINGAME BY: MARK MŽKINEN 2008"
SLEEP 4

CLS
END


INFOA:

LOCATE 10, 25: PRINT "*----------- INFO ----------*"
LOCATE 11, 25: PRINT "|  PC- COINGAME V.0.3       |"
LOCATE 12, 25: PRINT "|                           |"
LOCATE 13, 25: PRINT "| 111 = 3 COINS             |"
LOCATE 14, 25: PRINT "| 123 = 6 COINS             |"
LOCATE 15, 25: PRINT "| 555 = ALL MONEY           |"
LOCATE 16, 25: PRINT "| 321 = 12 COINS            |"
LOCATE 17, 25: PRINT "| 232 = 10 COINS            |"
LOCATE 18, 25: PRINT "| 333 = 20 COINS            |"
LOCATE 19, 25: PRINT "| 313 = 15 COINS            |"
LOCATE 20, 25: PRINT "| 345 = 40 COINS            |"
LOCATE 21, 25: PRINT "|                           |"
LOCATE 22, 25: PRINT "| ESC = QUIT GAME           |"
LOCATE 23, 25: PRINT "|                           |"
LOCATE 24, 25: PRINT "*---------------------------*"

PRINT "PRESS ANY KEY..."
SLEEP
CLS
GOTO ALKU

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta