Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBen Jakuben
Treehouse TeacherForum Contest: Create a simple Android dice game
EDIT: This contest has ended! Congratulations to Chai Phonbopit for the winning entry! Our next contest on creating a Tic-Tac-Toe app for iOS is up!
Hello everyone!
It's time for a new Treehouse Forum contest! Check out this video Amit helped me record to learn more:
After you've watched the video, please read the details below carefully. We're looking forward to your entries!
Game Rules:
The dice game is called "Pig" and is a simple two-player game. The rules and more information about the game can be found here on its Wikipedia page, but the simple rules are as follows:
Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player decides to "hold":
- If the player rolls a 1, they score nothing and it becomes the next player's turn.
- If the player rolls any other number, it is added to their turn total and the player's turn continues.
- If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn.
The first player to score 100 or more points wins.
How to Enter:
Create your app as either a native app or a hybrid app (web technologies wrapped in a native shell). The app must be installable on Android devices, i.e. regular web apps are not permitted. Then post a link as an answer to this post. It can be a link to downloadable project files, a GitHub repo, an APK, or a link on Google Play. Be creative with the design and user experience!
Due Date:
All entries must be submitted by March 16th at 11:45pm ET. Here's a timezone chart so you can see what time that is for your locale.
Prize:
The entries will be judged by Treehouse teachers based on both design and code. One winner will receive a free month of Treehouse Pro (formerly called "Gold") on us! We'll announce the winner on March 17th and reveal the next contest.
30 Answers
Zac Gordon
Treehouse Guest TeacherAwesome! Good luck to all!
dungeonkeeperhf
3,272 PointsThis looks like a pretty awesome contest! I'll be sure to give it a go:)
Calvin Maighan
12,061 PointsMan I haven't learned android development yet, bummer. Good luck to however participates :)
Tolga Beser
1,202 PointsSame. Maybe later. :)
Ben Jakuben
Treehouse TeacherYou have plenty of time to take the [Build a Simple Android App](teamtreehouse.com/library/build-a-simple-android-app) course and give it a go! :) This contest was intended to be doable for anyone who has finished that first course. There isn't anything too difficult about it.
William Dahl
7,829 PointsLooks good - challenge Accepted!
I managed to build a simple version after doing "Build a Simple Android App".
Now to get creative! :)
Ben Jakuben
Treehouse TeacherExcellent - can't wait to see it! I fully intend to play all contest entries with my five year old son. :-)
Blake Gall
2,517 PointsChallenge Accepted Ben and Amit. (By the way I'm 12 so don't expect much)
Ben Jakuben
Treehouse TeacherThat's no excuse! We expect even more of you! But seriously, that's so awesome that you're starting early learning how to program and make apps. :)
Blake Gall
2,517 PointsString reply = "Thanks";
larsfredrik
2,943 PointsSo good to see someone else that's young and learning! I'm thirteen, and been here for months.
Crisoforo Gaspar Hernández
18,302 PointsChallenge Accepted :D . I already start with this awesome challenge, so i expect finish as son as possible.
Grant Hosticka
4,172 Pointshttps://jumpshare.com/v/qyrN3XXbTaSKUak4kBwU?b=QOomIOdvRnEg40goL4DI
Here is my entry! Nice contest, had a lot of fun making it.
Eboni Wigginton
2,500 PointsI just started. Do we have to follow the traditional rules? Or, can we add more dice? It seems like the game would take forever, lol!
For a challenge, later I'd like to implement Two-Dice Pig's rules. :D
Ben Jakuben
Treehouse TeacherHaha - it doesn't take too long. I've played quite a few games. What's fun is that one player can have a pretty commanding lead evaporate pretty quickly with one good string of die rolls.
I'd love to see a two dice version after the contest, though, so let us know if you do! :)
Steve Bedard
14,335 PointsHere's my participation, hope you enjoy! My app uses sound so make sure your crank up the volume ! (https://drive.google.com/file/d/0B2xlu23GjnfvcTBISXNMTG1sOUk/edit?usp=sharing)
here's the link to my github repo if you want to see my code.
https://github.com/absoluteheero/Pig
There's seem to have a problem with my repo, for some reason i don't know my two java files doesn't show up, I'm using Android Studio and i want to delete the github repo and re-upload it, how do i do that?
Steve Bedard
14,335 PointsYou can download my version 1.2. I've corrected some bugs about players creation and some problem with score re-initialization when starting a new game.
https://play.google.com/store/apps/details?id=com.sbdesign.pig
Sanat Tripathi
8,109 PointsI have a question; When is the roll complete? when a player clicks on the hold button or we have to randomly stop the rolling once the player pushes the roll button?
Please reply, Thanks!
Ben Jakuben
Treehouse TeacherThat's up to you! In my implementation I did the "roll" (random number generation) when the player clicks the "roll" button. The die is immediately updated. But adding some roll animation or some kind of indicator is a great bonus. See Grant Hosticka's solution above. :)
Steve Bedard
14,335 PointsMy 5 year old son just love my game....are we allowed to put it on play store?
Grant Hosticka
4,172 PointsI did, nice job by the way I am impressed with the graphics!
Ben Jakuben
Treehouse TeacherDefinitely! As always, we encourage you to put everything you can on Google Play. :) Submit via the link to it on Google Play if you want!
Joey Barter
1,261 PointsHi Ben, your Android teachings got me too inspired after the first two stages! I jumped straight in, and wrote a two die version...oops! I'm enjoying your videos and the challenge, thanks!
Ben Jakuben
Treehouse TeacherSave that one as something like Pig Squared, and hopefully it'll be easy for you to revert to a one die version.
Steve Bedard
14,335 PointsSince I'm a perfectionnist, I found an annoying bug in my app that you may not have noticed but when you decide to play another game, the first dice roll of the first player is not accurate, it has kept in memory my last TEMP_ROLL, can i re-submit ?
Ben Jakuben
Treehouse TeacherAbsolutely! Just add a comment with your new version below your original entry above. :)
chai
2,777 PointsCan I use other app name when I upload to Google Play? or accept only name "Pig", Thanks.
Ben Jakuben
Treehouse TeacherTotally up to you! "Pig" isn't the greatest name, is it?
Omar El
354 PointsI uploaded my Eclipse project on GitHub, should I email it to you guys, if so what email and other info should include in it to ensure I'm entered into the contest, or post the link of the GitHub Repository here?
Ben Jakuben
Treehouse TeacherAdd your link here so that other students can check it out, too. Everyone seems to really like checking out each other's work, especially when source is available like you'll be doing.
Rohit Gopalan
81,945 PointsMy app is here : http://rohitgopalan.com/Pig.apk and the implementation is at https://bitbucket.org/rrgopalan/pig-application/src
Roberto Elero Junior
1,173 PointsHi, guys. Here is my entry (apk): https://github.com/robertoej/pig/blob/master/bin/Pig.apk You can find the code at: https://github.com/robertoej/pig
I'm using the accelerometer events to roll the dice, however, you can use a button as well.
Obs: the app requires internet permission because I implemented a menu option for the instructions website (wikipedia).
I've used and adapted some resources from the internet. Here are the sources: http://www.facebooklaw.in/wp-content/uploads/2013/10/pig.jpg http://pixabay.com/p-35637/?no_redirect http://www.vogella.com/tutorials/AndroidSensor/article.html http://soundbible.com/1221-Pig-Oink.html http://www.sounddogs.com/previews/59/mp3/608035_SOUNDDOGS__di.mp3 http://soundbible.com/478-Cheering-3.html
Good luck everyone!
Steve Bedard
14,335 PointsI can see i've inspired SOME...:)
Crisoforo Gaspar Hernández
18,302 PointsWell I am going to leave my repo link: https://github.com/mitogh/dice-game the code of the project and some issues about them is there.
The APK File is available in this link: https://github.com/mitogh/dice-game/raw/master/bin/Dice%20Game.apk
Steve Bedard
14,335 PointsReal nice... Have you tested it on tablet? The roll and hold buttons are cutted in half on my nexus 7
Crisoforo Gaspar Hernández
18,302 PointsThank you for the feedback I already fix it, the new version is available at the same address.
Crisoforo Gaspar Hernández
18,302 PointsYes I tested in a tablet but I will check that thanks. ;)
Maisha Oneal
2,351 PointsHey guys, here's my entry. Just finished the first project course a few days ago so please bear with me :). App worked fine on my emulator, but forced closed on one of my older phones (Samsung Fascinate). Worked fine on one of my newer devices (Galaxy IV). APK: http://jmp.sh/ZeHFLEd Code: http://jmp.sh/J9djafC
Good Luck Everyone!
William Dahl
7,829 PointsHi folks, some great entries here - good work!
I have uploaded my entry onto GitHub: https://github.com/Will-D/DiceGreed
The APK is located here: https://github.com/Will-D/DiceGreed/blob/master/bin/DiceGreed.apk
For anybody interested in learning about Git - I followed this introductory course by Tommy Morgan: http://teamtreehouse.com/library/git-basics Very informative!
chai
2,777 PointsMy entry here: Pig.apk I just upload to Google Play waiting for approved.
chai
2,777 Pointshere my version on google play : PigDice
Joey Barter
1,261 PointsHi Peeps, I have uploaded my beginner's attempt, here; https://drive.google.com/folderview?id=0B2Cx2bEwR0vyTl9hM0M5MWtrUzA&usp=sharing The app may be sad, but I had fun :P Unfortunately, the die is text based, but there's shake/button for rolling, and sound.
Crisoforo Gaspar Hernández
18,302 PointsI could not install your app :(
Joey Barter
1,261 PointsOh, I did the following; Android Tools -> Export Unsigned Android Application
Ben Jakuben
Treehouse TeacherHi Joey, I'm unable to install the app, too! I'm afraid I won't have a chance to include it now, but if you reply with a link to your code or a working APK then I'd still love to take a look, and I'm sure the others would like to see it, too.
Sanat Tripathi
8,109 PointsMy entry here: https://github.com/sanat51289/Pig/blob/master/bin/Pig.apk
Sanat Tripathi
8,109 PointsPlease visit my github account if the above link doesnt download the apk correctly.
Sanat Tripathi
8,109 PointsPlease visit my github account (https://github.com/sanat51289/Pig/blob/master/bin) and download the apk from bin folder if the above link doesn't download the apk file correctly. Thanks!
Ben Jakuben
Treehouse TeacherHey everyone!
Thanks so much for participating in this contest!
I was so impressed with all the entries. It was hard to choose a winner! The winner just squeaked by the deadline by posting that the app would be available on Google Play after the midnight deadline. Congratulations, Chai Phonbopit on winning this week's contest! Chai's app is available on Google Play, so everyone should check it out and rate it well. :)
Chai's app won because it was a really solid app with a nice, simple design and no apparent bugs. It has great sound effects, shake to roll, player name customization, and nice rolling animations. Many of your other entries had similar features and great designs. Everyone should be sure to check them all out for inspiration.
Stay tuned for another Android Forum Contest in the future, and also check back later today for this week's iOS contest, which will be announced shortly.
Happy coding!
Steve Bedard
14,335 PointsCongrat to Chai !
Hey Ben, you know what would be cool ? I would like to participate in a project lead by you on GitHub and let Treehouse member participate in the project. And each month or week there would be a contest for an iteration part of the project and members would make points for every iteration (it would be like a coding season). And the final result we could have a full app created by the community ! think about that and let us know ! Talk to your boss about it ! that would be cool....
chai
2,777 PointsThank you so much.
Roberto Elero Junior
1,173 PointsCongratulations, Chai Phonbopit!
Justin Horner
Treehouse Guest TeacherCongratulations, Chai Phonbopit! Great work everyone.
dantesolis
8,842 PointsCongratulations phonbopit!!!