Category Archives: Euchre

Background

I was just thinking about things… and I came to realize a few things.

To start, I want to give you a background on me.

In the Beginning

I first used a computer when I was about 8 years old. My mom brought home a computer from work, which was DOS based. She taught me some basic commands, and suddenly I was able to navigate my way around DOS… sort of.

Then she brought home a pile of floppy disks and said something like “someone at work gave me these disks and said they have games on them. Plug them in and see what’s on there.” So I did… and to my disappointment, most of the disks were password protected. But that didn’t stop me. I spent some time guessing passwords. They were educated guesses, but guesses. Don’t ask me what my exact process was… I was 8, and I don’t remember those details. Eventually I figured out one of the passwords, and was able to play the games on that disk. So I tried the password on all the other protected disks, and it worked on roughly half of them.

That day I fell in love with computers. I knew that I wanted to do something with computers “when I grew up”. As time progressed I got more and more into video games, both console and PC, and wanted to be a programmer. Specifically, a game programmer (like so many other kids in my generation.)

High School

There wasn’t much in the way of Computer Science classes in my high school… we had a Visual Basic class and a C++ class, but most of the time they never happened because not enough people signed up for them. One of those years though, I took the C++ class. Unfortunately, it did nothing for me because my teacher was “learning as we were” and I spent most of my time copying code from “the smart kid”.

Community College

So I went to community college and started as a CS major. I took “Introduction to Object Oriented Programming using Java” – the first programming class in the major – and I hated it. Again, a big part was my teacher. She could barely speak English, she actually spent 1 entire class writing Visual Basic code on the board, just to erase it and tell us “Oh, forget all of that, that was the wrong programming language.” I failed that class and retook the class the next semester with a different teacher. That second semester, I also took Calculus 2. I still hated Java, and I got a 22 on my first calc 2 test… so I switched majors to Computer Technology – a hardware major. (The highest level math required for CT was calc 1, so I didn’t have to pass that calc 2 class for the new major.)

College

I stuck with that major until the end of MCC, and transferred to RIT. The major there was Computer Engineering Technology – still a hardware major, but we did out fair share of software too. At RIT I finally started to grasp the concept of Object Oriented Programming, because I finally had a good teacher. It was C++ that finally got me to understand, but I was only doing command line (DOS) programs. I took some of those programs above and beyond, as I finally understood what I was doing (one project eventually turned into my tic-tac-toe game for android.)

After doing tic-tac-toe, I decided to really challenge myself and make a Euchre game. For those who don’t know the game of Euchre, it’s a card game with a TON of logic involved. The game was 1 human player and 3 computer players (Euchre is most often played as a 4-player game, although variations exist for anywhere from 3 to 7 players.) I got Euchre working as a playable game, and started adding more options to it – like some of the regional rules or “house rules” that exist in variations of the game.

Beyond College

After college, I decided to make Euchre into a Windows program instead of a DOS program. Doing my first GUI was interesting. There was definitely a learning curve, especially considering I was learning from the internet and sample code. I decided to use C# instead of C++ because it seemed to have a lot more options for GUI programming. This meant that some of my code needed to be changed slightly for the new language. Since C# is based on C++, most of the changes were minor. The hard part was converting the command line output to a GUI. I played with a few other programs for a while, nothing else really got too far.

Android

Then I got into Android. I got my first Android phone in 2010, and got REALLY into the modding community – rooting, ROMs – and basically everything Android. I paid for Tasker, and eventually made some profiles in there for responding to text messages while my phone was in a car dock. (I was taking an hour and a half drive to Buffalo once a week for work, so it helped for that trip.) Then Tasker released App Factory, which allowed you to use “scenes”, which were basically GUI elements, together with profiles to create an actual app and an apk file which other people could install on their phones. This is where the first ever version of Auto Respond came from.

After realizing the visual limitations of the “scenes” created in Tasker, I decided to learn to write actual code and recreate this “app” that I created in Tasker with my own code. About a year later, Auto Respond is what it is now. Plus I’ve created tic-tac-toe, started to convert Euchre to Android, started on a countdown widget app, and have begun work on a super-secret project – which is going to be HUGE when it’s finally released. (I’ve told a few of my close friends and family about this project, and they all LOVE the idea.)

Conclusion

So today I was thinking about this journey… from computer enthusiast, to wanna-be game designer, to failure of a programmer, to writing basic command line programs, to learning on my own, to semi-successful Android developer, and hopefully in the future to successful entrepreneur and app developer.

And through all of this, I’ve been working as an IT professional for 10 years… and I’m glad. I wouldn’t want to code all day every day. I enjoy it too much. A lot of people out there say that you should never turn a hobby into a job, because you’ll end up not enjoying it as much – I agree with them.

I LOVE programming, but I would hate it if I did it 40 hours a week. Plus, if I did programming as a job, I wouldn’t want to come home and program my own stuff later. I want to program what I decide to program, not what someone tells me to program. And that’s exactly what I do right now.

Now, I know what some of you might be thinking… “Well if this idea of yours does become big, then won’t you be programming for a living?” …Yes and no. Yes, I will most likely be doing a lot of programming to keep this whole thing going. But I will still be doing what I want to do, not what someone else wants me to do. I’ve always dreamed of being my own boss, and I hope that one day that dream will come true.

Google Games!!!

It’s there! In my Developer Console… “Google Play Games Services”!

I can’t wait to play around with it, and network up my Tic Tac Toe game, and hopefully finish up Euchre soon, and get that networked.

I have some achievement ideas for Tic Tac Toe as well. I know, there’s not a whole lot you can do with achievements in Tic Tac Toe, but I found some things. I’ve also got achievements already built into the existing Windows version of my Euchre game, so those will be coming over to Android, and I may add a few more. I may also categorize them a little differently than they are right now… we’ll have to see.

In any case, I’m REALLY excited to get coding, there’s just one problem… I don’t have much time this week because I’m moving this week/weekend 🙁

So most of the work won’t even get started until next week. I’ve first got to read through the documentation and see how to use the API and all of that stuff, so it might be a couple weeks before any actual progress gets made. We’ll see how difficult it is, hopefully I can get some good work knocked out in a little time.

Google Games is coming!

For those of you who don’t know, Google I/O starts on Wednesday!

There has been a LOT of speculation as to what will be announced at I/O, but there have been some things that have been pretty much confirmed, and right now, Google Games is one of them.

Android Police (AP) did one of their famous teardowns of some new a new Google Play Services app, and found a TON of references to Google Games, and even some working pieces!
http://www.androidpolice.com/2013/05/11/google-play-games-leaks-out-in-all-its-glory-ahead-of-google-io-hello-cloud-game-saves-apk-teardown/

Reading this got my mind rolling with ideas for Tic Tac Toe and Euchre. New achievements all over the place, new ways to get people connected, new ways to get more people playing, and new ways to have more fun with the games that I’ve already created! (Or in Euchre’s case, mostly created)

Since none of this has been officially released (or even officially announced) I can’t really start working on these things yet. But you can be assured that I will be working on it soon! (Well, once things get settled down in my personal life. Check out my personal blog for details on that.)

Android Euchre Progress

I’ve finally done it… my euchre logic will compile… mostly.

The only part that doesn’t compile is displaying the cards, because I haven’t created all of the separate card images yet. I have the image with the entire deck, but I need to split that into 24 different files (Yes, 24. This is a euchre deck, not a regular card deck) then I need to resize those 24 files for different screen sizes.

Then after that’s all done, I obviously need to test to make sure I didn’t break any logic. Then I need to build in the options that I had in the Windows game, and the statistics that are in the Windows game, and build a menu, and work on the achievements, and getting it to network… so there’s still A LOT of work to do.

