Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tiny Mastermind
#2
I like the tiny game! Works fine
   

But about that line count
   

Search is not helping find Pete's code so here it is instead of link:
Code: (Select All)
Print "Line count analysis...": Print ' 1

Print "Press [1] to parse all colons or [2] the exclude colons after an IF statement.": Print '2

Do
    _Limit 30
    b$ = InKey$
    If Len(b$) Then
        Select Case b$
            Case Chr$(27): System ' 3
            Case "1": myopt = 3: Print "Parsing all significant colons...": Print ' 6
            Case "2": myopt = 4: Print "Parsing all significant colons not used in IF/THEN one line statements.": Print ' 9
        End Select
        If myopt Then Exit Do
    End If
Loop

x$ = _Clipboard$ + Chr$(13)

Do
    ' parse clipboard
    statement$ = UCase$(Mid$(x$, 1, InStr(x$, Chr$(13)) - 1))
    If statement$ = Chr$(10) Then statement$ = ""
    x$ = Mid$(x$, InStr(x$, Chr$(13)) + 1)

    If Len(_Trim$(statement$)) Then
        program_ide_lines = program_ide_lines + 1
        For i = 1 To myopt
            Select Case i
                Case 1: mychr$ = Chr$(34) '10
                Case 2: mychr$ = "'" '11
                Case 3: mychr$ = "REM " '12
                Case 4: mychr$ = " THEN " '13
            End Select

            Select Case i
                Case 1 '  Double polling for enclosed quotes.
                    Do Until InStr(statement$, mychr$) = 0
                        If InStr(statement$, mychr$) Then
                            statement$ = Mid$(statement$, 1, InStr(statement$, mychr$) - 1) + Mid$(statement$, InStr(InStr(statement$, mychr$) + 1, statement$, mychr$) + 1)
                        End If
                    Loop
                Case Else
                    Do Until InStr(statement$, mychr$) = 0
                        If InStr(statement$, mychr$) Then
                            statement$ = Mid$(statement$, 1, InStr(statement$, mychr$) - 1)
                        End If
                    Loop
            End Select
        Next
        If Right$(RTrim$(statement$), 1) = ":" Then statement$ = Mid$(RTrim$(statement$), 1, Len(RTrim$(statement$)) - 1) ' ??

        Rem PRINT statement$,

        ' count colons

        seed% = 0: linecnt = linecnt + 1: real_line_cnt = real_line_cnt + 1 '  15
        Do Until InStr(seed%, statement$, ":") = 0 ' ??
            seed% = InStr(seed%, statement$, ":") + 1 ' ??
            real_line_cnt = real_line_cnt + 1
        Loop
    Else
        program_ide_lines = program_ide_lines + 1
    End If
Loop Until x$ = ""
Print "Program IDE lines ="; program_ide_lines; "  Line count ="; linecnt; "  Real line count ="; real_line_cnt


' 66 lines  9 blank lines  = 57 + 15 colons = 72
b = b + ...
Reply


Messages In This Thread
Tiny Mastermind - by johannhowitzer - 03-25-2023, 11:45 PM
RE: Tiny Mastermind - by bplus - 03-26-2023, 01:35 AM
RE: Tiny Mastermind - by johannhowitzer - 03-26-2023, 01:36 PM
RE: Tiny Mastermind - by bplus - 03-26-2023, 02:53 PM
RE: Tiny Mastermind - by mnrvovrfc - 03-26-2023, 03:38 PM
RE: Tiny Mastermind - by johannhowitzer - 03-27-2023, 12:41 AM



Users browsing this thread: 1 Guest(s)