Difference between revisions of "Teams Winter 2011/team4/lab4"

From CDOT Wiki
Jump to: navigation, search
(Define the Application)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Lab 3=
+
=Lab 4=
 
*[http://zenit.senecac.on.ca/wiki/index.php/Teams_Winter_2011/team4 Teampage]
 
*[http://zenit.senecac.on.ca/wiki/index.php/Teams_Winter_2011/team4 Teampage]
 
  
 
==Tutorial==
 
==Tutorial==
Line 9: Line 8:
 
*Launch Eclipse
 
*Launch Eclipse
 
*Create new BlackBerry Project: ''File->New->BlackBerry Project''
 
*Create new BlackBerry Project: ''File->New->BlackBerry Project''
 +
[[File:T4_1.png]]
 
*Set the title of the project
 
*Set the title of the project
 +
[[File:T4_3.png]]
 
===Add Elements on Main Screen===
 
===Add Elements on Main Screen===
 
*Place a applications icon into ''res->image''
 
*Place a applications icon into ''res->image''
 
*Open ''BlackBerry_App_Descriptor''
 
*Open ''BlackBerry_App_Descriptor''
 
*Select the icon, click the ''Add'' button
 
*Select the icon, click the ''Add'' button
 
+
[[File:T4_2.png]]
 
===Define the Application===
 
===Define the Application===
*Create the classes StartScreen, PlayerOne, and PlayerTwo
+
*Create the classes MyApp, MyScreen, and NextScreen
*StartScreen create instances of both MyScreen and NextScreen, allowing the user to navigate between screens.  This is by immediatley pushing Myscreen and then adding a changeListener to the button on MyScreen to navigate to NextScreen
+
[[File:T4_4.png]]
 +
*MyApp create instances of both MyScreen and NextScreen, allowing the user to navigate between screens.  This is by immediately pushing Myscreen and then adding a changeListener to the button on MyScreen to navigate to NextScreen
 +
[[File:T4_5.png]]
 
*The NextScreen Class will create setup the tic tac toe board and request user input for their moves.  It does not allow invalid input, and once a piece has been placed, the user cannot place another piece on that square.
 
*The NextScreen Class will create setup the tic tac toe board and request user input for their moves.  It does not allow invalid input, and once a piece has been placed, the user cannot place another piece on that square.
 
*After a player makes a move, the next player is requested to place their move and so on until a winner is determined, it is a tie game, or the reset button has been pressed.
 
*After a player makes a move, the next player is requested to place their move and so on until a winner is determined, it is a tie game, or the reset button has been pressed.
Line 23: Line 26:
 
===Starting the Game===
 
===Starting the Game===
 
*Implement the code to create the menu
 
*Implement the code to create the menu
 +
[[File:T4_9.png]]
 
*Add a start game button
 
*Add a start game button
 
*Allow the start game button to switch screens
 
*Allow the start game button to switch screens
 +
[[File:T4_10.png]]
  
===Creating the Player===
+
===Creating the Board===
*Create the player constructor
+
*Create the board only once
 +
[[File:T4_7.png]]
 
*Implement the ability for a ''player'' to take their turn
 
*Implement the ability for a ''player'' to take their turn
 +
[[File:T4_8.png]]
 
*Allow the game to switch players after a turn
 
*Allow the game to switch players after a turn
 
*When the players screen is displayed is it considered their turn
 
*When the players screen is displayed is it considered their turn
 +
 
===Ending the Game===
 
===Ending the Game===
 
*Within the player classes, implement terminal state checking
 
*Within the player classes, implement terminal state checking
 +
[[File:T4_6.png]]
 
*Before a players move, is there space to go?
 
*Before a players move, is there space to go?
 
**No, the game is over directing the player to the main screen
 
**No, the game is over directing the player to the main screen
 +
[[File:T4_12.png]]
 
**Yes, the game is not over and the player may take their turn
 
**Yes, the game is not over and the player may take their turn
 
*After a players move, does that that move win the game?
 
*After a players move, does that that move win the game?
 +
[[File:T4_11.png]]
 
**No, the game is not over and the next ''player's'' screen is displayed
 
**No, the game is not over and the next ''player's'' screen is displayed
 
**Yes, the game is over directing the player to the main screen
 
**Yes, the game is over directing the player to the main screen

Latest revision as of 16:25, 27 March 2011

Lab 4

Tutorial

Create BlackBerry Project

  • Download and install BlackBerry Java Plug-in for Eclipse
  • Repeat the above for BlackBerry Torch 9800 simulator
  • Launch Eclipse
  • Create new BlackBerry Project: File->New->BlackBerry Project

T4 1.png

  • Set the title of the project

T4 3.png

Add Elements on Main Screen

  • Place a applications icon into res->image
  • Open BlackBerry_App_Descriptor
  • Select the icon, click the Add button

T4 2.png

Define the Application

  • Create the classes MyApp, MyScreen, and NextScreen

T4 4.png

  • MyApp create instances of both MyScreen and NextScreen, allowing the user to navigate between screens. This is by immediately pushing Myscreen and then adding a changeListener to the button on MyScreen to navigate to NextScreen

T4 5.png

  • The NextScreen Class will create setup the tic tac toe board and request user input for their moves. It does not allow invalid input, and once a piece has been placed, the user cannot place another piece on that square.
  • After a player makes a move, the next player is requested to place their move and so on until a winner is determined, it is a tie game, or the reset button has been pressed.

Starting the Game

  • Implement the code to create the menu

T4 9.png

  • Add a start game button
  • Allow the start game button to switch screens

T4 10.png

Creating the Board

  • Create the board only once

T4 7.png

  • Implement the ability for a player to take their turn

T4 8.png

  • Allow the game to switch players after a turn
  • When the players screen is displayed is it considered their turn

Ending the Game

  • Within the player classes, implement terminal state checking

T4 6.png

  • Before a players move, is there space to go?
    • No, the game is over directing the player to the main screen

T4 12.png

    • Yes, the game is not over and the player may take their turn
  • After a players move, does that that move win the game?

T4 11.png

    • No, the game is not over and the next player's screen is displayed
    • Yes, the game is over directing the player to the main screen