BUT, I have reorganized a lot of the logic into new object classes (which makes the logic easier to follow) and I’ve fixed some actual logical errors in the computer play logic (thanks to warnings in the IDE I’m using) and the layout is pretty much set (I might have to tweak it slightly for different screen sizes, but it’s mostly good)

Here are some renderings from my IDE:

These renderings are emulating what the game would look like on a Galaxy Nexus.
I’ve included a few different views with different buttons that are used at different times. Also, different information is displayed at different times, so not all of the text boxes that you see will always be present at all times.
As you can see, there is an ad in the top left, (where it is very unlikely for the user to accidentally click it) hand information in the top right, game information in the bottom left, and most of the user interaction is in the bottom right.

The “Message Text” area is where all messages to the user will be displayed. This includes information about actions by the other players (IE: “Player 2 has passed” or “Player 2 has ordered the 9 of clubs to Player 3”, etc.) and it will have information as to actions that need to be taken by the player (IE: “Would you like to call trump?” or “Select a card to play”, etc.)

The cards in the center are the cards played by each player for that trick. This is also used as the “Up Card” display for player 1 and player 3. The “Up Card” for players 2 and 4 are closer to their hands.

There is a (Dealer) and (Passed) label for each player, which will be displayed as necessary. Once trump is called, all of the (Passed) labels will disappear, and some hand information will appear in the top right. The (Dealer) label will stay near the player who dealt until the next hand is dealt.

More Euchre interface ideas

Since I’m planning on having a database to store data, it will be easier to allow users to create multiple user profiles, and one device can then be used for multiple players. (Even using one login on devices that allow multiple device users.)

So I created a mock up of what I expect the user creation screen to look like:

I took a screenshot from my GNex used GIMP to make it plain white, then used MS Paint and GIMP to create this, so it’s not the best quality thing ever, but it gives you a general idea of what I’m thinking.

The only required piece of information would be the name. Each person needs a name, and they will be assigned an ID in the back end. I left some empty boxes, just because I don’t know what else people will want to put in there.

There are also options to import information from Facebook, Twitter and Google+. This is something that I’ve never actually done, so I’d have to look at their APIs and figure out how to do that. (Or if it’s even possible in the case of G+)

I also have achievements built into the Windows game, so I’d like to keep those and link them to a user profile as well. I also want an option for a user to backup this user data somewhere, and re-import it to a new device so that all of their hard work is not lost. Not sure if that’s possible without root access, but I’ll look into it.

For the picture, I’ll obviously come up with a default picture like most services do. That picture will be used unless the user uploads a new one, or pulls one from a social media site.

I’m generally a fan of the dark theme, but for this application I think the light theme will be a better fit. It will give a more upbeat feeling to the app, and I just think it will look better than the dark theme. As shown in this render, I will likely still use the dark theme for the buttons. This will make them stand out a bit from the rest of the UI.

Euchre – GUI Changes

I need to (at some point) start thinking about how this thing is going to look. So I took some screenshots from the Windows game, and marked them up a bit with what needs to be done.

First, some things to get rid of, and move around:

Anything with a red X through it can be removed. The logo in the center is unnecessary. The visual representation of the score (Above “Team 1 Score” and Team 2 Score”) would take up too much space. Same with the visual representation of the tricks won be each team (this is empty, as this shot is from the beginning of the game, but they are normally above and below “Team 1 Tricks” and “Team 2 Tricks”.) The games won numbers will be moved to the statistics window. These are mostly things that I added because I had the room for it on a desktop environment, and add a bit of realism to the game. They are not, however, necessary to game play.

The circled information (team score and tricks) can be gathered into one place, which for now I have designated as the red rectangle in the top left. Or possibly score in the upper corner, tricks in the lower corner, or something like that.

Next, some things that are necessary to keep around, and in a similar place as where they are now
:

Again, I’ve X’d out the unnecessary things, but in this case the circled objects need to stay relatively close to where they are.

