As practice coding with writing functions, conditional expressions, and loops, we develop a small tic-tac-toe video game via 7 versions, where each version after the first adds a little code to the previous working version.
Please download tic1.R, listen to the screencast tic1.mp4, and run tic1.R yourself. Study and modify tic1.R and ask questions about it until you understand it. Then repeat this process for versions 2, 3, ..., 7.
Later you will do homework implementing Connect Four, a similar game.
tic1.R, tic1.mp4 (4:40)
tic2.R, tic2.mp4 (2:35)
tic3.R, tic3.mp4 (4:22)
tic4.R, tic4.mp4 (5:39)
tic5.R, tic5.mp4 (2:31)
tic6.R, tic6.mp4 (4:12)
tic7.R, tic7.mp4 (14:06)
Develop your own programs incrementally, saving working versions of increasing complexity as you go. That way, when something breaks and you can't get the current version working, you can go back to the previous working version as a help to debugging the broken version. You always have a working version when a homework deadline or your boss appears.