Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple games in 1 hour...
#33
Right... I got carried away and made one. It may be a little long, and there is a bug if you play 16 player and individually do every game with him, but other than that I think it's bug free. Tell me what you all think!

Code:
'                        ----- Sports Sim -----

'                                Oracle
'                          webmaster@qbnz.com

OPTION BASE 1
DIM numofpl AS INTEGER, skip(17) AS INTEGER
CLS
INPUT "Number of players? ", numofpl
IF numofpl > 16 THEN numofpl = 16
IF numofpl < 0 THEN numofpl = 0
CLS
DIM names(17) AS STRING, team(17) AS STRING, skpts(17) AS INTEGER, wins(17) AS INTEGER
DIM draws(17) AS INTEGER, losses(17) AS INTEGER, points(17) AS INTEGER, money(17) AS INTEGER

' Get player names
FOR i = 1 TO numofpl
  PRINT "What is player"; i; "'s name?"
  LOCATE i, 28
  INPUT "", names(i)
  IF names(i) = "" THEN names(i) = "Player" + STR$(i)
NEXT i

FOR i = 1 TO numofpl
  CLS
  money(i) = 5000
  PRINT "What is "; names(i); "'s team?"
  LOCATE 1, 18 + LEN(names(i))
  INPUT "", team(i)
  IF team(i) = "" THEN team(i) = "Team" + STR$(i)
  RANDOMIZE TIMER
  skpts(i) = 120 * (.5 + RND)
  PRINT names(i); "'s team has"; skpts(i); "skill points."
  WHILE INKEY$ = "": WEND
NEXT i

' Get computer player's data
CLS
FOR i = numofpl + 1 TO 16
  money(i) = 5000
  RANDOMIZE TIMER
  skpts(i) = 160 * (.5 + RND)
  READ n$
  names(i) = n$
  READ n$
  team(i) = n$
  LOCATE i - numofpl
  IF i < 16 THEN COLOR i ELSE COLOR 15
  PRINT team(i); " has"; skpts(i); "skill points."
NEXT i
WHILE INKEY$ <> "": WEND
WHILE INKEY$ = "": WEND
CLS
COLOR 7

' Calculate wins etc

