******************************************************************************************************
Remember to submit your CSP Programming Project in time if you are taking the exam!
Use the AP Digital Portfolio to submit all three components:
1. Program Code, 2. Video, and 3. Personalized Project Reference.
Submit the Personalized Project Reference as final by the 30th to have it available on exam day.
Submit everything early to avoid submission errors because of high system usage on the 30th.
******************************************************************************************************
Read AP Text Book: pp. 166-178
NOTE: Java Text Book page 1 is page 35 of the PDF. In the assignments and labs, the page numbers are the actual book page numbers (not the PDF page numbers). To calculate the PDF page number, just add 34 to the actual book page number! AP Text Book is an electronic document without book page numbers, so the page numbers are always PDF page numbers for AP Text Book.
Implement a simple AWT/Swing application that displays a message in a JLabel component. The JLabel should be added to a JFrame. You can begin with the code on pg. 648 of Java Text Book. Try making some changes, and begin considering how to implement your project using AWT/Swing.
Semester Project Completion : Implement Rules 6-8.
Complete the remaining rules. Write a brief description of your implementation. Email your group's completed program and description to [email protected]
Implement Rule 5.
Implement Rule 4. Check to make sure that your computer player now blocks the opponent's fork(s) if necessary.
Implement Rule 3. Check to make sure that your computer player now forks its opponent if possible.
TicTacToe_004.java (Fill in the blanks: BLANK_0 and BLANK_1.)
Implement Rule 2. Check to make sure that your computer player now blocks its opponent's two-in-a-line. This is very similar to Rule 1. The code is almost identical, so you can copy the code from Rule 1 and make one small change to complete this implementation.
TicTacToe_003.java (Fill in the blank: BLANK_0)
Beginning from TicTacToe_002.java , begin to implement a strategic algorithm in the computer_move2() method (that plays better than randomly). See the algorithm in the article linked to from the Semester Project Resources page. For this lab, implement Rule 1. Check to make sure that your computer player now wins when you fail to block its two-in-a-line.
TicTacToe_002.java (Implement rule 1 in the computer_move2() method.)
If you haven't already, extend TicTacToe_001 to handle incorrect user input, and to check for a win or draw. Try to implement this check efficiently. Once that is working, write a method called computer_move, which returns a position where the computer player should move, based on the current board configuration. Use this method in the main game loop to implement a computer player.
TicTacToe_002.java (Fill in the blank: BLANK_0, to complete the win() method.)
Complete the implementation of the min function (BLANK_0) in the Util class. Complete the implementation of sort1 (BLANK_1) in the Util class.
TestUtil.java2023-2024 Spring
Extend TicTacToe_002 to check for a win or draw. The program should also make sure the move is legal (Week 3) and announce the winner or a draw.
TicTacToe_002.java (Fill in the blank: BLANK_0, to complete the win() method.)
Extend TicTacToe_001 to check for a valid move.
Begin working on the tic-tac-toe game. Using the following sample code, write a program that accepts either a grid number (0-8) or a row (0-2) and column (0-2) from the keyboard, and then updates the board to place either an X (0) or an O (1) in the appropriate square. Then print the board to the console.
1. Translate the following algorithm from AP CSP style block-based pseudo-code into a working Java program.
2. Translate the following algorithm from AP CSP style block-based pseudo-code into a working Java program that contains an equivalent logical error. Then fix the error.
3.Translate the following algorithm from AP CSP style block-based pseudo-code into a syntactically correct Java program that contains the equivalent run-time error. Then fix the error.
1. Copy the installation file from my USB drive to your PC. Choose the one for your system architecture :
2. Create a projects/ folder. Inside projects/ create a project folder called Hello/. Using a text editor (notepad.exe on Windows, or TextEdit on Mac), create a new plain text file called Hello.java containing the example soure code that was presented in class and sent to the group. :
3. Using the command line interface (e.g. cmd.exe on Windows), use javac to compile projects/Hello/Hello.java , which will generate projects/Hello/Hello.class. (As we discussed in class, the details of this step depend on whether you use a .zip or .tar.gz archive or one of the automatic installers. In this example, the .zip archive has been extracted and the javac and java commands in the bin/ directory are being accessed using their absolute path names.):
4. Now run your program using the java command :
Read AP Text Book: pp. 166-178
Read AP Text Book: pp. 166-178
Read AP Text Book: pp. 166-178
Read AP Text Book: pp. 166-178