YottoRB - Janet Terra


YottoRB is a word variation of the classic game Mastermind. This Run BASIC version of Yotto is a clone of Yotto (c)2002, HyText Consulting.

The original Yotto was written by Jerry Muelver. The design of Yotto has been ported to Run BASIC with permission.

YottoRB has a 'demo version', requiring no external word list. You can upload your own word list. Need a word list? Download one (or all) of these three word lists now -

5 Letter Words >
6 Letter Words >
7 Letter Words >

' YottoRB - Janet Terra
' A Clone of Yotto (c)2002, HyText Consulting
' The original Yotto was written by
' Jerry Muelver.  The game has been ported
' to Run BASIC with Permission.
 
    Graphic #g, 400, 150
    #g Font("Courier_New", 10)
 
[NewGame]
    Dim alphabet(26)
    Dim guess$(100)
 
    Cls
    Print Chr$(13);Chr$(13)
 
    Print "Welcome to Yotto"
    Print Chr$(13)
 
    Input "Directions";d$
    If Instr(Upper$(d$), "Y") Then
        Gosub [ShowDirections]
        Cls
    End If
    Print Chr$(13)
    Input "Load your own word list";wl$
    If Instr(Upper$(wl$), "Y") Then
        Gosub [FileTargetWord]
        demo = 0
    Else
        Gosub [DemoTargetWord]
        demo = 1
    End If
    nGuesses = 0
 
[MainLoop]
    Cls
    Print Chr$(13);Chr$(13)
 
    Gosub [Title]
    Gosub [gAlphabet]
    list$ = Space$(5)
    For i = 1 to Len(TargetWord$)
        list$ = list$;"*"
    Next i
    For i = 1 to nGuesses
        list$ = list$;Chr$(13);Chr$(10);Space$(5);guess$(i)
    Next i
    Print list$
    If Word$(guess$(nGuesses), 1) = TargetWord$ Then
        Goto [WinGame]
    End If
    If nGuesses = 100 Then
        Goto [LoseGame]
    End If
    Input " >> ";g$
    guess$ = Trim$(Lower$(g$))
    guess = 0
    condition = 0
    If guess$ = "exit" Then
        guess = -1
        condition = 1
    End If
    If Left$(guess$, 1) = "-" Then
        If condition = 0 Then
            Gosub [EliminateLetters]
            condition = 1
        End If
    End If
    If Left$(guess$, 1) = "+" Then
        If condition = 0 Then
            Gosub [SelectLetters]
            condition = 1
        End If
    End If
    If Left$(guess$, 1) = "?" Then
        If condition = 0 Then
            nGuesses = nGuesses + 1
            guess$(nGuesses) = Upper$(TargetWord$);Space$(5);"<<<<"
            condition = 1
        End If
    End If
    If Len(guess$) = 1 Then
        If condition = 0 Then
            Gosub [UnassignLetter]
            condition = 1
        End If
    End If
    If Instr(TargetList$, guess$) = 0 Then
        If condition + demo = 0 Then
            nGuesses = nGuesses + 1
            guess$(nGuesses) = guess$;Space$(5);"?"
            condition = 1
        End If
    End If
    If Len(guess$) = Len(TargetWord$) Then
        If condition = 0 Then
            guess = 1
            condition = 1
        End If
    End If
    If Len(guess$) <> Len(TargetWord$) Then
        If condition = 0 Then
            nGuesses = nGuesses + 1
            guess$(nGuesses) = guess$;Space$(5);"?"
            condition = 1
        End If
    End If
    If guess = 1 Then
        nGuesses = nGuesses + 1
        Gosub [YottoGuess]
        guess$(nGuesses) = YottoGuess$
    End If
    If guess = -1 Then
        End
    End If
    Goto [MainLoop]
 
[WinGame]
    Print "Congratulations!  You guessed"
    Print TargetWord$;" in ";nGuesses;" tries."
    Input "Press ENTER to End Game";z$
    End
 
[LoseGame]
    Print "Sorry... You were unable to guess"
    Print TargetWord$;" in ";nGuesses;" tries."
    Input "Press ENTER to End Game";z$
    End
 
[Title]
    HTML "<I><B><Font Color=Purple Size=5 Face=Verdana>YottoRB</Font></B></I>"
Return
 
[gAlphabet]
    #g Place(0, 0)
    #g Color("Gray")
    For y = 0 to 49
        #g Line(0, y, 400, y)
    Next y
    #g Color("Yellow")
    #g Place(10, 5)
    #g "\Eliminated Letters"
    x = 12
    For i = 1 to 26
        If alphabet(i) = -1 Then
            #g Place(x, 30)
            #g "\";Chr$(64 + i)
        End If
        x = x + 15
    Next i
    #g Color("Yellow")
    For y = 50 to 99
        #g Line(0, y, 400, y)
    Next y
    #g Color("Gray")
    #g Place(10, 55)
    #g "\Unassigned Letters"
    x = 12
    For i = 1 to 26
        If alphabet(i) = 0 Then
            #g Place(x, 80)
            #g "\";Chr$(64 + i)
        End If
        x = x + 15
    Next i
    #g Color("Purple")
    For y = 100 to 149
        #g Line(0, y, 400, y)
    Next y
    #g Color("Yellow")
    #g Place(10, 105)
    #g "\Select Letters"
    x = 12
    For i = 1 to 26
        If alphabet(i) = 1 Then
            #g Place(x, 130)
            #g "\";Chr$(64 + i)
        End If
        x = x + 15
    Next i
    Render #g
