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

From CDOT Wiki
Jump to: navigation, search
(Add Elements on Main Screen)
(Define the Application)
Line 17: Line 17:
 
===Define the Application===
 
===Define the Application===
 
*Create the classes StartScreen, PlayerOne, and PlayerTwo
 
*Create the classes StartScreen, PlayerOne, and PlayerTwo
*StartScreen will setup the environment for our application
+
*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
*Both Player classes will contain the code for what is to be displayed per the respective players turn
+
*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 the player makes a move, the screens will swap and the other player will take their turn while their screen is currently showing
+
*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===
 
===Starting the Game===

Revision as of 16:48, 27 March 2011

Lab 3


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
  • Set the title of the project

Add Elements on Main Screen

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

Define the Application

  • Create the classes StartScreen, PlayerOne, and PlayerTwo
  • 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
  • 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
  • Add a start game button
  • Allow the start game button to switch screens

Creating the Player

  • Create the player constructor
  • Implement the ability for a player to take their turn
  • 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
  • Before a players move, is there space to go?
    • No, the game is over directing the player to the main screen
    • Yes, the game is not over and the player may take their turn
  • After a players move, does that that move win the game?
    • 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