Buchempfehlung
Windows System Programming
Windows System Programming
Das Kompendium liefert viele interessante Informationen zur Windows-Programmierung auf Englisch. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Antivirus 1: Version 1.1

Uploader:MitgliedKing01
Datum/Zeit:08.09.2007 14:54:24

'Antivirus 1
'nach dreaels Tutorial

'umlaute  (funktion von Jojo)
function uml(blah as string) as string
select case blah
case "ä": return chr(132)
case "ö": return chr(148)
case "ü": return chr(129)
case "ß": return chr(225)
end select
end function

screen 18,12
color 0,15
cls

anfang:

const nGebiete% = 31   '32 Gebiete

dim Gebiet$(1 to nGebiete%), Nord%(1 to nGebiete%), Sued%(1 to nGebiete%)
dim West%(1 to nGebiete%), Ost%(1 to nGebiete%)
dim Suedost%(1 to nGebiete%), Suedwest%(1 to nGebiete%)
dim GebietStat$(1 to nGebiete%)

for i% = 1 to nGebiete%
    read Gebiet$(i%), Nord%(i%), Sued%(i%), West%(i%), Ost%(i%), Suedost%(i%), Suedwest%(i%), GebietStat$(i%)
next i

'Zustandstabelle
'       Gebiet                                      N   S   W   O  SO  SW   Status
data "RAM-Speicher",                                0,  0,  0,  0,  2,  3,  ""
data "Festplatte C:",                               1,  7,  3, -2,  6,  8,  ""
data "Festplatte D:",                               1,  9,  4,  2,  0,  0,  ""
data "E: (CD-Laufwerk)",                            0, 10,  5,  3,  0,  0,  ""
data "F: (USB-Stick)",                             -1, 11,  0,  4,  0,  0,  ""
data "C:\WINDOWS",                                  2,  0,  0,  0, 12, 13,  ""
data "C:\Users",                                    2, 14,  0,  0,  0,  0,  ""
data "C:\Games",                                    2,  0,  0,  0, 15, 16,  ""
data "D:\Programme",                                3,  0,  0,  0, 17, 18,  ""
data "E:\Backup",                                   4, 19,  0,  0,  0,  0,  ""
data "F:\mp3s",                                     5,  0,  0,  0,  0,  0,  ""
data "C:\WINDOWS\system32",                         6,  0,  0,  0,  0,  0,  ""
data "C:\WINDOWS\Drivers",                          6,  0,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r",                        7,  0,  0,  0, 20, 21,  ""
data "C:\Games\Steam",                              8,  0,  0,  0,  0,  0,  ""
data "C:\Games\Hotel-Manager",                      8,  0,  0,  0,  0,  0,  ""
data "D:\Programme\FreeBASIC",                      9,  0,  0,  0,  0,  0,  "Suche das Programm taskkill.exe"    'startposition
data "D:\Programme\OpenOffice.org",                 9,  0,  0,  0,  0,  0,  ""
data "E:\Backup\Fotos",                            10,  0,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Eigene Dateien",        14,  0,  0,  0, 25, 26,  ""
data "C:\Users\1337-h4XX0r\Desktop",               14,  0,  0,  0, 27, -3,  ""
data "C:\Games\Steam\Steam-Apps",                  15,  0, -4,  0, 23, 24,  ""
data "C:\Games\Steam\Steam-Apps\Counter-Strike",   22,  0, 24,  0,  0,  0,  ""
data "C:\Games\Steam\STeam-Apps\Half-Life",        22,  0,  0, 23,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Eigene Dateien\files",  20, 28,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Eigene Dateien\docs",   20,  0,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Desktop\fotos",         21,  0,  0,  0, 31, 32,  ""
'                                                               N   S   W   O  SO  SW   Stat
data "C:\Users\1337-h4XX0r\Eigene-Dateien\files\downloads",    25, -5,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Eigene Dateien\files\mp3s",         25,  0,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Desktop\fotos\urlaub",              27,  0,  0,  0,  0,  0,  ""
data "C:\Users\1337-h4XX0r\Desktop\fotos\ausflug",             27,  0,  0,  0,  0,  0,  ""