Return
 
[EliminateLetters]
    For i = 2 to Len(guess$)
        a = Asc(Upper$(Mid$(guess$, i, 1))) - 64
        If a > 0 Then
            If a < 27 Then
                alphabet(a) = -1
            End If
        End If
    Next i
Return
 
[UnassignLetter]
    a = Asc(Upper$(guess$)) - 64
    If a > 0 Then
        If a < 27 Then
            alphabet(a) = 0
        End If
    End If
Return
 
[SelectLetters]
    For i = 2 to Len(guess$)
        a = Asc(Upper$(Mid$(guess$, i, 1))) - 64
        If a > 0 Then
            If a < 27 Then
                alphabet(a) = 1
            End If
        End If
    Next i
Return
 
[YottoGuess]
    n$ = ""
    n = 0
    If guess$ = TargetWord$ Then
        For i = 1 to Len(TargetWord$)
            n$ = n$;"*"
        Next i
    Else
        For i = 1 to Len(guess$)
            If Instr(TargetWord$, Mid$(guess$, i, 1)) > 0 Then
                n = n + 1
            End If
        Next i
        n$ = Str$(n)
    End If
    YottoGuess$ = guess$;Space$(5);n$
Return
 
[DemoTargetWord]
    TargetList$ = "table aroma mixed stray plane maple quiet steam sword bread"
    x = Int(Rnd(1) * 10) + 1
    TargetWord$ = Word$(TargetList$, x)
Return
 
[FileTargetWord]
    TargetList$ = ""
    Upload "Open Word List >>";fName$
    Open fName$ for Input as #f
        While EOF(#f) = 0
            Input #f, w$
            TargetList$ = TargetList$;" ";w$
        Wend
    Close #f
    ct = 1
    While Word$(TargetList$, ct) <> ""
        ct = ct + 1
    Wend
    nWords = ct - 2
    x = Int(Rnd(1) * nWords) + 1
    TargetWord$ = Word$(TargetList$, x)
Return
 
[ShowDirections]
    Print "YottoRB"
    Print Chr$(13)
    Print "Object of the Game - Guess the word by"
    Print "   deciphering letters based upon clues given by"
    Print "   the computer.  Type in a word of the same"
    Print "   length and the computer will tell you how"
    Print "   many letters of your word are contained"
    Print "   within the target word."
    Print Chr$(13)
    Print "   Example - The target word is RANDOM. You type"
    Print "   MODERN.  The computer responds with 5, since"
    Print "   there are 5 letters common to both RANDOM and"
    Print "   MODERN (D, E, M, N, O)."
    Print Chr$(13)
    Print "   Letters may be entered using either upper or"
    Print "   lower case.  G works just as well as g."
    Print Chr$(13)
    Print "Eliminating and Selecting Letters - Keep track"
    Print "   of eliminated letters by entering a minus sign"
    Print "   before that letter.  Letters can be"
    Print "   as singles or multiples."
    Print Chr$(13)
    Print "   -B will eliminate the letter B."
    Print "   -BXY will eliminate the letters B, X, and Y."
    Print "   +E will select the letter E."
    Print "   +ERN will select the letters E, R, and N."
    Print Chr$(13)
    Print "Returning Letters to the Unassigned Area -"
    Print "   Return a letter to the unassigned area by"
    Print "   entering just that letter.  Letters to be"
    Print "   returned to the unassigned area must be"
    Print "   entered as a single letter only."
    Print Chr$(13)
    Print "   -A eliminates the letter A."
    Print "   A returns A to the unassigned area."
    Print "   +LPB selects the letters L, P, and B"
    Print "   P returns P to the unassigned area."
    Print Chr$(13)
    Print "Valid Entries - A valid entry is a word that is"
    Print "   of the same length (number of letters) as"
    Print "   the target word.  If you have uploaded a word"
    Print "   list, the entry will be checked against that"
    Print "   list for spelling and validity."
    Print Chr$(13)
    Print "   Example - The target word is WATER"
    Print "   PROPER is invalid (incorrect length)"
    Print "   PRPRP is invalid (if word list is being used)"
    Print Chr$(13)
    Print "Winning the Game - The game is won when the"
    Print "   correct word is entered.  The game must be"
    Print "   completed within 100 moves.  Eliminating,"
    Print "   selecting and returning letters to the"
    Print "   unassigned area do not count as a move."
    Print "   Invalid entries do count as a move."
    Print Chr$(13)
    Print "Exiting the Game - To exit the game, type"
    Print "   'exit' (letters only)."
    Print "Good luck!"
    Print Chr$(13)
    Input "Press ENTER to Return to Game";z$
Return