AP Computer Science Principles (AP CSP)

Grading

******************************************************************************************************

 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.

******************************************************************************************************

AP Text Book: AP Computer Science Principles

Java Text Book: Introduction to Programming with Java

Java Tutorial: https://docs.oracle.com/javase/tutorial/tutorialLearningPaths.html


Current Assignment:

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.


Labs

Semester II, Week 1

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.

SimpleWindow.java

SimpleWindow2.java

SimpleWindow3.java


Semester I


Week 18

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]

Week 14

Implement Rule 5.

TicTacToe_006.java

Move.java

Week 11

Implement Rule 4. Check to make sure that your computer player now blocks the opponent's fork(s) if necessary.

TicTacToe_005.java

Move.java

Week 7

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.)

Move.java

Weeks 4-5

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)

Move.java

Week 3

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.)

Move.java

Week 2

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.)

Move.java

Week 1

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.java


2023-2024 Spring


Week 4-6

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.)

Move.java

Week 3

Extend TicTacToe_001 to check for a valid move.

TicTacToe_001.java

Week 2

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.

TicTacToe_000.java

Week 1

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 :

Alternatively, install an IDE, such as IntelliJ or Eclipse, and use that to create, compile/build, and run your program.

Assignments:

Week 4

Read AP Text Book: pp. 166-178

Week 3

Read AP Text Book: pp. 166-178

Week 2

Read AP Text Book: pp. 166-178

Week 1

Read AP Text Book: pp. 166-178