From ee141149f7fde96c28d44c3decdbc5f0267aba23 Mon Sep 17 00:00:00 2001 From: masykur Date: Sat, 26 Feb 2022 08:47:53 +0700 Subject: [PATCH] Bug fix of C# logic and ignore .vscode/ folder --- .gitignore | 1 + 89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d2115efc..f23bcbe8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.class */.vs *.suo +.vscode/ bin/ obj/ diff --git a/89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs b/89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs index 58f7d36f..d4955a40 100644 --- a/89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs +++ b/89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs @@ -33,13 +33,15 @@ while(true) { d = move(c + 3); computerMoves(d); s = readYourMove(); - if (s != move(d + 4)) { + if (s == move(d + 4)) { + e = move(d + 6); + computerMoves(e); + Console.WriteLine("THE GAME IS A DRAW."); + } else { e = move(d + 4); computerMoves(e); + Console.WriteLine("AND WINS ********"); } - e = move(d + 6); - computerMoves(e); - Console.WriteLine("THE GAME IS A DRAW."); } else { d = move(c + 7); computerMoves(d);