Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
I am creating a puzzle in VB but i have hit a wall, the puzzle wont change the Symbols to letters.

Here is my code:
VB
Module Module1

    Sub Main()
        Dim FileLoad As IO.StreamReader
        Dim WordsFile(10) As String
        Dim CluesFile(3) As String
        Dim PlayerLetters As String
        Dim PlayerSymbols As String
        Dim letters(26, 2) As String
        Dim temp As String
        Dim UsedHint As String

        'Hands over the words file to the StreamReader Function.
        FileLoad = New IO.StreamReader("H:\KS4\Year 11\Computer Science\words.txt")
        'This reads the Encrypted words from the Words file.
        For x = 1 To 10
            WordsFile(x) = FileLoad.ReadLine
        Next
        'This will close the file
        FileLoad.Close()
        For x = 1 To 10
            Console.WriteLine(x & ".  " & WordsFile(x))
        Next
        'Loads the clues file into StreamReader Function.
        FileLoad = New IO.StreamReader("H:\KS4\Year 11\Computer Science\clues.txt")
        'This reads the Clues from the clues file.
        For x = 1 To 3
            CluesFile(x) = FileLoad.ReadLine
        Next
        Console.WriteLine("Would you like to use clues if so press Enter!")
        Console.ReadLine()
        FileLoad.Close()
        'The puzzle writes this line in the game.
        Console.WriteLine("Here are the clues, use them wisely...")
        For x = 1 To 3
            Console.WriteLine(CluesFile(x))
        Next
        Console.ReadLine()
        Console.WriteLine("The clues have now been subsutted into the puzzel!")
        For x = 1 To 10
            For y = 1 To (CluesFile.Length - 1)
                temp = CluesFile(y)

                PlayerLetters = temp.Chars(0)
                PlayerSymbols = temp.Chars(1)
                WordsFile(x) = Replace(WordsFile(x), PlayerSymbols, PlayerLetters)

                For z = 1 To 26
                    If letters(z, 1) = PlayerLetters Then
                        letters(z, 2) = PlayerSymbols
                    End If
                Next
            Next
        Next
        For x = 1 To 10
            Console.WriteLine(x & ", " & WordsFile(x))
        Next
        UsedHint = True
        Console.ReadLine()
    End Sub

End Module


Please can someone help me i really need your help!
Posted
Updated 25-Sep-14 4:43am
v2
Comments
Sergey Alexandrovich Kryukov 25-Sep-14 10:25am    
This is just a code dump, not a question. You need to explain the problem properly.
—SA
Leo Chapiro 25-Sep-14 10:42am    
Have you tried to debug your source code to localize the problem? Sometimes it helps :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900