Added win detect and artificial intelligence