1130tutorial7

1130tutorial7 - 1 CSC1130 Introduction to Computer...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CSC1130 Introduction to Computer Programming Tutorial Notes 7 2 Outline Details About ChessPiece Baseline this and null More on ChessPiece.java Hints 3 ChessPiece A chess piece becomes a king if it has been moved to the baseline of the opponent : Baseline of the black player 4 Baseline Usage of the Baseline Determine whether the chess piece becomes a king Check FORWARD condition 5 Baseline Consider the following : Two runners, A and B : Denote the current position of A and B by Ca and Cb. Clearly, if Cb > Ca, B runs in front of A. A B Starting Point Ca Cb + 6 Baseline How about this ? If Cb < Ca, B runs in front of A. How can we generalize these two cases ? A B Starting Point Ca Cb + 7 Baseline We use the starting position (S) to determine: If |Cb-S| > |Ca-S|, B runs in front of A. Same idea for the assignment, but we use the baseline (finishing position) instead of the starting position A B Starting Point + A B Starting Point + 4 7 |7-0| > |4-0| |0-7| > |4-7| 8 this and null They are predefined reference. this : reference to the object itself null : null reference (the reference points to nothing) 9 this and null class Class1 { …… public void m1() { Class1 obj1 = this; ….....
View Full Document

{[ snackBarMessage ]}

Page1 / 26

1130tutorial7 - 1 CSC1130 Introduction to Computer...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online