Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Lottery Game
Author Message
smith_scott_04

Posted: Sat Nov 08, 2003 3:11 pm   Post subject: Lottery Game

This is my lottery Game (based on the rules of lotto 649) simple yet addictive.
open for new ideas
 code: ----------------------------------------------------------------------------------- var num : array 1 .. 6 of int var number : array 1 .. 6 of int var tot : int := 0 var finish : boolean %----------------------------------------------------------- procedure RandNum ()     var doesrepeat : boolean     randint (num (1), 1, 49)     for cRandNum : 2 .. 6         loop             doesrepeat := false             randint (num (cRandNum), 1, 49)             for cNewRand : 1 .. cRandNum - 1                 if num (cRandNum) = num (cNewRand) then                     doesrepeat := true                 end if             end for             exit when doesrepeat = false         end loop     end for end RandNum %----------------------------------------------------------- procedure ShowNum     locate (9, 2)     put "The Numbers Were: "     locate (10, 2)     color (red)     put num (1), " - " ..     put num (2), " - " ..     put num (3), " - " ..     put num (4), " - " ..     put num (5), " - " ..     put num (6)     finish := true end ShowNum %----------------------------------------------------------- procedure Guess     for locate1 : 3 .. 52 by 5         tot := tot + 1         loop             var doesrepeat : boolean := false             loop                 locate (3, 1)                 color (255)                 put "Choose 6 Numbers (1,49): " ..                 drawfillbox (200, 350, 400, 370, white)                 get number (tot)                 doesrepeat := false                 if tot > 1 then                     for c1 : 1 .. tot - 1                         if number (c1) = number (tot) then                             doesrepeat := true                         end if                     end for                 else                     exit                 end if                 exit when doesrepeat = false             end loop             if number (tot) <= 49 then                 if tot < 6 then                     locate (5, locate1)                     put number (tot), " - "                 end if                 if tot > 5 then                     locate (5, locate1)                     put number (tot)                 end if                 exit             end if         end loop         if tot = 6 then             exit         end if     end for end Guess %----------------------------------------------------------- procedure CheckNums     var wrong : int := 0     for count : 1 .. 6         for c1 : 1 .. 6             if num (count) = number (c1) then                 wrong := wrong + 1             end if         end for     end for     locate (7, 2)     put "You got: ", (wrong), " right" end CheckNums %----------------------------------------------------------- loop     locate (1, 28)     color (blue)     put "Lotto 649 - Just Imagine"     color (255)     RandNum     Guess     CheckNums     ShowNum     delay (10000)     cls     tot := 0 end loop -----------------------------------------------------------------------------------
Sponsor
Sponsor

Tony

Posted: Sat Nov 08, 2003 3:59 pm   Post subject: (No subject)

not bad... here's an idea though...

you know their lotto advanced subscription thingy? Where they play your numbers for you?

You should do something like that. Just repeatedly play same numbers over and over again, with a counter of how much money one's loosing
Tony's programming blog. DWITE - a programming contest.
smith_scott_04

Posted: Sat Nov 08, 2003 4:58 pm   Post subject: (No subject)

Thanx, im currently working on networking the game for school, and i was thinking of allowing people to store there numbers in a text file for subscription service thingy.

thanx
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: