The Tequila Den

Combines the world of Tequila with Games.

Tag Archives: bugs


Its been just about a day and I’ve been going through the code in canasta, trying to determine what I was I thinking in terms of some code changing. I almost abandoned the new additions I’ve made to the code because I think it was going to be a revert of sorts, but instead, it dawned on me, I’m re doing all of this to ensure the AI doesn’t get stuck in a position it can’t do anything, or the wrong/illegal move for that matter, I’m only partially through fixing and cleaning up, haven’t even got to the testing phase of it. In due time.

I know I should of just released it as 1.0A, then went back and fixed it properly for a 1.0B, or 1.1.

Every time I’ve been opening the editor up I’ve been thinking more and more about Mouse and what I want to do, plans for it, and such, then, after I’m doing with a tidbit I’ve been working on, I shut off my computer and start power up the XBOX, or my phone.

Big mistake.

I started playing GTA again since a bunch of friends also have the game and we’ve delved into the world of GTA online, oh my, now that’s a hoot. I absolutely love the idea of open worlds, do what you want kind of game-play. Then you have heists, robberies, businesses, and a bunch of mini games that can be played and land to explore. It’s my idea of a great game.

I also have a great idea of a game in my head, but unfortunately, that’s where it stands. Well, technically I have two, and the other problem with them is that they are not separate entities. They cross paths with each other so much that it’s nearly one giant game, but it can’t be. It wouldn’t make any sense.

The first, the one I mention most often, Mouse, was originally a two person party turn based combat game with close ties to Chrono Trigger and Final Fantasy. I had a large storyboard made out with characters, backgrounds, maps, ideas, places and most importantly, story.

Cue: computer crash.

Roughly 6-7 years ago my computer failed and couldn’t recover my hard drive. I had an older back-up disc I made that had personal stuff on it, some gaming stuff and some applications that were handy at the time. It also included a rough, old copy of my dream in the making. It was demoralizing, it was really hard trying to motivate myself to continue and try and get back to where I was, which was a solid 4-6 months of good progress. So I stopped.

Anyways, idea number two. A lot of mobile games hinge around a couple of common themes now a days, building an empire of some sort, and PVP (player verses player). My initial thought was you logged into a server (which in a sense be a city), and you’d be at home. Generic place in the city, could of been an apartment, nothing really concrete at this point. But the idea was, you’re unemployed, and you’re broke, and you need to get rent money. So each day a paper shows up with a job opportunities and you get to explore the world to try and get a job and make some money. Then your, ‘life’, or such begins.

Unfortunately, the aforementioned is a huge undertaking, not likely something I’d conquer myself, but I had ideas for a smaller, localized scope, which also tragically gets ties with Mouse, and then shit just spit balls down a large hill full of crazy brainstorming.

So, as I squeamishly work through fixing Canasta, I dream, and think about working on Mouse. Soon.


Is winter actually over?

Scary to think that winter might actually be over here in Saskatchewan, at least in my neck of the woods. I really hope we’re done with the frosty snow because that means golf season ramps up and camping season is just around the corner. I’m excited to sit on the deck and have a few drinks with friends. I’m also excited to get some summer projects done as well. Crossing my fingers.

In other news, mainly Canasta news, I was planning on releasing the game sometime this week, but in terms of testing and how I want to present the game, it just simply isn’t ready yet. I’m very happy with the direction I’m going, I’m just not overly satisfied with the AI at the moment. I enjoy it, it is a challenge but I think they can be better and there is some behaviours I’d like corrected to make them a bit smarter with their game play. I’ve also managed to weed out a few bugs with my testing, so far (fingers crossed) I haven’t had any debilitating crashes, just some odd occurrences that I do believe I’ve conquered.

As of now, the plan is to release it the end of the month, so stay tuned card fans.

Nearly done!

So I’ve corrected quite a few problems and issues regarding game play lately with regards to Canasta. Added a ton of logic for the computer AI. It’s actually pretty challenging when playing the computer, and I can see their hands! After some immense testing, I’ve only encountered one crippling error that I can’t seem to reproduce. As of now, I seem to be missing something, so I’m continuously investigating.

I’m thinking of releasing the game sometime this month as long as testing goes well. But there is a couple of things I’d like to add before that, but I may hold off. One of them which would alter play a lot would be the tuck feature. Since, when I play the game is a legal play, I think it’s important to incorporate.

The second is changing the way animations are displayed for the east & west team. Currently I use the up-right card images and would like to change them to their horizontal counterparts. I really need to update the functions for animation as well. Tend to have some issues. ūüė¶

Long day of testing…

screenshot 2015.03.16

It’s been tedious task testing a bunch of different scenarios and as many as I can possibly think of. There’s only so much I can truly go through until I need a separate brain to go ahead and think differently, so, with that in mind, I plan on a March 20 release date, so stay tuned & glued to this blog for your opportunity to claim this as your own.

(edit: I put the same date as the publish date as this post, that of course is incorrect, kind of a scatterbrain, the release is planned for March 20th.)

I’m going to spend the rest of the week polishing and omitting debug/testing, and non-vanilla data that will just inflate the file size (although I think it sits under 1 MB in size).

Finally got it…

At least, I think I do. I thought I had it all figured out before hand, but then a bug came out. A nasty little bastard that basically crippled the damn game.

Okay, that’s a bit extreme. The game is fine without it, but the problem was though you wouldn’t be credited with your feat unless you kept building and hopefully it picked the right set, sigh. Yup, longest road issues struck again.

I scoured the crap out of my code and found a slight oversight. My first “correct” stab at the process had all the roads tied together with it’s only possibility. Thus, if a player does place all 15 of their roads. The code would flip through each road and see if it can find it’s little soul-mate. So essentially what I thought I created was a set of road segments that could only go together. The problem was that once you see that particular set from the other end, it’s a cheating bastard. So what I thought I had wasn’t what I had at all. Re-write time.

I googled and lou-oogled (hot tub time machine, great movie,) around the web about how people have been implementing Catan’s longest road¬†and really I have seen a lot of forum/blog posts about the situation. None of which I’ve been able to successfully implemented in Javascript. They did however spark my brain and come up with a valuable solution to the issue at hand. The biggest issue I had with the process was how do I loop through the same set of roads twice, without repeating myself and going through a loop I have no idea how to stop or how many times it’d have to iterate as the list of possibilities grew exponentially as the amount of roads were being added. God forbid the player built “trees” and “circles” out of their roads. Headaches ensued.

The solution to world hunger… err…. finding the Longest Road in Catan, pseudo-style.

Take all roads and toss them into an array by themselves.
//roads[x] = the entire chain, r1,r2,r3 ; roads[x][y] = road in roads[x] in pos. y, r1.

Keep track of the ends of each of these roads, represented by settlement spots (which I refer to as corners) in an array that correlates to the roads’ array.
//ends[x][y] = x is equal to the x in roads, y = is the ‘left’ & ‘right’ of the roads’ x.

Set maxMisses to the amount of roads and misses to zero, and make to false.
//this is the control to see if a new chain of roads were created.

while (misses < maxMisses) Loop through all of the player’s roads. Loop through all the chains that were made. If the current road in the loop isn’t in the current chain, proceed, Now, if the current road links to the current chain and it’s not already in that chain,
– Clone the current chain along with the ends of that chain.
– Add the current road to the cloned chain ¬†and update the new ‘ends’ of the chain, add to the database of chains.
– set make to true. end the loop of the chains.

If the make is false, misses++, otherwise it’s set back to zero. end all loops… That will give you all the possible set of chains for the given player’s roads. It amounts to a bunch of roads, many of which are duplicate of themselves. This is because of the starting points of the roads; do remember that we clone each time we add a new road. They can easily be filtered out afterwards by seeing if the length is greater than 4 (Catan rules), you can eliminate more if you’ve stored the current longest road.

You can always comment / email me if you’ve got questions about my implementation or if you want to see some code. (Warning, I’m not a pro-scripter by any means and some stuff is kind of messy, and not exactly ‘efficient’.) Next time, how to see if the chain has been interrupted by an opposing settlement/city.

Still recovering…


Went to Vegas this past week and enjoyed it thoroughly. Definitely missed out on a bunch of sleep, but replaced that with plenty¬†of booze and gambling. I wish I could go there more often, but then again, I might die by the time I’m forty.

Go see Beatles Love by Cirque du Soil. Amazing, two thumbs way up. Also, get totally hammered in a good mood and check out the Tournament of Kings at Excalibur. totally worth the money, great entertainment.

When you get back from Vegas, give your liver a break, the drinks are ten times stronger coupled with lack of sleep and more booze, you’re going to be a wreck.

Best part of all, I did what I wanted to do, I learned (enough to play, basically), how to play craps. Interesting game and if you can find a cheap enough table it’s worth your time to play as it can be a cheap/fun experience. Don’t be let down when you loose the dice. I threw those bitches off the table more times than you could count.


Back on Traders again, working away mainly fixing lots of bugs and graphical errors that have been popping up. As of now, I’m going to say an early summer release, if not sooner. Something will be in your hands sooner rather than later.

Just a brief update.

I’m just making this update quickly over my lunch time at school. I actually meant to throw this stuff up last night, but my procrastination got the better of me.

Anyway, I managed to simplify a few things when it came to loading/displaying maps (whether or not it’s more efficient, I’m not entirely sure, haven’t tinkered yet). But the bottom line to that is that you can now pick and decide which map you’d like to play given from the available maps. I do plan on modifying this even further so I don’t have to readily distribute all the maps with each client, but rather with just the server. That’ll be done tonight barring anything going awry.

Also what I managed to squeeze into last night was the proper dispersal of numbering. Which I think if I recall, I fucked up again. But none the less, it can and most likely be fixed.

So, you may ask, what’s next?

In a lot of the things I’ve shown recently, the hexes are shown as “random” hexes, so now, I have to convert to a real hex with a resource equivalent. Nothing major, just setting everything right is the issue, although it isn’t really one in the first place. It’ll be handled.

I’ll bring another update (perhaps) tomorrow, maybe showing some screens and such. If I’m nice.

You know, just killing bugs…

So I fixed a few things. A few important things. But first, I made it so you could actually win the game. It displays a fairly lame message that so and so has won. It’ll be updated later with more information and statistics on the players. Similar to what Asobrain has. I plan on having a database for the players and keep records and such.

Anyways, I did a whole bunch of testing, and nearly finished a game. Before it got crippled. I messed some things up when I use year of plenties, monopolies and robbing. I forgot to sort their hands so it’d hit up an error if you tried to build something right after using one of the cards. So that is fixed now. Then something reared its ugly head. Longest “fucking” road. I want to throw something.

However, I think I found the culprit. A typo goes a long way. Seems as though I forgot to change a single number when I copied over a check, came to be very important. I’m confident that it is resolved.

What a weird day.

I should come up with a legal way to say CCCCC.

Bug squashing

So I thought I had the longest road figured out, but then came the errors. So I had re-insert all the logging code and try and narrow down the problem. I found out I was adding unnecessary spaces in my ‘lone ranger’ segments. I wasn’t splicing out the proper road in my collection therefore it tried to reference a dead road. Which leads to an error of course. I later found out, through more game testing, that I limited roads too much by opposing forces. Both cases have been fixed anyways.

So I’ve been working on something new. Don’t panic. It’s not an entirely new project. It is CCCCC related. It’s simply a map maker for the game. So far you start with a blank map and can place all the tiles on the map wherever you see fit. Of course you can’t save or load and it isn’t importable ready.

screenshot 2013.11.15

Longest Road (EVER)

I think I actually got it. What a bitch.

It was a nightmare. I knew it wasn’t going to be easy, but when I first started planning for it, I was honestly stumped. I pieced together the eventual formula, but it took a lot of brain juice.

I’ll break it down. First off, I copy an array of all the roads the player has. Then from that array, I separate all the roads into single segments. What that means is that it is a list of roads that only have a single path. Of course these road segments could be longer when the roads have multiple branches and directions, but this is the simplest form. The roads are all accounted for in this instance. After this, I cycle back through all the segments matching them with other segments and creating new segments. This creates a list of all possible road paths (through all possible branches). This creates a longest road. Although, there’s a catch. Road length can be intercepted by opposing settlements, thus, there’s another check these completed segments must go through. I kept tabs on the ends of the roads throughout the process, so all I did now was cycle through the completed segments catching to see if an ‘enemy’ settlement was blocking, keeping track of the length. At the end, the longest length recorded and returned. Ta-da.

Clear sailing ahead!

Oh fuck, I forgot about ports again. Son of a …