The answer to this question lies in understanding how threads work. A thread is a "line" of program execution. Because our computers run many programs (but only have one CPU) it is necessary for the OS to be able to stop one "line" and allow another to run. These "lines" are called threads.
When a thread is "paused" it is said that it is "blocked". Threads can block themselves (allowing other threads to run) as well. That is effectively what Thread.Sleep
does, it blocks the executing thread and will not run again until the specified time interval elapses.
If you do this on your main (UI) thread, then your UI will not update and no other code on that thread will run until it is unblocked. With your scenario, it sounds like you need a thread for your "computer player" to place blocks and then sleep for a while. By the way a timer is basically just a nice wrapper for this same behavior (spin a thread, wait for the interval, recall, repeat).
In other words, Thread.Sleep
does far more than just "delay" an action, to use it effectively you need to make sure you understand your code's threading model. It sounds like you are always on the UI thread, and you probably need to start some of your own.
Note that if you are not on the UI thread, you need to perform UI tasks in an Invoke
method. This pushes execution of that code onto the UI thread.
Let me know if I can be of further assistance!