Yes, in high school I programmed a computer to play tic-tac-toe using BASIC. Then I programmed it to play "Battleships". That was more complicated... required several hundred lines of code, if I remember correctly.
Haven't really used it since, except occasionally in math or physics courses in college to solve equations iteratively.