Untitled
unknown
csharp
a year ago
1.5 kB
15
Indexable
/* KZG - AI Chatbot do gry */
using System;
using System.Collections.Generic;
class HelloWorld {
static void Main()
{
bool uruchomionoCzat = true;
while(uruchomionoCzat) // while(true)
{
Console.WriteLine("Witaj w Fortnite AI Chatbot ! Jak mogę ci pomóc ?");
string wprowadzonyTekst = Console.ReadLine();
Console.WriteLine("Zadane pytanie: " + wprowadzonyTekst.ToLower());
if (SprawdzSlowaKluczowe(wprowadzonyTekst, "koniec"))
{
uruchomionoCzat = false;
Console.WriteLine("AI : Dziekujemy za skorzystanie z Fortnite AI Chatbot ! Powodzenia w grze!");
}
Console.WriteLine("---");
}
}
static Dictionary<string, List<string>> slowaKluczowe = new Dictionary<string, List<string>>()
{
{ "broń", new List<string> { "broń", "bron", "ekwip", "eq" } },
{ "materiały", new List<string> {"mat", "materi", "skrzyn", "surowce" } },
{ "koniec", new List<string> { "dzieki", "dzięki", "wyjście", "exit", "wyjsc", "koniec", "nara" }},
};
static bool SprawdzSlowaKluczowe(string userInput, string category)
{
if (slowaKluczowe.ContainsKey(category))
{
foreach (var keyword in slowaKluczowe[category])
{
if (userInput.Contains(keyword))
{
return true;
}
}
}
return false;
}
}Editor is loading...
Leave a Comment