teaching machines

Final Project – RPS – meierdg

December 20, 2011 by . Filed under cs491 mobile, fall 2011, postmortems.

My Rock, Paper, Scissors app is completely working, which is always a nice thing to start off with!

The main screen is very simplistic, but I made sure to save room for a Multiplayer button, should free time allow.  I think it would really add a lot to the game as playing against people is always so much more fun.

The next screen (gesture screen) doesn’t include the sidebar as I had wanted, but that happened because I got supremely frustrated with working out the layouts in xml.  It has just a large empty space for the gestures, and a submit button to press once the user has decided (and confirmed) their choice of attack.  Once a gesture is made the picture of the attack shows up.  When making the gesture file I actually made ~5 of each gesture, as that improves the accuracy since not everyone is able to draw a perfect circle for a rock.  The gesture file itself was rather annoying to deal with, simply for the fact that the normal program I use to mount image files on my computer decided to crash every time I tried with the android emulated sd card.  I ended up having to try two other programs before I found one that worked, strangely enough.

The final screen shows your choice vs the computer’s choice, and the bottom text shows who won and their current points.  This screen was annoying to use layouts for, as I wanted to avoid AbsoluteLayout because it is depreciated.  It ended up just being a bunch of layers inside of layers to be able to get space on top and whatnot as weights and everything were just being pesky.  Sometimes when I would drag a new layer on the GUI portion of the layout it would just delete another layer that I had where I wanted, so it wasn’t the most fun I’ve ever had.  To give a fun little gander at the XML (don’t worry, it removes formatting when pasting it over here so it looks even worse!):

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_weight="0.06">
<LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_weight="0.50" android:layout_height="348dp" android:weightSum="1">
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout4" android:orientation="vertical" android:layout_width="match_parent" android:weightSum="1">
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout5" android:layout_width="match_parent" android:orientation="vertical" android:layout_weight="0.20"></LinearLayout>
<FrameLayout android:layout_height="wrap_content" android:id="@+id/playerDecisionPicture" android:layout_width="138dp" android:layout_weight="0.34"></FrameLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout7" android:layout_width="wrap_content" android:layout_weight="0.50" android:layout_height="348dp" android:weightSum="1">
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout8" android:orientation="vertical" android:layout_width="match_parent" android:weightSum="1">
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout9" android:layout_width="match_parent" android:orientation="vertical" android:layout_weight="0.20"></LinearLayout>
<FrameLayout android:layout_height="wrap_content" android:id="@+id/computerDecisionPicture" android:layout_width="138dp" android:layout_weight="0.34"></FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout3" android:layout_width="match_parent" android:orientation="vertical" android:layout_weight="0.87" android:weightSum="1">
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearlayout123" android:layout_width="match_parent" android:orientation="vertical" android:layout_weight="0.64">
<TextView android:id="@+id/endTextView" android:layout_height="fill_parent" android:layout_width="fill_parent" android:text="TextView" android:textAppearance="?android:attr/textAppearanceSmall"></TextView>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout10" android:layout_width="match_parent" android:layout_weight="0.64">
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout11" android:layout_width="wrap_content" android:layout_weight="0.50">
<Button android:text="New Game" android:id="@+id/newGameButton" android:layout_width="fill_parent" android:layout_height="fill_parent"></Button>
</LinearLayout>
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout11" android:layout_width="wrap_content" android:layout_weight="0.50">
<Button android:text="Continue" android:id="@+id/continueButton" android:layout_width="fill_parent" android:layout_height="fill_parent"></Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

 

One thing I will say–the computer choosing something completely random every time is rather obnoxious to beat.  Thinking I was the superior mind in this duel, every time I wanted to test until someone won I didn’t change the win requirements or the computer choice generation, and I was rather impressed with the amount of times in a row I would get a draw against the computer (I believe 8 times was the most in a row I got).  I definitely learned to hate the “random” (pretty sure the computer knew what it was doing) aspect of the computer choice.  However, this also made it so there was no real way for a user to come in and beat it decisively every time as nothing knows what the computer is doing until after you have locked in your choice.

In the future I would definitely like to make it look better, and further add something like Bluetooth support for multiplayer battles.  For the moment however it will still help someone like me pass time, as I’m always up for a RPS battle but apparently people are too mature for them nowadays.