FOR team1 = 1 TO 16
  FOR team2 = 1 TO 16
  IF team1 = team2 THEN team2 = team2 + 1
  IF team1 <= numofpl AND NOT (skip(team1)) AND team2 <> 16 THEN
    DO
      CLS
      PRINT team(team1); " are up for round"; team1; ", game"; team2
      PRINT team(team1); " have"; money(team1); "in the bank."
      PRINT "What do you want to do?"
      PRINT "(L)ight Training ($250)"
      PRINT "(F)ull Training ($400)"
      PRINT "(B)uy Skill Point ($150)"
      PRINT "(P)urchase Star Player ($1500)"
      PRINT "(G)amble ($100)"
      PRINT "(S)kip to next player"
      PRINT "(N)othing"
      PRINT
      INPUT "What is your choice? ", choice$
      choice$ = LCASE$(LEFT$(choice$, 1))
      PRINT "Your skill points were "; skpts(team1)
      IF choice$ = "l" THEN
        IF money(team1) >= 250 THEN
          skpts(team1) = skpts(team1) + CINT(RND * 2)
          money(team1) = money(team1) - 250
        ELSE GOSUB notrich
        END IF
      ELSEIF choice$ = "f" THEN
        IF money(team1) >= 400 THEN
          skpts(team1) = skpts(team1) + CINT(RND * 4)
          money(team1) = money(team1) - 400
        ELSE GOSUB notrich
        END IF
      ELSEIF choice$ = "b" THEN
        IF money(team1) >= 150 THEN
          skpts(team1) = skpts(team1) + 1
          money(team1) = money(team1) - 150
        ELSE GOSUB notrich
        END IF
      ELSEIF choice$ = "p" THEN
        IF money(team1) >= 1500 THEN
          skpts(team1) = skpts(team1) + CINT(RND * 6) + 8
          money(team1) = money(team1) - 1500
        ELSE GOSUB notrich
        END IF
      ELSEIF choice$ = "g" THEN
        IF money(team1) >= 100 THEN
          skpts(team1) = (skpts(team1) * (.9 + (RND / 5)))
          money(team1) = money(team1) - 100
        ELSE GOSUB notrich
        END IF
      ELSEIF choice$ = "s" THEN skip(team1) = -1
      END IF
      PRINT "Your skill points now are "; skpts(team1)
      WHILE INKEY$ <> "": WEND
      WHILE INKEY$ = "": WEND
    LOOP UNTIL choice$ = "n" OR choice$ = "" OR choice$ = "s"
    ELSE
      skpts(team1) = skpts(team1) + INT(RND * 2) + 2
    END IF
    CLS
    RANDOMIZE TIMER
    t1 = skpts(team1) * (.75 + (RND / 2))
    t2 = skpts(team2) * (.75 + (RND / 2))
    IF team1 <= numofpl AND NOT (skip(team1)) THEN
      PRINT "The Match"
      PRINT team(team1); " vs "; team(team2)
      SLEEP 3.5
    END IF
    IF t1 > t2 + 8 + team2 THEN             ' Who is the winner? Change the +8 to
      wins(team1) = wins(team1) + 1   ' alter the chance of a draw
      losses(team2) = losses(team2) + 1
      money(team1) = money(team1) + 400
      IF team1 <= numofpl AND NOT (skip(team1)) THEN
        PRINT "Congratulations, you won!"
        PRINT "You gain 3 points and $400"
        WHILE INKEY$ <> "": WEND
        WHILE INKEY$ = "": WEND
      END IF
    ELSEIF t2 + team2 > t1 + 8 THEN
      wins(team2) = wins(team2) + 1
      losses(team1) = losses(team1) + 1
      money(team1) = money(team1) - 100
      IF team1 <= numofpl AND NOT (skip(team1)) THEN
        PRINT "Awwww... you lost!"
        PRINT "You'll have to do better next time..."
        WHILE INKEY$ <> "": WEND
        WHILE INKEY$ = "": WEND
      END IF
    ELSE
      draws(team1) = draws(team1) + 1
      draws(team2) = draws(team2) + 1
      money(team1) = money(team1) + 150
      IF team1 <= numofpl AND NOT (skip(team1)) THEN
        PRINT "Well done, a draw. You could've won though..."
        PRINT "You gain 1 point and $150"
        WHILE INKEY$ <> "": WEND
        WHILE INKEY$ = "": WEND
      END IF
    END IF
  NEXT team2
NEXT team1

' Work out the points for each team

FOR t = 1 TO 16
  points(t) = wins(t) * 3 + draws(t)
NEXT t

' Sorting the results

FOR u = 1 TO 16
  FOR r = 1 TO 16
    IF points(r) < points(r + 1) THEN
      SWAP points(r), points(r + 1)
      SWAP wins(r), wins(r + 1)
      SWAP draws(r), draws(r + 1)
      SWAP losses(r), losses(r + 1)
      SWAP skpts(r), skpts(r + 1)
      SWAP team(r), team(r + 1)
      SWAP names(r), names(r + 1)
      SWAP money(r), money(r + 1)
      IF r > 1 THEN r = r - 1 ELSE r = 1
    END IF
  NEXT r
NEXT u

' Results
CLS
COLOR 3
PRINT SPACE$(31) + "**  League Table  **"
LOCATE 2, 5
PRINT STRING$(70, "-")
PRINT "    Team              Wins  Draws  Losses  Points  SK.Pts  Name"
PRINT "    " + STRING$(70, "-")
COLOR 2
FOR y = 1 TO 16
  LOCATE y + 4 + yinc, 5
  PRINT team(y)
  LOCATE y + 4 + yinc, 23
  PRINT wins(y)
  LOCATE y + 4 + yinc, 30
  PRINT draws(y)
  LOCATE y + 4 + yinc, 38
  PRINT losses(y)
  LOCATE y + 4 + yinc, 45
  PRINT points(y)
  LOCATE y + 4 + yinc, 52
  PRINT skpts(y)
  LOCATE y + 4 + yinc, 60
  PRINT names(y)
  IF y = 4 OR y = 12 THEN
    LOCATE y + 5 + yinc, 5
    COLOR 3
    PRINT STRING$(70, "-")
    yinc = yinc + 1
    IF y = 4 THEN COLOR 6 ELSE COLOR 4
  END IF
NEXT y
WHILE INKEY$ <> "": WEND
WHILE INKEY$ = "": WEND
CLS
PRINT "SOCCER.BAS by Oracle for the QBNews 1 hour game challenge"
PRINT "All opinions either to the QBNews challenge forum or webmaster@qbnz.com"
PRINT "I'm stuffed... I'm gonna watch TV now ;)"
END

notrich:
COLOR 4
PRINT "ERROR! You can't afford that!"
WHILE INKEY$ = "": WEND
COLOR 7
RETURN

DATA "Joe Smith","Manchester United"
DATA "Bobby Kane","Liverpool"
DATA "James Underhill","Chelsea"
DATA "Simon Giles","Spurs"
DATA "Tom Bates","Brighton"
DATA "Mr Smith","Agents"
DATA "Morpheus","Xions"
DATA "Luke Skywalker","Rebellians"
DATA "Darth Vader","Empireans"
DATA "Linus Torvalds","Linuxians"
DATA "Bill Gates","Microsoftians"
DATA "Soo Nee","Plastationites"
DATA "Nintendo","Gameboyites"
DATA "Tiger Woods","Golfians"
DATA "Serena Williams","Screamers"
DATA "Paul Gasgoine","Druggies"

I also think it gets harder the higher your player number, but I didn't have time for a complete desk check to prove it.

It may pull a funny line wrap (probably will), so expect a few errors, just correct those with your delete button. Cut&paste into notepad and enjoy!
Reply


