I am trying to create an ai. I have got it to write a topic with information to a text file but cant get it to read. this is what i have so far. Any ideas on why it isnt working?
string information = "blank";
Console.WriteLine("Hello my name is Lou-C.");
Console.WriteLine("What is yours?");
string name = Console.ReadLine();
Console.WriteLine("Hello {0}, What do you want to talk about?", name);
string topic = Console.ReadLine();
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\simon.light\Documents\Visual Studio 2013\Projects\Lou-c\Lou-c\information.txt");
if (lines.Contains("beat"))
{
Console.WriteLine("Aaahh, {0}, I have heard of this before");
Console.WriteLine("Tell me what you know about this");
information = Console.ReadLine();
}
else
{
Console.WriteLine("{0}? I don't think i have come across this before.", topic);
Console.WriteLine("Tell me about it");
information = Console.ReadLine();
}
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(@"C:\Users\simon.light\Documents\Visual Studio 2013\Projects\Lou-c\Lou-c\information.txt", true))
{
file.WriteLine("${0} - %{1} - by {2}", topic, information, name);
}