Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [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 beta 2

Uploader:MitgliedKing01
Datum/Zeit:19.06.2007 17:39:56

'Antivirus beta 1
'nach dreaels Tutorial

const nGebiete% = 32   '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 "C:\Programme\FreeBASIC",                      9,  0,  0,  0,  0,  0,  "Suche das Programm taskkill.exe"    'startposition
data "C:\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, 29,  0,  0,  0,  0,  ""
data "C:\USers\1337-h4XX0r\Eigene Dateien\files\downloads\old",28,  0,  0,  0,  0,  0,  "Du bist am Ziel!"    'ziel
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%

print "Willkommen bei Antivirus!"
print
print "Story: 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ürchtet, dass ein Virus in sein System eingedrungen ist."
print "Darauf schreibt er einen Antivirus-Programm in FreeBASIC und lässt das"
print "Programm den Computer absuchen."
print
print "Du bist nun der Antivirus!"
print
print "Leertaste drücken!"
sleep
cls

while InSpiel%
    print
    print "Du befindest dich in "; Gebiet$(AktPos%)
    print
    print GebietStat$(AktPos%)
    print
    print "Mögliche Gehrichtungen: ";
    if Nord%(AktPos%) <> 0 then
        print " hö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
    print GebietStat$(AktPos%)
    print
    print "Gegenstände in diesem Bereich: ";
    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"
    else
        print
    end if
    line 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"
        NeuPos% = Nord%(AktPos%)
    case "t"
        NeuPos% = Sued%(AktPos%)
    case "l"
        NeuPos% = West%(AktPos%)
    case "r"
        NeuPos% = Ost%(AktPos%)
    case "rt"
        NeuPos% = Suedwest%(AktPos%)
    case "lt"
        NeuPos% = Suedost%(AktPos%)
    case "gehe"
        select case lcase$(objekt$)
        case "höher"
            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
            print "In welche richtung???"
        end select
    case  "speichereals"
        open  objekt$ for output as 1
        print #1, "Antivirus"
        print #1, AktPos%
        for i% = 1 to nGegenstaende%
            print #1, Ort%(i%)
        next i%
        print "Spielstand gespeichert"
    case "lade"
        open objekt$ for input as 1
        input #1, Kennung$
        if Kennung$ <> "Antivirus" then
            print "Keine gültige Spielstanddatei!!!"
        else
            input #1, AktPos%
            for i% = 1 to nGegenstaende%
                input #1, Ort%(i%)
            next i%
        end if
        close 1
    case "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
            print Gegenstand$(h%); " aufgelesen"
            Ort%(h%) = 0
        else
            print "Hier ist kein "; objekt$
        end if
    case "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
            print gegenstand$(h%); " abegelegt"
            Ort%(i%) = AktPos%
        else
            print "Du hast kein "; objekt$
        end if
    case "inventar"
        print "Du hast folgendes: "
        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ände"
        end if
    case "hilfe", "?"
        print
        print "Der Befehlswortschatz umfasst folgende Kommandos:"
        print "gehe höher|tiefer|links|rechts oder Abkürzung h|t|l|r"
        print "nimm|leg <Gegenstand"
        print "speichereals|lade <dateiname.erw>"
        print "Leertaste drücken"
        sleep
        cls
    case "ende", "beenden", "end"
        cls
        end
    case else
        print
        print "Falsches Kommando"
        print "Versuche es nochmal oder gib 'hilfe' bzw. '?' ein"
        print "Leertaste drücken"
        sleep
        cls
    end select
    if NeuPos% = 0 then
        print
        print "Da kannst du nicht hin!"
        print "Leertaste drücken"
        sleep
        cls
    else
        AktPos% = NeuPos%
        if NeuPos% < 0 then
            InSpiel% = 0     '0 = FALSE (Boolean)
        end if
    end if
    cls
wend

'schluss
if AktPos% =  29 then
    print "Du bist am Ziel!"
    if Ort%(1) <> 0 then
        print "Du hast taskkill.exe vergessen,"
        print "deshalb hat dich der Virus zerstört!"
    else
        print "Du hast gewonnen!!!"
    end if
else
    if AktPos% = -1 then
        print "Leider bist du außerhalb des Systems geraten und wurdest somit gelö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

    print "Du bist tot!"
end if