• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Help with a simple Java Uno game

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to build a simple game of "Uno" in java. I just want to be able to display each step of the game without any user input. The computer is playing itself in a way. I have made the shuffle and deal class for the game, but I am not sure how to display the rest of the game.

I would like the game to display the two players' hands, and then each step the players make until the game is over.

Any advice? Thanks!

Here is the code I have so far:



I would like the game to flow some what like this:

Uno Game flow:

Shuffle cards
Deal cards
Display top card
Players take turn placing cards until they are out of cards
If players cannot play, they must draw one card
The player with one card left must say “uno”

Thank you! please let me know if I can make anything more clear.
 
Bartender
Posts: 2908
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Austin, I am think that the company has probably patented the game. I suggest against making or using the name of the company or it's characteristics in your code or posting it in forums. Maybe you can attempt a similar game using regular card deck ?

I think your code for shuffling can be improved a lot using Collections.shuffle() method and the code can be improved using enums.
 
Sheriff
Posts: 17086
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm no lawyer but since the OP's intent is to learn Java and probably not for private commercial gain, I think this falls under "fair use" rules.

@OP: what have you done to try to implement the rules of the game? All I see here are creating the deck and shuffling it. And having all your code in MainIsAPain (←click that, it's a link)
 
Bartender
Posts: 5061
188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If coding a game that is copy-righted is not allowed, I would probably be doing a life sentence  

I woud certainly have a player playing his last-but-one card having a 20% change of forgetting to say "uno". Sounds like fun.
 
salvin francis
Bartender
Posts: 2908
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I'm no lawyer but since the OP's intent is to learn Java and probably not for private commercial gain, I think this falls under "fair use" rules...


Noted. In that case, let's continue with the discussion here.

OP, adding to all comments above, your entire code is written in a "Deal" class. However, the code does not deal any thing, it just shuffles the deck.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic