This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tictac4a.htm
53 lines (53 loc) · 3.25 KB
/
tictac4a.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Keith Fenske">
<meta name="GENERATOR" content="Mozilla/4.8 [en] (Windows NT 5.0; U) [Netscape]">
<title>Tic-Tac-Toe, Ticktacktoe, X's and O's, Naughts and Crosses - by: Keith Fenske</title>
</head>
<body background="ffcccc.gif">
<center><applet code="TicTacToe4.class" archive="tictac4b.jar" width="95%" height="90%">
<p><b><font size=+1>Sorry, your browser does not support Java.</font></b></applet></center>
<p>This web page is a Java applet to play the child's game of Tic-Tac-Toe
(also known as Ticktacktoe, X's and O's, Naughts and Crosses). Click
the mouse on a position of your choice. You are the magenta X's,
and you move first. The computer has the blue O's. To win,
you must have a complete horizontal line, a complete vertical line, or
a complete diagonal line. There can be several diagonals. Winning
lines are shown in red.
<p>For instructions on how best to play the game ... ask a child!
The only weird part is that the number of rows and columns can be different.
The computer plays a reasonably good game but can be easily beaten on a
small game board. The first person to move can't lose ... unless
they make a mistake. We are often blinded by our own planning.
If the board has three rows and five columns, you concentrate so much on
winning in one direction that you don't see the computer's move in another
direction until the game is over. As the board gets larger, you have
more trouble seeing all the possibilities. The computer's algorithm
doesn't miss an opportunity.
<p><hr>
<p><a NAME="java"></a>If this web page begins with an error message saying
that your browser does not support Java, then either your computer doesn't
have Java, or Java is not enabled. If you see an empty rectangle
where the applet should be, then you have Java but need a newer browser
or a newer version of Java. For Internet Explorer 5 or later, Firefox,
Mozilla, and Netscape 7.x or later on Windows, you may download the Sun
Java run-time environment (JRE) from <a href="http://www.java.com/getjava/">http://www.java.com/getjava/</a>
on Sun's web site. This program was written on and tested against
Sun Java 1.4.
<p>The <a href="tictac4c.txt">source code</a> for this applet is available,
even though writing a similar Java program is an assignment for students,
and I'm sure that some students won't do their own homework. (Hint:
six special cases for traversing lines in the game board can be replaced
by one generalized method using starting positions and directions.)
You may also <a href="tictac4d.zip">download the application</a> as a <a href="freesoft.htm#zip">ZIP
archive</a> with the executable Java class files and the documentation
in <a href="freesoft.htm#acrobat">Adobe Acrobat</a> PDF format. More
programming assignments and solutions can be found on my "<a href="cpindex.htm">Computer
Programming Examples</a>" web page.
<p>Copyright (c) 2004 by Keith Fenske. Released under the GNU General
Public License (GPL).
<p><hr>
</body>
</html>