teaching machines

CS491 – Homework 2 “Cribbage Statician” – Brian Kendzior

October 19, 2011 by . Filed under cs491 mobile, fall 2011, postmortems.

The goal for the CribbageStatician is to allow users to seemlessly play games of cribbage and record their points into the app. The app will then keep track of the individual scores for games and correctly notify players when 120 points has been reached. At the end of each round, the statistics are recorded into database tables that are later used to calculate interesting statistics about each player.

Here is a description of my database tables:

Player

Game Setup

Individual Score

So basically each Player has its own entry in the player table. A score is a collection of different ways a person can score during a round. Because there is a many-to-many relationship between Player and Score, an intermediate table called Game is needed. Game consists of an id and pairs of Players and Scores, one pair for each player playing.

Unfortunately due to major underestimation the project is stuck at a major grindpoint. Using an Application class to hold all of my database instances (like the example we did in class) works great, if I only want to create one database. Using an OpenHelper somehow only the first .execSql() command to create the database table is ever run. If I change each table to use a separate database, each execSql() runs fine (but this obviously defeats the concept of joining tables). As of now the program can handle playing a single game and adding up points until 120 is reached (DDMS log shows notifications when databases “should” be written to but end up throwing nasty “table doesn’t exist” errors). If I hadn’t run into so many problems working on getting the different Activities and Adapters implemented as well as learning to use checkBoxes in an arrayAdapter () perhaps this wouldn’t have been such an issue.

Once I figure out the databases issue the only things to finish up are testing the various SELECT statements to make sure the joins all work so I can populate the View Statistics activity.