'Gegenstände
const nGegenstaende% = 5
dim Gegenstand$(1 to nGegenstaende%), Ort% (1 to nGegenstaende)
for i% = 1 to nGegenstaende%
    read Gegenstand$(i%), Ort%(i%)
next i%

data "taskkill.exe",    12
data "fbc.exe",         17
data "Fotos",           19
data "mp3s",            30
data "Rechnung",        27

'Spielstart
AktPos% = 17
InSpiel% = -1
NeuPos% = AktPos%

menu:

cls
print "Willkommen bei Antivirus!"
print
print "1) Neues Spiel starten"
print "2) Spiel laden"
print "3) Befehls"; uml("ü"); "bersicht sehen"
print "4) Hilfe aufrufen"
print "5) Beenden"
print
input "Was willst du tun? ", menu_abfrage%
select case menu_abfrage%
case 1
    goto start
case 2
    print
    input "Dateiname: ",saveg$
    open saveg$ for input as 1
        input #1, Kennung$
        if Kennung$ <> "Antivirus" then
            print "Keine g"; uml("ü"); "ltige Spielstanddatei!!!"
        else
            input #1, AktPos%
            for i% = 1 to nGegenstaende%
                input #1, Ort%(i%)
            next i%
        end if
    close 1
case 3
    color 4                                                                                 'rot anfang
    print                                                                                   'rot
    print "Der Befehlswortschatz umfasst folgende Kommandos:"                               'rot
    print "gehe h"; uml("ö"); "her|tiefer|links|rechts oder Abk"; uml("ü"); "rzung h|t|l|r" 'rot
    print "nimm|leg <Gegenstand>"                                                         'rot
    print "speichereals|lade <dateiname.erw>"                                             'rot
    print "Leertaste dr"; uml("ü"); "cken"                                                  'rot
    sleep                                                                                   'rot
    color 0                                                                                 'rot ende
    goto menu
case 4
    color 4                                         'rot anfang
    print "Hilfe noch nicht verf"; uml("ü"); "gbar" 'rot
    sleep                                           'rot
    color 0                                         'rot ende
case 5
    cls
    end
end select

start:

cls
print "Vorgeschichte: Jimmy programmiert gerne in FreeBASIC. Er ist 16 Jahre alt."
print "Er surft sehr gerne im Internet, chattet und ladet sich viele Programme und"
print "Spiele aus dem Internet runter."
print "Zur zeit merkt er immer wieder, dass bei seinem Computer etwas nicht stimmt."
print "Er f"; uml("ü"); "rchtet, dass ein Virus in sein System eingedrungen ist."
print "Darauf schreibt er einen Antivirus-Programm in FreeBASIC und l"; uml("ä"); "sst das"
print "Programm den Computer absuchen."
print
print "Du bist nun der Antivirus!"
print
print "Leertaste dr"; uml("ü"); "cken!"
sleep
cls

