HPS321H1 Lecture Notes - Lecture 10: Connect Four
Document Summary
We plan on using a series of nested loops to do game logic. Note we call our balls a and the opponent"s balls b. If (3 a balls in a row & a can make a connect 4 & column not full): Else if (3 b balls in a row & b can make a connect 4 & column not full) Else if {2 a balls in a row & a can connect 3 balls & column not full) Else if {2 b balls in a row & b can connect 3 balls & column not full) {block potential 3 b balls in a row} Else if {1 a ball & a can connect 2 balls & column not full} If (more than 2 open spaces on any side side) {place ball on side with more open spaces} Else if (no ball on top & column not full) Else if (ball on top & columns not full)