Players’ cards and name labels need to remain at the 4 edges of the “table”. There is also a (Dealer) label next to player 4’s name label, indicating that (s)he dealt this hand. There is also a (Pass) indicator that appears next to the names after a player passes their turn to call trump. (Since nobody has passed in this shot, the pass indicator is not present. But it is in a similar location to the dealer indicator.)

Near the bottom center (where the human player’s cards are) is a message to the user, indicating the most recent event in the game or what they need to do to further progress, below that are buttons (in this case for selecting trump, but other button appear there as well throughout the game. See the other screenshots to see those buttons) and below that are choices to call alone, or to pass (“Don’t Call”.)

These things all need to remain relatively close to their current position.

And lastly, some more things that need to stick around.

Once again, X’s through unnecessary items, circles are things that should stick around.

In the top right is information about the current hand: who dealt, who called trump, and what trump was called. This can be moved if necessary, but should still be present somewhere.

In the center are the cards that each player has played in this trick. If you look at the screenshot above, I use a similar location for the “Face up card” when calling trump (which ironically is face down in the shot.) In the mobile version these locations can be one and the same, but the face up card will still rotate around the table, to give a visual representation of who dealt the hand.

You can also see in this screenshot how the visual representation of the tricks are displayed. Team 1 has 1 trick, therefore 1 face down card is displayed above the “Team 1 Tricks” text – indicating that 1 trick, or book, has been taken by that team. As stated above, this is not necessary as long as there is a textual representation.

Euchre – Moving code is time consuming!

As I mentioned in one of my previous posts, I’m doing a lot of rearranging of existing code: Moving some stuff into existing object classes and creating some new classes.

Unfortunately, this does not necessarily mean less code, it actually usually means more code… and it means a lot of revamping on existing code to change it to object.function() notation. But the good part is that it means better organization of the code, and more secure code.

Previously, I had a lot of global variables so that I could access information from anywhere. Now, those global variables are mostly inside of an object (or will be soon.) This makes the information harder to access from the outside, making it more secure, and it also gives the code a better logical flow, which means that it makes more sense to me and anyone else who tries to interpret the code.

Even when originally creating this program I knew that having so many global variables was a bad idea, but at the time I couldn’t think of a better way to do it. I was still VERY new to programming (and still am fairly new at it) so I didn’t have a lot of the knowledge that I have now. (Plus it wasn’t a very public program, so I wasn’t too worried about doing things by the book. I just wanted something that worked.)

Another problem that I have is that most people will come up with an idea, then create a plan of attack (including things like: What objects do I need? How am I going to have the user interact with this? How do I want to display things? etc.) I normally do not. I sit down and start coding, and when I run into something where I ask myself “How am I going to do this?” I make a note, move onto something else, and think about a plan of attack later. (I’ve actually got more pre-planned with this project than I do on most of my projects)

I know, this is not a good way to do things, but it’s just how I am with everything. Planning is not my strong point, execution is my strong point. Even in high school and college, the teacher would say something like “You have all semester to do this paper. You should start it now or you’ll never get it finished!” I’d start a week before it was due. Sometimes less. Some of you might call that laziness, or procrastination (I would call it procrastination as well) but it’s also just a lack of planning on my part. But the best part is, I’d always do best on the papers/projects that I procrastinated most on. I guess I just work better under pressure.

But back on topic… as I’ve said a few times already, this code revamp is going to take a while. I have not even begun work on the UI layout, or anything that is user-facing code. It’s all been back end stuff, and it’s still a work in progress (even after spending about half of my day yesterday coding.) But the good thing is that when I’m done with this revamp, it’s going to be a much more solid product.

Side note: My main file still has over 11,300 lines of code. Admittedly, at least a few hundred to 1,000 of those lines are probably comments (one thing I DID do well with this was commenting) but that’s still a LOT of code. And that doesn’t even count the code in the object classes. However, I think a lot of code will be eliminated when I start getting rid of things like saving/loading files (I plan to use databases and SharedPreferences instead) and some of the Windows specific things (like only allowing 1 window to be open at a time, a lot of menu code – which I expect to be less code for Android, and a few other random things.)

