Jump to content
xisto Community
Sign in to follow this  
sonesay

Algorithm Help Rummikub game, determine if a set containing a joker is valid

Recommended Posts

Hey guys I'm working on a project for making a java based version of the Rummikub game and I'm having a bit of trouble coming up with an algorithm for determing if a joker being played in a set is valid. If anyone can throw some ideas on what to check for and do it would be great. I'm only starting to look into it now but its becoming clear it that it can be a bit complicated for my small brain. You can google the rummikub game if you have no idea and the rules behind it. Looking forward to hear any responses and idea to help me out thanks :)

Share this post


Link to post
Share on other sites

Well, I'm always up for a challenge. I'll take a look and see what I can come up with.

 

Edit:

Just skimmed through a synopsis of the game (via Rummikub - Wikipedia) . From what I can tell its scrabble (more or less) but without the letters and loads of twists thrown in for good measure. Looks pretty interesting.

 

Edit:

This is what I got thus far:

You cannot play a card at the extremities of a 'run' (that is before an Ace or after a King), Jokers are not exempt for this rule

Once a Joker is in play it maintains its assumed value and color/suite unless substituted for a card with that same value and color/suite. Players amending to a Joker in play cannot alter the Joker's assumed value without substitution.

If substituted, the Joker must be played during that same turn with a minimum of two other cards.

In a 'group' of three the Joker has one value but two possible colors/suites. Color is 'locked' when amended with a card suitable to the 'group'

It would also be cool to indicate a Joker's assumed value and color by having the card animate in some way to reflect its chameleon like nature. Say that Jokers start out with a standard look, but when placed on the game grid they partially morph to mimic their assumed value. In the case of the last bullet point where it is one of three cards in a 'group' it might constantly shift between the two colors. Edited by dimumurray (see edit history)

Share this post


Link to post
Share on other sites

Thanks for the response. I posted this earlier today out of frustration of trying to come up with an algorithm on my own as I'm not too good and not had to come up with them on my own. You did point out somethings I didn't think of and I appreciate the input. I forgot to mention that some of the rules in the game we are creating are a bit different but the differences are only slightly. I know I should post them but I don't have them all here in my head.I started to draw it in MS visio and started to notice things I didn't think about in my initial notes either so I'll post it here. Maybe more suggestions and enhancements can be made. Its still not complete but it should give you an idea of what I'm trying to do.Yes this is the first time I'm trying to write an algorithm :)Edit: The enhancment ideas you suggest are cool but to be honest I'm not sure I will be able to get it done and included in the time frame we have been given. Its week 4 into our semester and the projects due week 12 so I basically have only 8 weeks to have a complete working game. That on top of my lack of experience with GUI's in java will be a challenge. Last semester I did a mine sweeper game in java but I didn't finish it because I tried to do all the GUI part in the last weekend and was so confused about how they worked that I got stuck on handling of events.

post-45102-1218083758_thumb.gif

Edited by sonesay (see edit history)

Share this post


Link to post
Share on other sites

The enhancment ideas you suggest are cool but to be honest I'm not sure I will be able to get it done and included in the time frame we have been given. Its week 4 into our semester and the projects due week 12 so I basically have only 8 weeks to have a complete working game.

That looks like a pretty tight schedule. I can't pretend to be a very fast programmer myself, so only having 2 months to get every thing up and running seems a bit close to me. It seems that you have a project plan mapped out though. Just make sure that you have that plan well defined before you start coding anything. It's good practice to work out as many kinks as you can during the planning stages of an app. You can't foresee every possible stumbling block but if you devote enough time to planning the development phase should be much smoother.
Are you building your GUI from scratch, building your GUI using an API like SWING or a combination of both?
Edited by dimumurray (see edit history)

Share this post


Link to post
Share on other sites

Yeah we build everything from scratch but lucky for us we can use what ever IDE we like well pretty much anything language if we are confident enough. I'm only using java because thats what I've been taught and know (I have no choice). We got introduced to netbeans at the end of last semester so I have a little experience in that. We are using swing and the newer xswing. It helps out a lot in creating quick GUI's but the code it generates is real big and I find I have to spend a bit of time trying to see where things fit in together.Yeah the schedule is pretty tight so I'll be fully stressed out for the next few months lol. I've got 3 other classes I need to make sure I keep up to so I'll try and keep the design and function of it as simple as I can to keep the complexity down. Yeah the planning is important and we are pretty much being taught and given the project to work on at the same time.I'll post the updated flow diagram soon. I think that's what the lecturer wanted a low level description of how we will do the algorithm to check if a set is valid or not.Edit heres the updated diagram. Logics probably wrong any changes?

post-45102-1218146500_thumb.gif

Edited by sonesay (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.