Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixtures
#11
Quote:in line 3 and in line 11, I see ag repeated
Whew! You frightened me for a minute there. LOL.

I guess my explanation "When the lines get larger, it is the next case you wanted." was too cryptic. Let me try again.

When the lines get larger you are in the next case. For example

Case: There are 8 teams
Round 1: gh ab cd ef
Round 2: eg fh ac bd
Round 3: df eh ag bc
Round 4: cf de ah bg
Round 5: bh ce ad fg
Round 6: cg bf dh ae
Round 7: af dg be ch
(Notice each team has played each other team exactly once)

Case: There are 10 teams
Round 1: ij ab cd ef gh
Round 2: bc di ah eg fj
Round 3: ai dg fh bj ce
Round 4: bi de ag cf hj
... etc.

So in each case (8,10,12,14,16,18,20,22,and 24 teams) there will be produced a list of rounds where there is no repetition within the case.

Did that help?

Mac
Reply
#12
i can not get the code to work
Reply
#13
Quote:i can not get the code to work

Sorry to hear that. What happened?

As a test, I just now downloaded the code and saved it as z.bas
I did QBasic /run z
It displayed "Be patient" and in a few seconds completed.
The file "z.dat" was created.
It contained the results.

What did you do in detail that failed?

Mac
Reply
#14
Mac:

My fault, for not thinking the whole way! :oops: Your combinations are A1 OK. Thanks for patiently explaining and getting me back on track.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#15
No problem, Ralph.

For Champions_2002: Taking your original code and modifying it to use z.bat, I came up with the program below as a demo.

Mac

Code:
CONST NumberOfTeams = 20
DIM Team(NumberOfTeams) AS STRING
DIM HomeTeam AS STRING * 17
DIM Visitors AS STRING * 17
DIM Round AS INTEGER, Game AS INTEGER
DIM i AS INTEGER
FOR i = 1 TO NumberOfTeams: READ Team$(i): NEXT i
SCREEN 13
COLOR 1
OPEN "z.dat" FOR INPUT AS #1
WHILE LEN(l$) < NumberOfTeams: LINE INPUT #1, l$: WEND
DO
  Round = Round + 1
  CLS : PRINT "Round: "; Round
  PRINT : PRINT
  FOR Game = 1 TO LEN(l$) - 1 STEP 2
    h$ = MID$(l$, Game, 1)
    v$ = MID$(l$, Game + 1, 1)
    GOSUB ShowRound
  NEXT Game
  IF EOF(1) THEN EXIT DO
  LINE INPUT #1, l$
  IF LEN(l$) > NumberOfTeams THEN EXIT DO
  PRINT : PRINT
  LINE INPUT "Press Enter for next Round: "; e$
  IF e$ <> "" THEN PRINT "aborted": SYSTEM
LOOP
PRINT : PRINT "That's all"
LINE INPUT "Press Enter to acknowledge"; e$
CLS
SYSTEM

ShowRound:
h% = ASC(h$) - 96: ' Changes a-z to 1-26
RSET HomeTeam = Team(h%)
COLOR 7
PRINT HomeTeam;
COLOR 4
PRINT " V ";
v% = ASC(v$) - 96
LSET Visitors = Team(v%)
COLOR 7
PRINT Visitors
RETURN

DATA "Arsenal","Aston Villa","Birmingham","Blackburn","Bolton"
DATA "Charlton","Chelsea","Crystal Palace","Everton","Fulham"
DATA "Liverpool","Manchester City","Man Utd","Middlesborough"
DATA "Newcastle","Norwich","Portsmouth","Southampton"
DATA "Tottenham","West Brom"
Reply
#16
Aside: Wow, how does one wait almost exactly a year to reply to a thread? Must have been in a coma... :wow:
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#17
Quote:Aside: Wow, how does one wait almost exactly a year to reply to a thread? Must have been in a coma... :wow:

Hi, Agamemnus,
:???:
Must be back in the coma again!

I really am frustrated he hasn't replied to my (self-congratulatulation) excellent answer to his question.

Mac
Reply
#18
I'am not the one in a coma, but my mother is in intensive care at the moment and have been at her bedside, so that is way i have not replayed,

Mac the code you did for me did work
Reply
#19
God bedering til sin mor!

(Danish: "hope your mom gets better soon")

Mac
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)