Euchre Translation – preliminary thoughts

So I started looking through my code for my euchre game, and thinking of ways to improve my existing code. Mostly, ways to make this not seem like such a daunting task,

In my main file, which does most of the decisions on how the game is actually played, I have over 11,000 lines of code. Yes, you read that right. 11,000 lines in just one file. That’s insanity. So I got to thinking, I have many objects that I can distribute some of this code through.

Objects I have: CardDeck, EuchreDeck, PlayingCard, EuchreCard, Player, EuchrePlayer
Objects I think I should create: EuchreGame, EuchreHand, EuchreTrick, Stats
(All existing object classes have been translated to Android/Java already. The main code still has not.)

The CardDeck/EuchreDeck includes things like how many cards are in the deck, how to deal the cards, how to “shuffle” the cards

PlayingCard/EuchreCard contains things like the value and suit of the card, a “euchre value” of the euchre card, whether or not the card has been used, if it should display face up or face down, and the image associated with that specific card.

Player/EuchrePlayer has things like the name of the player, how many cards they currently have, what specific cards they have, whether they are human or computer, and their most recently played card.

EuchreGame will have things like the current score of the game, and achievement based variables.

EuchreHand will have things like a trick count for each team, whether or not someone called “alone”

EuchreTrick will have things like what player played which card

Then at the end of each trick, hand, and game, I can just create a new object which will reset the variables instead of resetting them in that already huge mess of code. It will make it look much better, and it will make it much more manageable in the future.

The game also keeps an insane amount of statistics, and displays them all in a single window (not sure how I’m going to display these stats on Android. Right now I have them broken into individual player stats, and team stats. I might have different tabs for each category, or I may have separate layouts depending on phone/tablet) All of these stats can be kept in an object instead of just variables, like they are now.

And there’s a lot of code that belongs in the existing classes which is not there yet. I just went through and marked a bunch of code that should be moved, and I’m sure there’s more. (I’ve only been through a couple hundred lines of the 11,000.)

Things I need to learn/plan/think about:

  1. How to write an object or variables to a file in Android
    1. The stats are kept in a file, and read from the file at the opening of the program. I don’t currently know how to do this in Android.
  2. How to network it
    1. I want to use Facebook and/or G+ to do something like “Words With Friends” or such games to allow people to play online. 
      1. Do I need a server of my own to do this? 
      2. Can I use the requesting device as a “server”?
      3. Can I use FB and/or G+ as a server?
    2. Should I make it live play only, or turn based like Words WF?
      1. I think making it turn based would be boring, but are people going to sit and play an entire game of euchre without quitting out? Having people constantly quit halfway through would be annoying.
        1. Maybe have it live, with an option to continue later?
    3. I have no idea how to do any networking in Android, so in any case I’m going to have a learning curve.
If you have any insight on the above (as a developer who can point me in the right direction for learning, or as a user who has a preference on game play) please leave a comment.

Euchre Card Design (and some game play design info)

I have finished the card design for my euchre game.

I went online and found a design someone else had made, then changed the design completely and only kept their template.

The design I found was close to a real deck of cards: the 9 of hearts has the number 9 and a heart symbol in the top left, and the same but inverted in the lower right, and 9 heart symbols in the center. This is how the cards in my desktop game are designed, and it works fine. However, a design like this would be hard to see on a phone, and maybe even a tablet. So I simplified it.

Each card now has the number (or letter) designating it’s value, and the suit symbol in both the upper left corner, and in the center of the card. In both places, the number is above the suit.

I kept the top-left notation because I want the cards in the game to be displayed as they would appear in your hand in real life: stacked over top of each other, with only the left side showing on all but the right-most card. Again, this is how the desktop game is setup.

However, when a card is played (or otherwise not in a player’s hand) the whole card will show. Also, I want to make it so that when you hover over a card in your hand, it will lift a bit, so you can see exactly which card you are choosing (again, like the desktop version) and to play the card, you will swipe up toward the center of the card table.