Messages In This Thread
Simple games in 1 hour... - by na_th_an - 06-28-2003, 11:07 PM
Simple games in 1 hour... - by ak00ma - 06-29-2003, 01:27 AM
Simple games in 1 hour... - by Ninkazu - 06-29-2003, 03:32 AM
Simple games in 1 hour... - by whitetiger0990 - 06-29-2003, 03:58 AM
wow, nathan, - by Agamemnus - 06-29-2003, 06:35 AM
Simple games in 1 hour... - by na_th_an - 06-29-2003, 07:52 AM
Simple games in 1 hour... - by na_th_an - 06-29-2003, 08:31 AM
Simple games in 1 hour... - by Rokkuman - 06-29-2003, 08:37 AM
Msg# 188 - by whitetiger0990 - 06-29-2003, 08:48 AM
Simple games in 1 hour... - by LooseCaboose - 06-29-2003, 10:38 AM
Simple games in 1 hour... - by ak00ma - 06-29-2003, 02:19 PM
Simple games in 1 hour... - by na_th_an - 06-29-2003, 05:39 PM
Simple games in 1 hour... - by Agamemnus - 06-29-2003, 05:55 PM
Simple games in 1 hour... - by aetherfox - 06-29-2003, 07:24 PM
Simple games in 1 hour... - by na_th_an - 06-29-2003, 08:01 PM
Simple games in 1 hour... - by barok - 06-30-2003, 02:15 AM
Simple games in 1 hour... - by whitetiger0990 - 06-30-2003, 02:45 AM
Simple games in 1 hour... - by na_th_an - 06-30-2003, 03:08 AM
Simple games in 1 hour... - by barok - 06-30-2003, 04:30 AM
Simple games in 1 hour... - by whitetiger0990 - 06-30-2003, 04:39 AM
Simple games in 1 hour... - by oracle - 06-30-2003, 04:49 AM
Simple games in 1 hour... - by LooseCaboose - 06-30-2003, 07:13 AM
Simple games in 1 hour... - by Ninkazu - 06-30-2003, 07:34 AM
Simple games in 1 hour... - by LooseCaboose - 06-30-2003, 08:11 AM
Simple games in 1 hour... - by oracle - 06-30-2003, 09:30 AM
Simple games in 1 hour... - by relsoft - 06-30-2003, 10:25 AM
Simple games in 1 hour... - by LooseCaboose - 06-30-2003, 10:51 AM
Simple games in 1 hour... - by oracle - 06-30-2003, 11:05 AM
Simple games in 1 hour... - by oracle - 06-30-2003, 11:41 AM
Simple games in 1 hour... - by oracle - 07-01-2003, 11:27 AM
Simple games in 1 hour... - by na_th_an - 07-01-2003, 05:36 PM
Simple games in 1 hour... - by oracle - 07-02-2003, 07:24 AM
Simple games in 1 hour... - by BinarySHOCK - 07-02-2003, 08:35 AM
Simple games in 1 hour... - by whitetiger0990 - 07-02-2003, 09:25 AM
My Game - by Meg - 07-02-2003, 10:05 AM
the rules - by Meg - 07-02-2003, 10:11 AM
Simple games in 1 hour... - by relsoft - 07-02-2003, 10:27 AM
Simple games in 1 hour... - by oracle - 07-02-2003, 11:38 AM
Simple games in 1 hour... - by BinarySHOCK - 07-02-2003, 12:36 PM
Simple games in 1 hour... - by red_Marvin - 07-02-2003, 01:38 PM
Simple games in 1 hour... - by BinarySHOCK - 07-02-2003, 02:14 PM
Relsoft & Na_th_an - by Mango - 07-02-2003, 07:45 PM
Simple games in 1 hour... - by red_Marvin - 07-02-2003, 10:08 PM
Re: Relsoft & Na_th_an - by na_th_an - 07-03-2003, 02:31 AM
Simple games in 1 hour... - by whitetiger0990 - 07-03-2003, 02:42 AM
Simple games in 1 hour... - by na_th_an - 07-03-2003, 03:19 AM
Re: Relsoft & Na_th_an - by Mango - 07-03-2003, 10:10 AM
Simple games in 1 hour... - by oracle - 07-03-2003, 10:27 AM
Simple games in 1 hour... - by relsoft - 07-03-2003, 11:00 AM
Simple games in 1 hour... - by BinarySHOCK - 07-03-2003, 01:39 PM
Simple games in 1 hour... - by oracle - 07-04-2003, 04:17 AM
Boxes - by Meg - 07-04-2003, 09:00 AM
Simple games in 1 hour... - by Ninkazu - 07-04-2003, 09:16 AM
Simple games in 1 hour... - by oracle - 07-04-2003, 10:53 AM
Simple games in 1 hour... - by BinarySHOCK - 07-04-2003, 12:48 PM
Simple games in 1 hour... - by oracle - 07-04-2003, 01:47 PM
Simple games in 1 hour... - by BinarySHOCK - 07-04-2003, 01:52 PM
Simple games in 1 hour... - by Mango - 07-04-2003, 05:23 PM
Simple games in 1 hour... - by Dav - 07-04-2003, 06:59 PM
Simple games in 1 hour... - by red_Marvin - 07-04-2003, 07:01 PM
shoot - by Meg - 07-04-2003, 07:14 PM
Simple games in 1 hour... - by oracle - 07-05-2003, 04:51 AM
Simple games in 1 hour... - by relsoft - 07-05-2003, 08:12 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)