Post on 04-Jun-2018
8/14/2019 Python Lottery documentation
1/26
ContentsContents..................................................................................................................... 1
Table of Contents....................................................................................................... 3
Introduction................................................................................................................5
Objectives...................................................................................................................6
Design........................................................................................................................ 6
Nature of the Solution................................................................................................6
Intended enefits....................................................................................................... !
"i#its of the sco$e of the solution..............................................................................!
Testing........................................................................................................................!
1............................................................................................................................... 1%
To test if the &rong $ass&ord is acce$ted or not.....................................................1%
'............................................................................................................................... 1%
To test &hat ha$$ens if three &rong $ass&ords are entered...................................1%
3............................................................................................................................... 1%
To test &hether it redirects to #enu after right $ass&ord.......................................1%
(............................................................................................................................... 1%
To test &hat ha$$ens &hen invalid co##and is $ressed in #enu...........................1%
5............................................................................................................................... 1%
To test if valid co##ands res$ond &hat is has to res$ond......................................1%
6............................................................................................................................... 1%
To test if value less than 1% is acce$ted or not........................................................1%
)............................................................................................................................... 1%
To test if value greater than !! is acce$ted or not...................................................1%
8/14/2019 Python Lottery documentation
2/26
1
*............................................................................................................................... 1%
To test if sa#e value is acce$ted or not...................................................................1%
!............................................................................................................................... 1%
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................1%
1%............................................................................................................................. 1%
To test if user can go to #enu after the ga#e.........................................................1%
To test if the &rong $ass&ord is acce$ted or not.....................................................1%
To test &hat ha$$ens &hen invalid co##and is $ressed in #enu...........................1'
To test if valid co##ands res$ond &hat is has to res$ond......................................13
To test if value less than 1% is acce$ted or not........................................................1(
To test if value greater than !! is acce$ted or not...................................................1(
To test if sa#e value is acce$ted or not...................................................................15
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................15
To test if user can go to #enu after the ga#e.........................................................16
Test "og.................................................................................................................... 1)
To test &hat ha$$ens if three &rong $ass&ords are entered...................................1)
To test if valid co##ands res$ond &hat is has to res$ond......................................1*
To test if value less than 1% is acce$ted or not........................................................1*
To test if value greater than !! is acce$ted or not...................................................1*
To test if sa#e value is acce$ted or not...................................................................1*
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................1*
To test if user can go to #enu after the ga#e.........................................................1*
,$$endi-.................................................................................................................. 1*
I#$le#entation of Securit......................................................................................'5
/eference0................................................................................................................'6
8/14/2019 Python Lottery documentation
3/26
1
T $ e t h e c o # $ a n a d d r e s s 2
Table of Contents
Contents..................................................................................................................... 1
Table of Contents....................................................................................................... 3
Introduction................................................................................................................5
Objectives...................................................................................................................6
Design........................................................................................................................ 6
'%1'
ic43 "otter ga#e
,shesh oudel
rou$ C'
8/14/2019 Python Lottery documentation
4/26
1
Nature of the Solution................................................................................................6
Intended enefits....................................................................................................... !
"i#its of the sco$e of the solution..............................................................................!
Testing........................................................................................................................!
1............................................................................................................................... 1%
To test if the &rong $ass&ord is acce$ted or not.....................................................1%
'............................................................................................................................... 1%
To test &hat ha$$ens if three &rong $ass&ords are entered...................................1%
3............................................................................................................................... 1%
To test &hether it redirects to #enu after right $ass&ord.......................................1%
(............................................................................................................................... 1%
To test &hat ha$$ens &hen invalid co##and is $ressed in #enu...........................1%
5............................................................................................................................... 1%
To test if valid co##ands res$ond &hat is has to res$ond......................................1%
6............................................................................................................................... 1%
To test if value less than 1% is acce$ted or not........................................................1%
)............................................................................................................................... 1%
To test if value greater than !! is acce$ted or not...................................................1%
*............................................................................................................................... 1%
To test if sa#e value is acce$ted or not...................................................................1%
!............................................................................................................................... 1%
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................1%
1%............................................................................................................................. 1%
To test if user can go to #enu after the ga#e.........................................................1%
To test if the &rong $ass&ord is acce$ted or not.....................................................1%
To test &hat ha$$ens &hen invalid co##and is $ressed in #enu...........................1'
8/14/2019 Python Lottery documentation
5/26
1
To test if valid co##ands res$ond &hat is has to res$ond......................................13
To test if value less than 1% is acce$ted or not........................................................1(
To test if value greater than !! is acce$ted or not...................................................1(
To test if sa#e value is acce$ted or not...................................................................15
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................15
To test if user can go to #enu after the ga#e.........................................................16
Test "og.................................................................................................................... 1)
To test &hat ha$$ens if three &rong $ass&ords are entered...................................1)
To test if valid co##ands res$ond &hat is has to res$ond......................................1*
To test if value less than 1% is acce$ted or not........................................................1*
To test if value greater than !! is acce$ted or not...................................................1*
To test if sa#e value is acce$ted or not...................................................................1*
To test if ga#e re$ort is sho&n &hile +uitting the ga#e..........................................1*
To test if user can go to #enu after the ga#e.........................................................1*
,$$endi-.................................................................................................................. 1*
I#$le#entation of Securit......................................................................................'5
/eference0................................................................................................................'6
Introduction
"otter ga#e is a for# of ga#bling &hich dates bac4 to earl '%thcentur.
The definitions of lotter are #an7 but the #ain definition is0 , lotter is afor# of ga#bling&hich involves the dra&ing of lots for a $ri8e. There are
#an 4inds of lotter ga#es in the &orld. So#e of the# are0 "otto7 "ittle
"ottos7 The Dailies7 9ultistate a#es7 Instant a#es7 :uic4 ic4s and so on.
Ne& t$es of lotter ga#es are $o$$ing u$ #ore and #ore fre+uentl. ut
the basics re#ain "otto7 "ittle "ottos7 Dailies7 9ultiState a#es7 and Instant
a#es. The Instant a#es are scratchoff tic4ets7 &hile the other lotter
8/14/2019 Python Lottery documentation
6/26
1
ga#es are online ga#es because the consist of co#$utergenerated
tic4ets. In this $roject7 Dailies or $ic43 is done.
Objectives
The #ain objective of building this $roject is that the ga#e &ill be $laed#ore efficientl7 fast and &ith co#$arabl less error. The "otter ga#e
before &as ver traditional7 client $ic4ed three nu#bers and a cler4 $ic4ed
three nu#bers at rando#. That used to ta4e lots of ti#e as the cler4 has to
thin4 the rando# nu#bers fro# certain range of nu#bers. The $attern to
generate nu#bers b cler4s is co#$arativel eas to guess then the
co#$uter generated nu#bers. There #ight be #ista4e in calculating the
re$ort of the user as &ell. building this sste#7 the ga#e is fast7 efficient7
eas and a lot hassle free. There &on;t be a cler4 necessar for generating
rando# nu#bers or calculating the $rice.
8/14/2019 Python Lottery documentation
7/26
1
=hen user selects the first o$tion7 i.e. >a?7 the follo&ing laout co#es
=hen user selects >? and >b? in #ain #enu7 ga#e starts and the
laout is li4e0
8/14/2019 Python Lottery documentation
8/26
1
,fter the ga#e7 if user selects to end the ga#e7it e-its sho&ing all there$ort of the $laer. It loo4s li4e0
8/14/2019 Python Lottery documentation
9/26
1
Intended Benefits
There are #an benefits of this sste# to be co#$uteri8ed.
The sste# for $laing lotter is sste#atic.
The errors &ill be less.
Navigating through ga#e is easier
It is a lot eas
Limits of the scope of the solution
The li#it of the sste# is that the user has to have a little co#$uter 4no&ledge.
Currentl the sste# cannot bac4 u$ the data of the $laers. It has no ra$hical
@ser Interface7 &hich is ver frustrating for so#e user. If so#eone finds about the
$ass&ord then anone can $la this ga#e.
Testing
Test lan
8/14/2019 Python Lottery documentation
10/26
1
1. To test if the &rong $ass&ord is acce$ted or not
'. To test &hat ha$$ens if three &rong $ass&ords are entered
3. To test &hether it redirects to #enu after right $ass&ord
(. To test &hat ha$$ens &hen invalid co##and is $ressed in #enu
5. To test if valid co##ands res$ond &hat is has to res$ond
6. To test if value less than 1% is acce$ted or not
). To test if value greater than !! is acce$ted or not
*. To test if sa#e value is acce$ted or not
!. To test if ga#e re$ort is sho&n &hile +uitting the ga#e
1%. To test if user can go to #enu after the ga#e
Test case 1
Test lan
To test if the wrong password is accepted or notTest Data ,n 4e that is not the actual $ass&ord
8/14/2019 Python Lottery documentation
11/26
1
Test lanTo test what happens if three wrong passwords are
entered
Test Data Three &rong $ass&ords
8/14/2019 Python Lottery documentation
12/26
1
Test plan 4
Test lanTo test what happens when invalid command is
pressed in menu
Test Data Invalid co##and
8/14/2019 Python Lottery documentation
13/26
1
Test lanTo test if valid commands respond what is has to
respond
Test Data Balid co##and >a7b or c?
8/14/2019 Python Lottery documentation
14/26
1
Test Plan 6
Test lanTo test if value less than ! is accepted or not
Test Data Balue less than 1%
8/14/2019 Python Lottery documentation
15/26
1
Test Plan 8
Test lanTo test if same value is accepted or not
Test Data Sa#e value in t&o $lace
8/14/2019 Python Lottery documentation
16/26
1
Test Plan 10
Test lanTo test if user can go to menu after the game
Test Data N,
8/14/2019 Python Lottery documentation
17/26
1
Test Log
S.
No.
Test lan Conclusion
1. To test if the &rong $ass&ord is acce$ted or not Successful
'. To test &hat ha$$ens if three &rong $ass&ords are
entered
Successful
3. To test &hether it redirects to #enu after right
$ass&ord
Successful
(. To test &hat ha$$ens &hen invalid co##and is Successful
8/14/2019 Python Lottery documentation
18/26
1
$ressed in #enu
5.To test if valid co##ands res$ond &hat is has to
res$ond
Successful
6. To test if value less than 1% is acce$ted or not Successful
).To test if value greater than !! is acce$ted or not
Successful
*.To test if sa#e value is acce$ted or not
Successful
!.To test if ga#e re$ort is sho&n &hile +uitting the ga#e
Successful
1%.To test if user can go to #enu after the ga#e
Successful
$ppendi%
,shesh oudel
Se$t7 '%1'
i#$ort rando#
i#$ort os7 ss7 ti#e
i#$ort errno7 ss
fro# rando# i#$ort randrange
fro# ti#e i#$ort slee$
8/14/2019 Python Lottery documentation
19/26
1
def d$rint >#essage7 delaE%.%1?0
FFF
rints #essage &ith dela bet&een each character.
FFF
for char in #essage0
ss.stdout.&rite>char?
ss.stdout.flush>?
ti#e.slee$>dela?
if GGna#eGG EE HGG#ainGGH0
d$rint>H GG nH J
H GGG G G G G GnH J
H>GG>? > > >GG?>?>nH J
H H?
$rint
$rint Flease enter our ass&ord7 carefull as 3 &rong $ass&ords &ill close
the ga#e.F
def getG$ass&ord>?0
give it three tries
for 4 in range>3?0
encoded E Fcv$-3bggreltn8rF
$ass&ord E ra&Gin$ut>FHrot13H?0
return True
return Kalse
8/14/2019 Python Lottery documentation
20/26
1
def start>?0
if getG$ass&ord>?0
$rint FF
def d$rint >#essage7 delaE%.%5?0
FFF
rints #essage &ith dela bet&een each character.
FFF
for char in #essage0
ss.stdout.&rite>char?
ss.stdout.flush>?
ti#e.slee$>dela?
if GGna#eGG EE HGG#ainGGH0
d$rint> HGG GGGGG G GGG GGG GG GG GGG nH J
H GGL L GG G L L GGL nH J
H L GLL LGL >GL >G? L LL L GL nH J
H GG LGGGLGGGGGGGGGGLGL LGLGGGLH?
$rint FF
d$rint >HMMMMMMMMIC3 "otter Sste#MMMMMMMMMH?
&inninga#t7total7&inningga#es7ga#es$laed7ga#es&on7c#d7E%7%7%7%7%7N
one7FnF
&hile c#dEFsto$F0
for i in range>'?0
$rintFF
$rintF9,IN 9a? a#e InstructionsF
8/14/2019 Python Lottery documentation
21/26
1
$rintF>b? "otter a#eF
$rintF>c? Fress a7 b or c and $ress '?0
$rintFF
if ans&erEEFaF0
$rint FThe user selects three disticnt nu#bersF
$rint F>each #ust be different? bet&een 1% and !! inclusive.F
$rint FThe userHs nu#ber and the co#$uter nu#bers are then
#atched7F
$rint Fgiving a result of no #atches7 1 #atch7 ' #atches or 3
#atches.F
$rint FFDo ou &ant to $la ga#eP nF?.lo&er>?
$rintFF
if ans&erEEFbF or ans&erEEFaF and nEEFF0
starts ga#e here
&hile True0
tr0
trs the bloc4 of state#ents
$rintFF
a#ountEint>float>ra&Gin$ut>F
8/14/2019 Python Lottery documentation
22/26
1
a#ountEa#ounta#ountQ1%%
if a#ountE1%%0
brea4
else0
$rintFO$ss Invalid a#ount
8/14/2019 Python Lottery documentation
23/26
1
if nu#ber! and nu#ber1%% and
nu#bers.count>nu#ber?EE%0nu#bers.a$$end>nu#ber?Unu#berscountE
nu#berscountJ1
else0
$rintFInvalid nu#ber
8/14/2019 Python Lottery documentation
24/26
1
if
nu#berscountEE'0&inninga#tE&inninga#tJ!3U$rintFCongratulations '
#atches. Rou &in /s.1%%.FUga#es&onEga#es&onJ1
elif
nu#berscountEE30&inninga#tE&inninga#tJ%.!3M15%%U$rintFCongratulations 3 #atches. Rou &in /s. 15%%.FUga#es&onEga#es&onJ1
else0
$rintFSorrF7nu#berscount7F9atches. etter luc4 ne-t
ti#e.F
ra&Gin$ut>Fress ?
$rint FF
if EEFF0$rintFa#e '?0$rintFF
$rintFRour a#e /e$ort is0F
$rintFRou $laed 0F7ga#es$laed7Fga#es.F
$rintFRou &on 0F7ga#es&on7Fga#es.F
$rintFRou lost 0F7ga#es$laedga#es&on7Fga#es.F
8/14/2019 Python Lottery documentation
25/26
1
$rintFRou &on 0/s.F7 &inninga#t7F>inc )Q T,V?F
$rintFRour &in $ercentage
is 0F7ga#es&onga#es$laedM1%%.%%7FQ.F
$rintFRour net balance is 0/s.F7&inninga#ttotal
else0
$rintFDude u dint $la an ga#es So no& no ga#e re$ortF
ra&Gin$ut>Fress enterF?
$rint FTA,N RO@ KO/ ",RINF
brea4
ss.e-it>errno.
8/14/2019 Python Lottery documentation
26/26
she cannot obtain the $ass&ord fro# coding. Though it is not i#$ossible but
&ithout #uch co#$uter 4no&ledge7 it is ver hard to obtain $ass&ord.
'eference(,SCII art7 accessed Se$te#ber '57 '%1'7
htt$0&&&.4a##erl.deascii,sciiSignature.$h$
T$es of "otter7 accessed Se$te#ber '67 '%1'7
htt$0tlc.ho&stuff&or4s.co#fa#ilho&to$lathelotter1.ht#