Showing posts with label learning java programming. Show all posts
Showing posts with label learning java programming. Show all posts

Thursday, 12 January 2012

Java: Texas Hold Em - Debugging (3)

Okay, so, super super busy of late, going to have to significantly cut down my post-output to like, 2 a week on Tue/Thu. Just a heads up. So this'll be the last post this week.

Here, I'll give you a link to the files needed, and you can run the file for yourself!

Tuesday, 10 January 2012

Java: Texas Hold Em - Debugging (2)

Woo, change to the titling, because I kept losing track of what number we were on, and I can't count past 40 anyway. Okay, so we looked at the folding, and that seems to work. We should still see if we can stop the New Hand message appearing twice, so let's do that, then tomorrow we can move on to testing another action.

Monday, 9 January 2012

Java: Texas Hold Em (36) - Debugging the client

Okay, folks, going to keep it short. Today, I'll show you some screens of how the client works inside the IDE and point out some stuff that might need fixing. This'll not only give you the opportunity to thing about how it's going on, but what I might have missed so you can suggest a fix of your own!

Here we go:

Friday, 6 January 2012

Java: Texas Hold Em (35)

Almost there, folks! Today we get to the point where the functionality only needs to be debugged, and thus is pretty much done! So next week is debugging, and if we have time, depending on how riddled with errors the code is, get to the GUI.

Let's stop talking about getting to tat point now, and actually get there!

Thursday, 5 January 2012

Java: Texas Hold Em (34)

Ah, for those unaware, debugging is the process of finding/identifying errors (bugs) and removing them from some program. Doing this is mostly uninteresting, and in the case of the ConsoleClient, just involves me running the entire class and seeing what it does, then trying to find out why it does that.

I was going to document the debugging, but only after we were done with the class, since errors crop up in the form of methods we've not covered, and it'd get confusing :)

For now, though, lets get to finishing the ConsoleClient. Looking at the Client interface, there's 7 or so more methods to go! Here we go:

Wednesday, 4 January 2012

Java: Texas Hold Em (33) - The Console Client

Hullo again! I meant to make this post in advance to get up here so I could have today off, but then I didn't, so I'm stuck here :(

Today we start on our ConsoleClient, which should be the final piece to our functionality. Maybe, I honestly don't quite get either of the clients, so there will probably be a load of debugging to do. Probably some which I won't be able to do. But that's enough optimism, let's get down to the client!

Tuesday, 3 January 2012

Java: The Map Interface

Hi again! I'll be going through the Map interface today in a little more detail, just so you know how it works. It's pretty cool. If you've done other programming, you might know this interface as a dictionary, which is what I likened it to before.


Monday, 2 January 2012

Java: Texas Hold Em (32)

Hullo! Finishing off the table class today so tomorrow we can go through a tutorial of the Map class. After that, we'll be messing with the ConsoleClient to complete our functionality, then put aside a few days to test it all out so we can be confident that we're set to move onto the GUI and so on and so forth!


Friday, 30 December 2011

Java: Texas Hold Em (31)

Okay, today I'll try leaving in the commentary to the code, leaving my posting text to stuff like this, that's not directly code related!

Today we'll be looking at the method that handles showdowns in the game, enjoy!

Thursday, 29 December 2011

Java: Texas Hold Em (30)

Okay, in the receding phase of my migraine, which means I can stick around longer, but I'm still not at full operating capacity! Still, I figure we can get through the huge method, which will actually take a little bit OVER the 2 screenshots I wanted to limit my posts to, but only by like, 2-3 lines.

The reason the method is so large is that it's responsible for the entire round of betting, so there's a big chunk of stuff and a switch statement to boot. Also, switch statements make use of "break;" so that inflates the length of the code a bit.

Here it is:

Wednesday, 28 December 2011

Java: Texas Hold Em (29)

Well, got a migraine today, so sorry, folks, can't give you the big one I promised. Instead, I'll cover it whenever this blasted thing is gone, and cover the method that returns a player's allowed actions tonight.

Here it is, short as possible:

Tuesday, 27 December 2011

Java: Texas Hold Em (28)

Yar, hope everyone had themselves a good weekend, I sure did! If I recall right, we left off at the table dealing out the community cards, which means today we'll be covering a method to reset the hand, and another to switch players for turn rotation and such. Let's get to it, no more partying for you!

Thursday, 22 December 2011

Java: Texas Hold Em (27)

Okay, back for a second post, it's late and I'm busy though, so deal with it being short! Four short methods totaling about 30 lines of code! We'll be covering a method to deal with each of the blinds and 2 for dealing out cards:

Java: Texas Hold Em (26)

Okay, post 1 of 2 for today! I'll take a break after this to type up the second, since I had this prepared for yesterday! This one contains a few administrative methods, the main game loop, a way to add players and a way to start the game over. The second screenshot is a huge method to take care of actually playing an individual hand. Here goes:

Tuesday, 20 December 2011

Java: Texas Hold Em (25)

Okay, so it turns out the ConsoleClient is pretty confusing, and requires the Table anyway, so we'll be doing the Table! Yay! Ooh, there's a problem though. You probably don't remember (I didn't), but when the Hand class was created, I left out the constructor that takes an ArrayList or something as a parameter. We need to go back and fix that so our table runs smoother!

Monday, 19 December 2011

Java: Texas Hold Em (24)

What's up, guys? Today we're back to the card game! We can probably finish it up today, but be aware that the actual act method is long, although it is just a switch statement, so not necessarily complex. I'll leave it to last so we can get the easy stuff out of the way, first.

Sunday, 18 December 2011

Java: String Formatting (Pictures!) and the Switch Statement

Okay so, apparently no pictures is a huge no-no, so I'll briefly show you how string formatting works with the power of screenshots! And yeah, looking back on yesterday's post, I agree, it was kinda shitty, so, sorry about that :P

So, string formatting! First, we need to formulate a template string in which data will be entered later!

Saturday, 17 December 2011

Java: String Formatting

First off: To Damian in the comments: The game could kick the player when its discovered they're broke, but that's not up to the player class! It's up to either the Table or the ConsoleClient!

Okay! Short post today, just covering string formatting. We saw in some code there was a string returned that looked roughly like:

"This is the message, %s, %f"


...within a method that took 2 more parameters. When printed out this way, the first parameter, the string, is the format of the message to be printed out. A percentage sign followed by a letter denotes where you'll want to put data in afterwards.

Friday, 16 December 2011

Java: Texas Hold Em (23)

Hey hey, time for another post. Last time we left off at getCash for the Player class, after a number of get methods and some other crap. Luckily, there's a buttload more of get methods to go through, so we still have some easy stuff around. Just a heads up though, on Monday we'll go through a larger method that uses the switch-statement.

This week is my final make-up week where I make weekend posts, so tomorrow, as promised, I'll cover string formatting in more detail, and on Sunday I'll actually refresh us all on the switch statement, just in case you need it!