This is going to take a while to figure out how to do. As some of you know, I have a swipe action in Auto Respond, but the swipe is not animated. I have not yet figured out how to make the screen (or in this case an object) move as the swipe is occurring. This is something I will have to look into some more.

Here are the card images I will be using:

Depending on how well the images appear on screen, I may adjust the size of the text a bit. Possibly making the corner text slightly larger, and/or making the center text slightly smaller.

For those of you who know how to play euchre, you know that I only need the 9 through A of each suit for this game. But I figured that designing all of them would make it so that I can reuse them for other games if I want. (and I may use a 2 and 3 for showing the score, like I do in the desktop game. Although that would be tough to do without having multiple symbols in the center of the card. It may confuse some people.)

Also, I just realized I still need to design the back of the cards. As with the desktop game, I will likely have multiple designs for the back of the cards. A simple design of stripes or crisscrosses available in both red and blue, and maybe some special designs, like the 1515 Studios logo, or an Android (or bugdroid as some call it.) We’ll see what I come up with 🙂

Euchre Conversion to Android

I just started converting my Windows Euchre game to an Android app, and there’s already some things I miss about C#.

  1. Operator overloading
    1. In C# I can create functions to overload the =, ==, <, >, and other operators, so that I can do things like if(card1 < card2)
    2. In Java I have to create functions like .set, .equals, .lessThan, .greaterThan, etc. So I have to now change all of the == to .equals in my code, and so on with the other operators. Now I have to do if(card1.lessThan(card2))
  2. set/get Functions
    1. In C# I can do something like this:
      public string name
      {
          set
          {
               this.m_name = value;
           }
           get
           {
               return this.m_name;
            }
       }

      Then access the variable like this:

      player1.name = “Randy”;
      and
      name = player1.name;

    2. In Java, I have to create 2 functions, setName, and getName, then have to access like this: player1.setName(“Randy”); and name = player1.getName();
  3. Native Data Types: This one I’ve run into before while programming with Android/Java… native data types have different names in C# and Java. And I’m so used to using C/C++/C# that I often find myself using the wrong name.
    1. In C#, true/false values are bool, and text values are string
    2. In Java, true/false values are boolean, and text values are String (capital S)
      1. This is because (as I explain in more detail in #5) strings in Java are objects, whereas they are a native data type in C#.
  4. Naming Convention
    1. In C#, generally variables start with lowercase letters, and functions and classes start with uppercase letters
    2. In Java, generally variable and functions start with lowercase, and only classes start with uppercase.
  5. String comparison: Because there is no operator overloading in Java, and strings in Java are actually objects not a native data type, this is different too
    1. In C#, I can say if(string1 == string2) and it will compare them.
      1. This is partly because strings are a native data type in C#. But even if they weren’t, you would have the ability to override the == operator.
    2. In Java, I have to say if(string1.equals(string2)) to compare them
      1. This may not seem like a big deal, but doing string1==string2 is legal, and a valid statement, but it likely will not return the result you are looking for. This will check to see if the two variables are in the same memory location, NOT whether or not they contain the same information.
These things may not seem like a big deal to someone who is not doing the programming. A few extra letters here or there, some difference in lowercase vs uppercase, some extra functions here or there… 
But when you’re dealing with literally thousands of lines of code which need to be translated from one language to another, this is a big deal. And testing is going to be a big deal too, because I’m sure that I’m going to make some translation mistakes somewhere. 
Luckily the IDE I’m working with is VERY good at pointing out possible logic errors as warnings (like the string1==string2 thing) so that will definitely help. But this may take a while, as I expected.
And although the IDE is good with logical warnings, #4 becomes a problem with this IDE because the auto fill function in the IDE is case sensitive. So if I am looking for player1.getName() and start typing player1.GetName(), the auto fill will not find getName(). (Or if it does find it, it will take a while to find it.)
Sorry for the rant, I’m just not a fan of Java and never have been.