teaching machines

U and I -Cameron Bjorklund

September 22, 2012 by . Filed under cs491 mobile, fall 2012, postmortems.

 

For the U and I assignment I have created an app that will aid in counting your Cribbage hand. For those of you un-familiar with the card game Cribbage, there is a point in the game where you end up with a “5 card hand” (4 cards in your hand but a special card that everyone can use with their hands) and receive points depending on what you have. After this point, you move your game piece that many points ahead. First person to reach 121+ points completes the board and wins the game. You can gain points by having pairs (2 points), runs of 3,4 or 5 (3,4 and 5 points respectively), having cards that add up to 15 (2 points for each combination of cards that add to 15), also if you have a Jack in your hand that matches the special card everyone can use, that is 1 or 2 points depending on house rules. The last rule (implemented by my friends to make my life miserable) is that any points you do not count, and someone else in the game finds, they keep. Basically you must count your hand carefully and make sure you do not miss points or they will go to someone else. I have created a 2 activity app to aid in hand counting to make sure your points do not end up with your friend. It is a 2 activity app.
The first one takes in your name and has a start button

The second one is where the magic happens. Your name that you entered in the main_activity gets passed as the title of the second activity. Here you have options to enter how many pairs,sets of 15, runs of 3, etc. you have and it gets totaled on the right side (by pair, sets of 15, runs of 3, etc) and on the bottom you have a total for your hand that round (the amount you would move your piece). Finally a reset button to start entering your hand over (for the next round).

I used TextViews, EditTexts, and Buttons to carry along information across my application.

I have learned many lessons doing this. My first lesson I learned was to test frequently (even though the emulator can be a pain sometimes) because there was a point where I coded a huge amount and than it did not work. Unlike a “normal” java assignment you can use println to isolate the problem area. In the emulator it is a little harder to do something that easy. The other lesson I took away from this is that handling different types of information is very hard in Android development. Taking strings from EditText that you need to be an integer to do math, can cause a lot of headaches.