while InSpiel%
    print
    color 4             'rot anfang
    print "Ort: "       'rot
    print "---- "       'rot
    color 0             'rot ende
    print Gebiet$(AktPos%)
    print
    color 4                                         'rot anfang
    print "M"; uml("ö"); "gliche Gehrichtungen: "   'rot
    print "-----------------------"                 'rot
    color 0                                         'rot ende
    if Nord%(AktPos%) <> 0 then
        print " h"; uml("ö"); "her"
    end if
    if Sued%(AktPos%) <> 0 then
        print " tiefer"
    end if
    if West%(AktPos%) <> 0 then
        print " links"
    end if
    if Ost%(AktPos%) <> 0 then
        print " rechts"
    end if
    if Suedwest%(AktPos%) <> 0 then
        print " links tiefer"
    end if
    if suedost%(AktPos) <> 0 then
        print " rechts tifer"
    end if
    print
    color 4         'rot anfang
    print "Status: "        'rot
    print "------- "        'rot
    color 0         'rot ende
    print GebietStat$(AktPos%)
    print
    color 4                                                 'rot anfang
    print "Gegenst"; uml("ä"); "nde in diesem Bereich: "    'rot
    print "---------------------------- "                   'rot
    color 0                                                 'rot ende
    h% = 0
    for i% = 1 to nGegenstaende%
        if Ort%(i%) = AktPos% then
            print " "; Gegenstand$(i%)
            h% = h% + 1
        end if
    next i%
    if h% = 0 then
        print " keine"
        print
    else
        print
    end if
    input "Was willst du tun?", bef$
    h% = instr(bef$, " ")
    if h% >0 then
        verb$ = left$(bef$, h% - 1)
        objekt$ = mid$(bef$, h% + 1)
    else
        verb$ = bef$
        objekt$ = ""
    end if
    select case lcase$(verb$)
    case " h", "h"
        NeuPos% = Nord%(AktPos%)
    case " t", "t"
        NeuPos% = Sued%(AktPos%)
    case " l", "l"
        NeuPos% = West%(AktPos%)
    case " r", "r"
        NeuPos% = Ost%(AktPos%)
    case " rt", "rt"
        NeuPos% = Suedwest%(AktPos%)
    case " lt", "lt"
        NeuPos% = Suedost%(AktPos%)
    case " gehe", "gehe"
        select case lcase$(objekt$)
        case "hoch"
            NeuPos% = Nord%(AktPos%)
        case "tiefer"
            NeuPos% = Sued%(AktPos%)
        case "links"
            NeuPos% = West%(AktPos%)
        case "rechts"
            NeuPos% = Ost%(AktPos%)
        case "rechts tiefer"
            NeuPos% = Suedwest%(AktPos%)
        case "links tiefer"
            NeuPos% = Suedost%(AktPos%)
        case else
            color 4                         'rot anfang
            print "In welche richtung???"   'rot
            color 0                         'rot ende
            sleep
        end select
    case " cheat", "cheat"
        select case lcase$(objekt$)
        case "thereistaskkill"
            NeuPos% = 12
        case "imondrivec"
            NeuPos% = 2
        case "gotoram"
            NeuPos% = 1
        case "therightway"
            NeuPos% = 7
        case "thebestway"
            NeuPos% = 20
        end select
    case  " speicher", "spiecher"
        open  objekt$ for output as 1
        print #1, "Antivirus"
        print #1, AktPos%
        for i% = 1 to nGegenstaende%
            print #1, Ort%(i%)
        next i%
        color 4                         'rot anfang
        print "Spielstand gespeichert"  'rot
        color 0                         'rot ende
    case " lade", "lade"
        open objekt$ for input as 1
        input #1, Kennung$
        if Kennung$ <> "Antivirus" then
            color 4                                                 'rot anfang
            print "Keine g"; uml("ü"); "ltige Spielstanddatei!!!"   'rot
            color 0                                                 'rot ende
        else
            input #1, AktPos%
            for i% = 1 to nGegenstaende%
                input #1, Ort%(i%)
            next i%
        end if
        close 1
    case " nimm", "nimm"     'Gegenstandsverwaltung
        h% = 0
        for i% = 1 to nGegenstaende%
            if lcase$(Gegenstand$(i%)) = lcase$(objekt$) and Ort%(i%) = AktPos% then
                h% = i%
            end if
        next i%
        if h% <> 0 then
            color 4                                 'rot anfang
            print Gegenstand$(h%); " aufgelesen"    'rot
            color 0                                 'rot ende
            Ort%(h%) = 0
        else
            color 4                         'rot anfang
            print "Hier ist kein "; objekt$ 'rot
            color 0                         'rot ende
        end if
    case " leg", "leg"
        h% = 0
        for i% = 1 to nGegenstaende%
            if lcase$(Gegenstand$(i%)) = lcase$(objekt$) and Ort%(i%) = 0 then
                h% = i%
            end if
        next i%
        if h% <> 0 then
            color 4             'rot anfang
            print gegenstand$(h%); " abegelegt" 'rot
            color 0             'rot ende
            Ort%(i%) = AktPos%
        else
            color 4             'rot anfang
            print "Du hast kein "; objekt$  'rot
            color 0             'rot ende
        end if
    case " inventar", "inventar"
        color 4             'rot anfang
        print "Du hast folgendes: " 'rot
        print "------------------ " 'rot
        print               'rot
        color 0             'rot ende
        h% = 0
        for i% = 1 to nGegenstaende%
            if Ort%(i%) = 0 then
                print Gegenstand$(i%)
                h% = h% + 1
            end if
        next i%
        if h% = 0 then
            print "Nichts"
        else
            print "Total "; h%; " Gegenst"; uml("ä"); "nde"
        end if
        sleep
    case " hilfe", " ?", "hilfe", "?"
        color 4                                                     'rot anfang
        print                                                       'rot
        print "Der Befehlswortschatz umfasst folgende Kommandos:"   'rot
        print "gehe hoch|tiefer|links|rechts oder Abk"; uml("ü"); "rzung h|t|l|r" 'rot
        print "nimm|leg <Gegenstand>"                             'rot
        print "speicher|lade <dateiname.erw>"                     'rot
        print                                                       'rot
        print "Leertaste dr"; uml("ü"); "cken"                      'rot
        sleep                                                       'rot
        color 0                                                     'rot ende
        cls
    case " ende", " beenden", " end", " exit", " system", "ende", "beenden", "end", "exit", "system"
        cls
        end
    case else
        color 4                                                     'rot anfang
        print                                                       'rot
        print "Falsches Kommando"                                   'rot
        print "Versuche es nochmal oder gib 'hilfe' bzw. '?' ein"   'rot
        print "Leertaste dr"; uml("ü"); "cken"                      'rot
        sleep                                                       'rot
        color 0                                                     'rot ende
        cls
    end select
    if NeuPos% = 0 then
        color 4                 'rot anfang
        print                   'rot
        print "Da kannst du nicht hin!"     'rot
        print "Leertaste dr"; uml("ü"); "cken"  'rot
        sleep                   'rot
        color 0                 'rot ende
        cls
    else
        AktPos% = NeuPos%
        if NeuPos% < 0 then
            InSpiel% = 0     '0 = FALSE (Boolean)
        end if
    end if
    cls
wend

'schluss
if AktPos% = -5 then
    color 4                     'rot anfang
    print "Du bist am Ziel!"    'rot
    color 0                     'rot ende
    sleep
    if Ort%(1) <> 0 then
        color 4                                                                                         'rot anfang
        print "Du hast taskkill.exe vergessen, deshalb konnte dich der Virus zerst"; uml("ö"); "ren."   'rot
        color 0                                                                                         'rot ende
    else
        color 4                     'rot anfang
        print "Du hast gewonnen!!!" 'rot
        color 0                     'rot ende
    end if
else
    color 4
    if AktPos% = -1 then
        print "Leider bist du au"; uml("ß"); "erhalb des Systems geraten und wurdest somit gel"; uml("ö"); "scht!"
    elseif AktPos% = -2 then
        print "Leider bist du in den Papierkorb gefallen!"
    elseif AktPos% = -3 then
        print "Ups, du bist in den Papierkorb geraten!"
    elseif  AktPos% = -4 then
        print "Dich hat leider das uninstall-Programm von Steam erwischt!"
    else
        print "Programmierfehler! Bitte lesen sie die readme.txt!"
    end  if
    sleep

    print "Du bist tot!"
    sleep
    goto anfang
end if