chess4j 3.0 is released!

After a long period of inactivity I’m happy to announce the release of version 3.0 of my Java chess program, chess4j. This version is a good bit stronger than the previous version, though still not as strong as my C/C++ program Prophet (see below). The key areas of improvement are:

  • The addition of an opening book, which I discussed here.
  • Improvements in the positional evaluation function
    • Passed pawns are rewarded
    • Isolated pawns are penalized
    • Doubled pawns are penalized
    • Rooks on open files or half open files are rewarded
    • Rooks and queens on the 7th rank, particularly when connected to another rook or queen are rewarded
    • There is some attempt to keep the king sheltered until the endgame, and then encouraged to move towards the center
  • Almost 2x speed increase

The table below compares the performance of chess4j v2 against v3 on several different test suites. Each suite was run twice and the results averaged. I highlighted changes of +10% or more in green (good), and -10% or more in red (bad). The top 4 suites are tactical suites. There weren’t any significant changes here, despite the 2x speed increase. However, the ‘SBD’ suite and all the ‘STS’ suites below that are positional suites, and there were some differences there. Key areas of improvement (according to these tests) were ‘undermining’, ‘open files and diagonals’, ‘bishop vs knight’, ‘offer of simplification’, and ‘queens and rooks to the 7th rank’. The one suite marked in red measures advancement of the f/g/h pawns. I think the added king safety code has something to do with that: the program is less willing to push those pawns if the king is castled on that side.

Suite/Time v2 raw v2 % v3 raw v3 % Delta raw Delta %
WAC/5 258 86.0% 266 88.7% 8 2.7%
WAC/10 270.5 90.2% 273.5 91.2% 3 1.0%
WCSAC/5 775 77.4% 784.5 78.4% 9.5 0.9%
ECMGCP/10 35.5 19.4% 37 20.2% 1.5 0.8%
SBD/60 45.5 34.0% 96.5 72.0% 51 38.1%
STS1/5 30 30.0% 48.5 48.5% 18.5 18.5%
STS2/5 19.5 19.5% 39.5 39.5% 20 20.0%
STS3/5 45 45.0% 41.5 41.5% -3.5 -3.5%
STS4/5 36.5 36.5% 41.5 41.5% 5 5.0%
STS5/5 41 41.0% 59.5 59.5% 18.5 18.5%
STS6/5 47 47.0% 48 48.0% 1 1.0%
STS7/5 22.5 22.5% 33 33.0% 10.5 10.5%
STS8/5 31 31.0% 20.5 20.5% -10.5 -10.5%
STS9/5 30 30.0% 37 37.0% 7 7.0%
STS10/5 55.5 55.5% 57.5 57.5% 2 2.0%
STS11/5 19 19.0% 28 28.0% 9 9.0%
STS12/5 42 42.0% 48.5 48.5% 6.5 6.5%
STS13/5 45.5 45.5% 48 48.0% 2.5 2.5%
STS14/5 31 31.0% 62.5 62.5% 31.5 31.5%
STS15/5 22 22.0% 29.5 29.5% 7.5 7.5%

The table below shows chess4j’s performance in a head-to-head match verse four other engines (the bottom one being my engine, Prophet). The match conditions were: only one processor could be used, no thinking on the opponents time, and no opening book libraries or endgame tablebases. The matches were done using a set of 20 starting positions called the ‘Nunn Test Suite’. The engines play from each position twice- once as white and once as black, making the entire match 40 games. One thing that may jump out is that the results don’t seem consistent. Why the variability against the same opponent using different times? It very well could be that chess4j is better at longer time controls, but it would take thousands of games to prove that theory. This game set is too small to be statistically significant. The main point was to get a feel for how strong the engine is.

Opp 1 min 3 min 10 min
Gerbil 5-31-4 9-23-8 10-23-7
Horizon 4.3 6-31-3 8-28-4 4-31-5
Lime 6.2 5-32-3 4-29-7 6-29-5
Prophet 2.0e 2-32-5 4-35-1 2-35-3

While there is certainly a lot to do with the evaluation, it’s not so far behind Prophet’s that it would explain such a lopsided result. I’m afraid the main disadvantage chess4j has comes down to speed. On my laptop I typically see chess4j search between 180,000 and 200,000 positions per second. That may sound like a lot but this (32 bit compile of Prophet) searches between 800,000 and 1 million positions per second (and there are programs out there that search much faster than that!). To test that theory I ran another set of matches against the same opponents using time odds. In the table below, the 2x, 4x, and 8x columns show how chess4j would fare in a 1 minute match if it were 2x, 4x, or 8x faster than it is now. As you can see, if chess4j were 5-10 times faster than it is it would be much more competitive against this group.

Opp 1 min 2x 4x 8x
Gerbil 5-31-4 10-22-8 12-21-7 21-8-11
Horizon 4.3 6-31-3 8-26-6 11-21-8 12-21-7
Lime 6.2 5-32-3 6-30-4 14-20-6 16-12-12
Prophet 2.0e 2-32-5 6-29-5 10-27-3 15-9-6

Is it possible to make chess4j that much faster? Maybe. I was able to improve the speed of this version by a factor of two by doing a careful analysis of the data structures being used (mostly Collections stuff, like ‘ArrayList’ vs ‘HashSet’ and such), and looking up their runtime complexities for different operations (like adding, or iterating…) and changing the data structures where appropriate. But, I think I’ve gone about as far as I can down that road. This is a Java program after all. It’s not as “close to the metal” as a C program. I think to squeeze much more out of I’d have to scale back on how much object instantiation it does. But then it would look less like an object oriented program, and would probably be less readable and possibly harder to test… all of which go against what I want to accomplish with this program.

So, what’s next? My next areas of focus are:

  • It’s time to establish a proper testing routine. Meaning that, going forward, all changes to the program need to be measured in terms of ELO gain. This is a lot harder than it sounds but it will ensure changes are good changes.
  • Add a pondering search. Instead of sitting idly as the opponent is on move, try to guess what the opponent is going to do and start formulating a response. If we’re right often enough we can allow more time to think about each move.
  • Use all the machine’s processors! Most computers these days have multiple processors, yet chess4j is only capable of using one. (using multiple processors is easy. doing it efficiently [in the context of a computer chess] is MUCH harder than you might think)

If you’d like to try your hand against chess4j, you can download it from the
project website. It’s a console program though, not graphical. However, you can download a GUI and set it up to use chess4j… see the readme.txt file.

Enjoy!

Swafford Family Tour de States – Chapter I Part II

This is part 2 of a post where I was describing a trip my family and I took across the southern part of the United States. If you missed it you can click here to read it.

Oct. 18-21 – Visalia CA. We finally got out of the desert on this stop. Just two days before traveling through this area one of the roads we would have been traveling on was covered over with mudslides. This massive mudslide kept a major road closed for days as crews worked to unearth the road. Unfortunately some people did lose their lives, so we were really thanking God that the timing of our trip wasn’t just a little different. We ended up detouring around the closed section, on a road not really suited for bigger vehicles. I remember being high up on a mountain area with heavy fog and limited visibility. Not fun!

This stop and the next are in the central part of California, around the Sierra Nevada mountains. The main attraction in Visalia was to be Sequoia National Park. This is the home of the giant redwoods. The largest tree in the world is here – the General Sherman, in Sequoia’s Giant Forest. Some of the trees here are up to 3000 years old. Its incomprehensible how old and big these trees are. There are lots of trails in the Giant Forest. We took one just a few miles long called the “Congress Trail.”

20151020_132541

20151020_135911

20151020_140213

Oct. 22-25 – Coarsegold CA. Coarsegold is a little less than 100 miles north of the Sequoia area, east of San Francisco, close to Yosemite National Park. The KOA campground was probably my favorite. A lot of the campgrounds are really more “RV parks” than campgrounds, but this one was large, spread out, and really had more of a camping feel to it. Not long after getting there we noticed a lot of quarter sized holes in the ground. We discovered that these are tarantula holes! Apparently this area is known for their tarantulas!! They were even having their annual “Tarantula Festival” that very weekend!!! Jamie spotted one as he was riding around on his bike. Fortunately though, we arrived at the very end of the season so we didn’t see any more, to Amy’s great disappointment.

We had one day set aside to drive into Yosemite. On the way in, just outside the park we came across the Sugar Pine Railroad. This railroad was once part of a logging operation. Today it’s a tourist attraction, offering one hour rides on restored steam locomotives through the areas that were once logged.

Yosemite is one of the most beautiful places I’ve ever seen. The park covers a large area but there are only a few gates. Inside the park there is a large loop that circles around a valley area, with breath taking views. The trees are tall, with giant cliff faces and waterfalls all around. Towards the back side of the loop is a “village” with some shopping and eating. Unfortunately it was very busy while we were there, but I think it’s like that pretty much all the time now. Despite that we were able to find some quiet moments to just enjoy the scenery.

20151024_113951

20151024_142532

20151024_150213

Oct. 26-30 – Paso Robles CA. As we left the Yosemite area we traveled south and west towards central California’s Pacific coastline. We finally made it to the “other side!”

20151028_110924

We would be here for Halloween. We did a little decorating outside the trailer, and went downtown Paso Robles to do a little trick-or-treating.

pasorobles_halloween

Paso Robles is in the heart of wine country. There are lots of vineyards and wineries all around that offer tours and tastings, though we didn’t do any of that (it might be frowned upon with two kids). It’s also close to Hearst Castle, once the home of William Randolph Hearst. Hearst was a media mogul of the early 20th century. Anyone who was anyone in that day knew Hearst and spent time at his estate, which sits high up on a hill overlooking the Pacific ocean.

20151028_142334

20151028_142340

20151028_144215

Nov. 1-6 Malibu CA. From Paso Robles we headed straight down the Pacific Coast into southern California. Amy and I used to live in San Diego so we were really looking forward to getting back to our second home. Honestly though I was a little intimidated about the traffic we would be facing, but by this time I had thousands of miles of experience pulling the trailer so we did OK. The views driving down the Pacific Coast Highway were really spectacular. At one point we had the ocean less than 100 feet to our right and a mountain less than 100 feet to our left! The campground we stayed at was set up on a hill with a nice view of the ocean. We were able to see the ocean from the trailer. Some days we would pack a lunch and walk down to the beach.

20151104_131059

20151101_170448

20151101_170229

20151101_165135

There was a state park called Solstice Canyon within walking distance from our campground. One day we walked up to the park and then did some hiking. There were two old, abandoned houses on the trails. One had been occupied as recently as the 1980s but was destroyed by fire.

20151106_141110

20151106_142203

One day we drove down into Los Angeles to the Le Brea tar pits. Le Brea is right in the middle of town, and is actually an active (bubbling) tar pit! Over the course of 10,000 years or so that tar pit has swallowed up countless animals, some that are extinct today, so there is a lot of excavation and research going on. There are areas that are roped off, with warnings that you’ll become a fossil too if you cross the line!

lebrea1

lebrea2

We also went to the famous Getty Art Museum. Amy said she was a little disappointed with it overall. Of all the things we saw at the Getty the thing we’ll remember best is the parking deck! It became evident pretty quickly that driving our big truck into that parking deck was a mistake, but there was no room to turn the truck around and too much traffic behind us to back out. The parking deck at the Getty goes down into the ground, not up like most. As it goes down the overhead clearance gets a little shorter. At one point there was a sign that said if you couldn’t get under the sign you were too high. We slid the moon roof in the truck back and crept forward, clearing that sign by a few inches! I think Amy almost hyperventilated. I pulled that trailer about 7,000 miles, but it was in the parking deck at the Getty that I scared her most.

20151103_150039

20151103_162244

Another day we drove into Hollywood. I was really not looking forward to this, as it’s very crowded and not really somewhere you want to drive a big vehicle. However, we did manage to get to a scenic view of the Hollywood sign, got into Hollywood, found parking, and walked around for a couple hours. There was a red carpet event going on, which we later learned was some kind of Latino radio awards.

hollywood

20151105_151907

20151105_151938

20151105_152131

Nov. 7-13 San Diego CA. We were very much looking forward to our stay in San Diego. We went to San Diego a few years ago on a family vacation, but it’s such a great city and there’s always something else to do. We pulled in on a Saturday, so the very first item on our agenda was to visit Pacific Beach Christian Church (our “second home” church) the next morning. We hadn’t told anyone we were coming so we were really hoping Pastor Brian and some of our old friends would be there. Brian was really surprised! And we did indeed see some old friends. The lady in the picture below with Amy and the kids is Leona. Her and her husband Ed were members of PB Christian in the late nineties when Amy and I were attending. The church has changed a lot since then, and most of the faces have changed, but it still felt like a homecoming to us. We had a meal with the Daly family later in the week at their home. It was so great to catch up with them.

20151108_102217

20151108_115535

There is a small cafe at the end of Ocean Bean (OB) pier that we used to eat at. Had to do it!

obpier

cafe

One of the things we love about San Diego is the beautiful scenery at Point Loma. There is a small Coast Guard station on Point Loma, and an old light house that is no longer used. The light house actually isn’t very tall at all. It didn’t need to be because Point Loma is already so high above sea level. As you walk around Point Loma you see picturesque views of the city and the bay. (I used to love pulling into that bay in my Navy days. I knew when we passed beneath the Coronado Bridge that we were almost home.) There are some really nice walking trails around Point Loma, with surprisingly little to keep you from plunging into the ocean below! We stayed around long enough to see the sun set over the Pacific, an absolutely gorgeous sight.

20151108_143351

20151108_143248

20151108_154257

20151108_154345

20151108_154413

20151108_154549

20151108_154753

20151108_165350

The Wild Animal Park (now known as the Zoo Safari Park) is world famous, for good reason. There are a lot of exotic animals there, and the grounds and landscaping are amazing. It is (or was) the home of the only black rhino in North America. There are only three other black rhinos in the world, all in Africa. Sadly this rhino died just days after we saw it. The species will soon be extinct.

20151110_105640

20151110_131647

We also went to Legoland! This had been a dream of Amy’s for the last 16 years! Construction on Legoland was completed in 1998, while we still lived in the area. Amy had applied but they took so long to even respond that she took another job. To this day she still plays with Legos. She’s passed her love of Legos on to Jamie.

I wasn’t really sure what to expect out of Legoland, but it was very much a theme park with rides, and of course massive displays constructed entirely of Legos. There are different areas of Legoland, each with a different theme to it. One area was entirely Star Wars. In another area, there were reconstructions of world famous cities, like New York, Paris, and New Orleans. The weather hasn’t been kind to these displays over the years but it was still really something to see.

legoland

20151113_115138

20151113_131650

20151113_134008

When we left San Diego on Nov. 14th, it was a little bittersweet. We would be heading east, towards home. The trip was starting to wind down.

Nov. 14-17 Tuscon AZ. After a month of being in California we were finally back in Arizona, but further south than we were on the trip out west. Tuscon isn’t far at all from the Mexican border. There were two things on our agenda for Tuscon: to see the Airplane Boneyard and Tombstone.

Ever wonder where military planes go when they are retired from service? Most go to the Airplane Boneyard at Davis-Monthan Airforce Base in Pima. Since Davis-Monthan is an active Airforce base, one doesn’t just walk around at will. There is a museum outside the base that has an arrangement with the Airforce. The only way to view the boneyard is aboard a tour bus through this museum. There are acres and acres of planes here. Some could easily fly again, but other planes have been torn apart for their parts. The planes range from WWII era all the way up to modern planes. Unfortunately we couldn’t get off the bus and walk around the planes. The tour guide was a former military pilot and very knowledgeable about most of the planes out there.

20151116_141327

20151116_144513

20151116_144534

Tombstone is of course the location of the OK Corral, where the Earp boys and Doc Holliday got into a gun fight with Billy Clanton and the McLaury brothers. The town has done a good job of preserving their history. There is an unpaved street with wooden walkways that has an old west feel to it. There are even a few saloons! We went to a reenactment of the gunfight at the OK Corral and ate at “Big Nose Kates” – a restaurant named for Doc Holliday’s girlfriend and in the location of the “Grand Hotel.” There is a graveyard just outside of town that you can walk through. Clanton and the McLaury brothers are buried here.

tombstone

20151117_135915

20151117_142123

20151117_153820

20151117_162032

Nov. 18 – Las Cruces NM. Our next destination was Carlsbad, which was too far for one day so we stopped here overnight. By this point an electrical issue we were having with the truck was becoming a real problem. The turn signals had been starting to fail, and now were even malfunctioning to the point that a left signal would turn on the right blinkers! Las Cruces was going to the the last major town for a while but unfortunately none of the dealerships could get us in that day, so we said a prayer and pressed on.

Nov. 19-22 – Carlsbad NM. On the way to Carlsbad we drove through the Alamogordo and White Sands areas, then up through some mountain roads. On the way down the mountains I let the truck sort of “glide along,” trying not to use the gas at all. We were able to get up to 98 miles per gallon! If only we could maintain that!!

The KOA campground was a nice place, just north of Carlsbad and about an hour’s drive south of Roswell. The coldest nights of the trip were here. One morning I went to make coffee, and no water would come out of the faucet! The water hose completely froze up. I had to pull it off and stretch it out in the sunlight. I wasn’t happy about having to wait for my coffee.

Carlsbad Caverns was probably my favorite National Park. The entrance is just a big hole, like a cave. As you enter and start descending, the natural light slowly fades away until it’s completely gone. Of course the walkways are lit, but you can look off in the distance to see just how dark it is down there. The walkway descends around 800 feet or so, until you get to a large expanse known as the “big room.” The walk around the Big Room is about a 1 mile loop. The water pools there don’t move at all, yet they are crystal clear. One pool is known as “mirror lake.” There is an area known as the “bottomless pit.” Of course it’s not really bottomless, but it appears to be and must have really appeared so to early explorers.

20151120_115828

20151120_123153

20151120_135331

We also went to Roswell, the location of all the alien sightings in the late 40s. Roswell is a small town, and naturally they play up their reputation. There are alien statues all over the place. The street lamps light up green and look like alien heads. There is a small (but interesting) ‘UFO Research Center’ museum in town that we visited. Here you can learn all about the sightings and conspiracy theories and judge what really happened for yourself.

roswell1

roswell_streetlamps

Nov. 23 – Ft Stockton TX. Just passing through!

Nov. 24-28 – San Antonio TX. We spent Thanksgiving here. It was strange to not be with other family, but we had a good day together. We went out to eat at a really nice restaurant and then just spent a relaxed day with each other.

San Antonio is right in the heart of Texas. It’s a beautiful city. The Alamo is here, beautifully preserved in the downtown area. This was another opportunity to teach the kids some history by showing them firsthand. We started our tour of the Alamo by going into an old frame shop that’s right across the street. In this frame shop there was a large display of the Alamo as it once was, where (for a reasonable fee) the shop owner would tell you all about the battle. We then walked across the street, into the walls of the Alamo itself to see all these things. (Side note: if you’ve ever watched Pee Wee Herman — Ailsa asked an employee where the basement was. He wasn’t amused.) (Site note 2: I finally got the truck fixed here!)

20151125_142240

alamo

20151125_151657

San Antonio has a gorgeous downtown area. The river walk is lined with shops and restaurants.

20151125_154923

20151125_161347

There were also lots of hiking and biking trails within walking distance of our campground. Amy and I walked as the kids did some biking.

20151127_142142

20151127_142111

Nov. 29-Dec 2 – Houston TX. Houston is on the eastern side of Texas, near the gulf coast. It’s here that we noticed the land had shifted away from desert to green. It was starting to look and feel like home. The traffic in Houston is insane. Fortunately we weren’t staying in Houston, but just north of it, so I didn’t have to pull the trailer through all that crazy traffic.

We went to a zoo in Houston. The zoo is in their downtown area. It was a weekday (I think a Tuesday) and the weather wasn’t great, so it felt like we pretty much had the place to ourselves.

zoo

20151130_120132

Houston, we have a problem! We went to NASA’s Johnson Space Center! For me, this was a childhood dream come true. We sat in a room that presidents have sat in, looking in on the Mission Control of the Mercury and Apollo days. It was truly awe inspiring to me to consider what had been accomplished using technology that is far inferior to an average phone today. Incredible! We were also able to tour a facility where real research is happening that is relevant to today’s space program.

20151202_131752

20151202_135447

20151202_140354

We were also able to see (very closely) a Saturn V rocket – I believe the last. This is the actual rocket that was slated for Apollo 18, but the government shut down the program before it was launched. The thrusters are so big that it’s hard to fathom the power and force that comes from them as the rocket is launched.

20151202_142502

20151202_142804

20151202_143025

There is also a museum just outside of NASA’s gates that has some really interesting displays. Space suits, moon rocks, shuttle mock ups, movies, and even an old Star Trek movie set.

20151202_161757

20151202_115952

One final random memory from Houston: we went out to eat one night at a steak house. It seemed like the parking lot was full of trucks. Big trucks. I was glad we had a big truck. I would’ve felt out of place without it!

Dec. 3-6 – Baton Rouge LA. Houston was our last sight seeing stop, but there was one more item on the agenda before going home. Amy has a lot of family on her dad’s side in the Baton Rouge area. We stayed at a nice campground around a lake.

cheerio

On Saturday we went to her Aunt Beverly’s and Uncle Kenneth’s house. Lots of family came over to see us. Sunday we went to her Uncle Darryl’s and Aunt Minta’s house. Lots of family came over that day too! It was a great way to end the trip.

Dec. 7 – Toomsuba MS. There is just about 1000 miles between Baton Rouge and our driveway. We could have pushed to do it in two days, but we opted to do it in three. That was a good thing, because we had our first roadside incident on this day. We blew the right rear tire on the trailer. I got the trailer off the road but because of the slope of the road shoulder I couldn’t lift the trailer high enough to get the blown tire off. We had to call for help. Fortunately help arrived quickly and we were on our way.

Dec. 8 – Anderson SC. This was our first stop of the trip, and our last.

Dec. 9 – Farmville NC!! The state sign was a very welcome site! Everyone was super excited to that we’d soon be seeing family and home!

20151209_132800

It turns out that the spare tire had a leak! This was the tire the morning after pulling into our driveway. The morning after that it was flat!

20151210_151335

We estimate that we put about 7,000 miles on the trailer and about 10,000 on the truck. We saw and did a lot of amazing things. But, in the end it was the time together that made the trip so special. We are planning, Lord willing, to do a similar trip this year in the northern states. I can’t wait.

Swafford Family Tour de States – Chapter I Part I

The Swafford family just got back from a 3 month, 7000 mile trip around the southern part of the United States. To say it was amazing would be an understatement. There is no way I can describe or capture the experience in words.. it was just simply an incredible, once in a lifetime opportunity that we were blessed to be able to do as a family.

Planning for the trip started somewhere around Nov. 2014. It was more of a thought or just an idea at the time. We saw that a friend had done something similar so we thought – why couldn’t we do the same? I’m able to work from anywhere, so the only real obstacle was that the kids would have to be home schooled. We decided we wouldn’t want to pull them out of school part way through the year so we started kicking around the idea of leaving in Sept. Weeks and months went by, and though it still sounded crazy, we never talked ourselves out of it. We were actually starting to make some plans. The idea was solidfying – it was really going to happen. We bought a big ole’ travel trailer in July of last summer, and a truck that could pull it, and on Sept. 14th we pulled out of the driveway on our big adventure.

The focus of our trip was the southwest. We wanted to focus on parts of the country that were just too far to get to otherwise. We wanted to see some Americana. There are all these things out there that you might not make a special trip for by themselves (the world’s largest rubber band?) – but taken together these things are all part of what makes America, well, America. The image below shows our tentative route. In the end it wasn’t exactly that but it’s close enough that I’m going to use it anyway.

route

For the most part we were going to follow along I-40 until we got out west. We wanted to follow along Route 66 for a while, then hit the Pacific coast, drop south into LA/San Diego, head back east along I-10 towards Baton Rouge LA, and from there north and east to home.

Now, keeping in mind that I have to work for a living and that our kids need an education, we couldn’t travel and see sights every day. Some days would have to be “zero days” — days spent in the campground taking care of business. There were a lot of those days. And honestly, we needed those types of days too. Being on the go all the time will wear you down. So, we got into a routine of sorts, switching between travel days, sight seeing days, and zero days (and sometimes combinations of those).

Here is the travel schedule we kept.

Sept. 14 – Anderson SC. Just an overnight stop. Our first destination was going to be Nashville, but that’s 700 miles from home – too far to drive in one day while pulling a 36 foot travel trailer. On top of that, I wasn’t crazy about the idea of driving through the Appalachians. We opted to add an extra hundred miles to avoid the mountains by going down through Atlanta, though in the end the traffic was probably worse than the mountains.

Sept. 15-17 – Nashville TN. Spent some time with James’s family. We got to see my Grandmother, my two sisters Fallon and Hillary along with their families, and ate a nice meal with my Aunt Carla.

I recall that the KOA campground in Nashville was an older RV park, not really suited for longer rigs, so it was not a very pleasant experience getting the trailer in there.

20150917_194147

20150916_202027

20150916_201745

20150916_202224

Sept. 18-19 – Memphis TN. My mom lives in southeast MO so she was able to drive down and spend a couple nights with us. The major attraction in Memphis is Elvis Presley’s Graceland. There is also the (in)famous Beale St. What I recall about Graceland was, honestly, how … unimpressive it was. Don’t get me wrong- it’s a nice house for sure, but for some reason I expected something a little bigger for a “mansion.” The house was really not all that large. It still has the 70’s decor from Elvis’s day. There are several buildings behind the house though, one of them with a hallway that houses all Elvis’s hit records (and there were many, many of those). Jamie actually came away from that an Elvis fan, at least for a while.

20150919_151444

We also walked on Beale St, making true the lyrics of “Walking in Memphis.” There were some old shops, and of course a lot of bars, and some bikes. We ate at a Hard Rock Cafe.

20150919_174201

Sept. 20 – Sallisaw OK – just an overnight stop on the way out west. I remember some hiking trails out there. This is where we noticed that the land was changing.

Sept. 21-23 – Amarillo TX – very windy! There weren’t a lot of trees, just wind and tumbleweeds! We ate at a very old Route 66 diner. I had a buffalo burger. This is the home of Cadillac Ranch.

20150923_163210

20150923_163200

20150923_163147

Sept. 24-26 – Albuquerque NM – We saw some petroglyphs here, perhaps a few thousand years old left by ancient Pueblo peoples. It was a hot hike and we were on the lookout for rattlesnakes, but we really had the feeling that we were seeing some once in a lifetime stuff.

20150926_144158

20150926_144949

We also ate at this really authentic restaurant. I think it was the oldest in Albuquerque. Navajo tacos are good!

20150926_192901

Sept. 27-29 – Holbrook AZ – During our first night in Holbrook there was a lunar eclipse.

20150927_182046

There were two points of interest for us near Holbrook. The first was the Petrified Forest. We started to realize about 100 miles out that there wasn’t going to be a tree in this forest (or for miles around for that matter). But, who knew that millions of years ago the Arizona desert was actually a lush forest with raging rivers? The ground is rich with silica. Trees that fell into rivers became saturated with these minerals until eventually all the wood was gone, but rock remained.

20150929_161809

We also went to see a mile wide meteor crater. This meteor impacted the earth around 50,000 years ago. You can still see the “ripple effect” the impact had on the ground. It was truly incredible.

20150928_134401

20150928_135240

Sept. 30-Oct. 4 – Williams AZ – The first thing I have to say about Williams is that this is where Ailsa finally learned how to ride a bike! We practiced in the campground and it finally just “clicked.”

20151001_175033

Of course we went to the Grand Canyon. I knew that this was going to be one of the highlights of our trip. Amy and I had visited the Grand Canyon in 1996 with my brother Bobby, but the kids had never been. I remembered from back then a long trail that went down the canyon in a series of switchbacks, and then hiking along the plateau on the bottom to a point that overlooked the Colorado River. I didn’t remember the name of it but that was the famous “Bright Angel Trail,” and it’s the trail the family would hike on. Amy and Ailsa hiked about a mile and a half down (which is the hardest part by the way), then turned back while Jamie and I hiked a few more miles down to the Indian Garden. They did extremely well and Amy and I were both very proud of them.

grandcanyon

20151003_120303

20151003_120308

20151003_155959

Flagstaff AZ is about 30 miles east of Williams. Just south of Flagstaff are a series of Pueblo ruins. One of them is “Montezuma’s Castle.” Montezuma is actually an Aztec name, because it was originally thought to be Aztec. The ruins are settled into the side of a canyon wall. Unfortunately visitors haven’t been allowed in since the 1950s but it was still cool to see.

20151004_135109

Also in the Flagstaff area were the Tuzigoot ruins. The main area of the settlement was set up on a hill (that’s where the important people stayed). It was really something to see how those people lived. We tried to get the kids to imagine what life must have been like for those people.

20151004_152858

20151004_151208

Oct. 5-9 – Cedar City UT – Cedar City is a small town in southwest UT, near Zion National Park. Zion is absolutely gorgeous. We went there to do some horseback riding, which was Amy and Ailsa’s favorite stop of the entire trip. We were able to book a 3 hour guided tour. We rode horses in a group of about 10-12 people through the desert canyons. I’m sure it’s something none of us will ever forget.

20151009_132355

20151009_152529

20151009_135809

20151009_135813

Oct. 10-12 Las Vegas NV – Las Vegas is such a weird town. It’s really this big city sitting in the middle of a scorching desert. Amy and I had been there before too. We wanted the kids to see it but of course you have to be careful going to a place called “sin city.” But, we were able to walk up and down the strip and see some sights, and even took them to the famous Blue Man Group show.

20151011_203016

20151011_145835

20151011_141521

20151011_134712

20151011_134422

20151010_192442

We also visited the Hoover Dam. It’s absolutely insane how large this dam is. We went on a tour into the bowels of the dam, way down in the generator rooms. At one point we were standing directly over the river raging through large pipes below us. The entire room was shaking with the power of the water below.

20151012_154020

20151012_153910

20151012_153944

Oct. 13-17 – Needles CA – Needles, while in CA is still very much desert and HOT! There’s really not too much in Needles, but Havasu City AZ is about an hour’s drive. Havasu is famous for being the site of the London Bridge. It’s often confused with the Tower Bridge that still stands across the river Thames. The London Bridge really did come from London though, and at one time crossed the Thames. But, it was slowly sinking into the river (hence the nursery rhyme “London Bridge is falling down”). It was purchased by the city of Havasu in the 1960s for just a few million dollars. It was carefully dismantled, transported, and reassembled in exactly the same way it used to stand in London. This turned out to be a brilliant move by the city of Havasu, which has built an entire tourism industry around this bridge.

20151016_142020

Also worth mentioning here is that Jamie did some offroad biking in the rocky desert around the campground, took a nasty fall and split his hand open. It was late on a Friday evening. We cleaned it up and closed the wound up with some steristrips. He has a small scar on the side of his hand to show for it but is otherwise OK. It didn’t keep him off the bike for long.

This gets us to about the halfway point of our trip. Read about the rest of this trip in part 2.

chess4j + SQLite

The last time I wrote anything about chess4j, way back in November, I reported that chess4j was using a small in-memory database of opening moves. The program was reading a library of about 500 games from GM Kasparov, which it would do every time the program initialized. Before each move, chess4j would consult this in-memory database to see what moves have been played by Kasparov (or his opponent), and choose between them using a weighted random selection algorithm. The effect of this was that chess4j no longer played the same opening moves, so it added some variability to its online play. It also produced games that were a little more “aesthetic”, or pleasing to look at.

That was a huge step forward, but it had some limitations. Reading all those games takes a little time, so it isn’t really practical to read in more than about 500. It’s also expensive in terms of memory since they are all held in-memory, so there are some limitations there. Finally, it doesn’t leave any room for any learning algorithms since the program is initialized to the same state each time it starts.

To address those issues I needed a solution that persisted data to the disk. In past programs written in C/C++ I’ve created custom file formats and used fseek() and the like to probe it. This time I decided to use a proper database. I had considered MongoDB, mainly just to play around with it, but in the end I decided on SQLite. SQLite is lightweight, reliable, and fast – a perfect fit. (Side note: the primary author of SQLite, Dr. Richard Hipp, was roommates with my graduate school advisor, Dr. Ronnie Smith when they were both working on their PhDs at Duke University. I’ve met him… very nice guy.)

The database table to hold these opening book moves is very simple:

sqlite> .schema book_moves
CREATE TABLE book_moves (key int not null,fromsq int not null,tosq int not null,frequency int default 1,wins int,losses int,draws int);
CREATE INDEX idx_book_moves_key on book_moves(key);

Really, the only fields that are necessary are the first three: key, fromsq, and tosq. ‘key’ is used as a signature for a position. That is, every possible chess position has its own unique value for ‘key’. (I’m not going to get into the algorithm to do that in this post, just accept that it’s true!) ‘fromsq’ and ‘tosq’ are probably self explanatory – they represent the square the piece is moving from and the square it’s moving to. So, if we want to probe the opening book to see what moves it contains from any given position, we just produce the value of “key”, then perform the query:

select fromsq,tosq,frequency,wins,losses,draws from book_moves where key=?

‘frequency’ is a count of how many times the move was encountered as the opening book was constructed. This is what makes the random weighted selection possible. The idea here is that, if move A was encountered 10 times as often as move B, then chances are it’s a better move and I should play it roughly 10 times as often. This approach helps keep a stray “bad move” that may have found its way into the book database from getting on equal footing with good moves.

Finally, we have ‘wins’, ‘losses’, and ‘draws’. Each time chess4j completes a game, it increments the appropriate counter for the moves it played from the opening book (not moves the opponent played). It doesn’t actually do anything with this information yet, but future versions will probably use the information to avoid any moves it consistently loses with.

So, that’s a brief description of the implementation. To seed the database I found an online collection of about 50,000 games played by Master level players or above. The database I’m using currently has nearly 150,000 moves.

Watching chess4j play with this opening book is really fun. Since it doesn’t have to “think,” it plays almost instantaneously when it has a response in the opening book. Below is a segment from logfile. Notice how it begins with “c4”, then parses the opponent’s response “g8f6” and responds with “b1c3”. The frequency counts on the moves it encounters in its opening book gradually diminishes until it has no book response for “c7c6” and has to start thinking on its own.


# parsing: level 0 5 3
# level: 0, 5, 3
# setting increment to 3000 ms.
# parsing: name Pepo2424
# opponent is: Pepo2424
# parsing: rating 1989 1611
# parsing: time 30000
#time : 300000
# parsing: otim 30000
# parsing: go
# book move: BookMove [move=c2c4, frequency=8939]
move c2c4
# parsing: time 30300
#time : 303000
# parsing: otim 30100
# parsing: usermove g8f6
# book move: BookMove [move=b1c3, frequency=1520]
move b1c3
# parsing: time 30600
#time : 306000
# parsing: otim 30100
# parsing: usermove g7g6
# book move: BookMove [move=g2g3, frequency=182]
move g2g3
# parsing: time 30900
#time : 309000
# parsing: otim 30300
# parsing: usermove f8g7
# book move: BookMove [move=f1g2, frequency=225]
move f1g2
# parsing: time 31200
#time : 312000
# parsing: otim 30400
# parsing: usermove d7d6
# book move: BookMove [move=e2e4, frequency=24]
move e2e4
# parsing: time 31400
#time : 314000
# parsing: otim 30500
# parsing: usermove e7e5
# book move: BookMove [move=g1e2, frequency=5]
move g1e2
# parsing: time 31700
#time : 317000
# parsing: otim 30600
# parsing: usermove e8g8
# book move: BookMove [move=e1g1, frequency=12]
move e1g1
# parsing: time 32000
#time : 320000
# parsing: otim 30200
# parsing: usermove c8e6
# book move: BookMove [move=d2d3, frequency=7]
move d2d3
# parsing: time 32300
#time : 323000
# parsing: otim 30300
# parsing: usermove c7c6
# transposition table initialized with 1048576 entries.
# time remaining: 323000, increment: 3000, allotted time: 15920
1 -183 1 2 c3d5
1 -1 3 4 c3b1
1 4 4 6 c3a4
1 17 4 10 f1e1
1 20 4 12 h2h3
1 22 4 14 h2h4
1 22 6 39 h2h4
2 7 6 78 h2h4 b8d7
2 12 12 230 d1b3 b7b5
2 12 12 246 d1b3 b7b5
3 17 21 368 d1b3 b7b5 h2h4
3 17 28 1500 d1b3 b7b5 h2h4
4 7 45 3541 d1b3 d8c7 h2h4 b8d7
4 7 79 5825 d1b3 d8c7 h2h4 b8d7
5 12 121 9522 d1b3 d8c7 h2h4 b8d7 a2a4
5 12 139 15133 d1b3 d8c7 h2h4 b8d7 a2a4
6 7 190 23677 d1b3 d8c7 h2h4 b8d7 a2a4 d7c5
6 9 293 38345 h2h4 b8d7 a2a4 a7a6 f2f4 h7h5
6 9 339 64469 h2h4 b8d7 a2a4 a7a6 f2f4 h7h5
7 10 440 97805 h2h4 b8d7 a2a4 a7a5 b2b3 d7c5 f2f4
7 10 640 172694 h2h4 b8d7 a2a4 a7a5 b2b3 d7c5 f2f4
8 7 817 243868 h2h4 b8d7 a2a4 a7a5 f2f4 d7c5 f4e5 d6e5
# hash probes: 628514
# hash hits: 58960 (9.38%)
# hash collisions: 31636 (5.03%)
# fail highs: 32795 (5.22%)
# fail lows: 2422 (0.39%)
# exact scores: 37 (0.01%)
move h2h4

-----SNIP-----

# parsing: result 1-0 {Pepo2424 resigns}

This improvement was a lot of fun to implement and it’s a lot of fun to watch. chess4j’s online opponents seem to like it too:

Ara61 says: Thank you for the great game!

I’ve also made some great improvements to the engine’s evaluation routine, but that will be the subject of another post very soon! And, as always the latest development code is available from the project website. These changes are not included in the last official “release” but will be in the 3.0 release coming within the next few weeks.

Another Goodbye

On Feb. 2 our family was dealt more bad news as Amy’s grandmother, Sallye Anderson passed away at age 88. It wasn’t totally unexpected, but it was certainly tough.

For many years our family has spent Sundays by going to church, and then going out to lunch with the entire family. After lunch we would all gather at Mr. and Mrs. Anderson’s house and spend the entire afternoon there, leaving just in time to get the kids in bed for school the next day. Sundays just won’t be the same.

I will never forget how she would greet me every single time I saw her. She would give a big smile and say “hey son!” I will sure miss that.

Mrs. Anderson’s obituary is here.

10408722_10203232964451751_1891990575374897205_n

Goodbye Mrs. Anderson, for now. We love you and miss you.

Twenty Years

On Jan 21st Amy and I celebrated our 20th wedding anniversary! It seems incredible to me that we have been married that long already. When I look back, they’re all there but it doesn’t feel like it’s been that long. But it’s true, we have spent half of our lives married to each other. That’s not even counting the three years we dated before that!

This being a “big one”, we really wanted to do something special. Above all we just wanted to spend some time together. It’s not very often that we do things without the kids, but this was going to be one of those times. We would leave the kids with Amy’s mom Eve for the week.

When we first started thinking about what to do, we thought about doing a cruise. Amy has never been on a cruise (and the only ones I’ve been on were the kind with the big gray ships that have a “USS” in their name). However, at the time Amy’s dad Rene was very sick battling cancer. We weren’t sure what would be going on by the time our anniversary rolled around, so we didn’t want to be stuck out on the water if something were to happen. Amy came up with the idea of just taking a road trip, to nowhere in particular, just a road trip. Then we decided to take a road trip to Key West.

So, on Monday 1/19 we boarded the pets, dropped the kids off with Eve, and headed south. We left around 11am and cruised into Daytona Beach around 6:30pm. That would be far enough for one day. We enjoyed a nice meal at Red Lobster and got a room at a Hyatt with an ocean view. The next morning we got back on the road. We made one stop in Boynton Beach to pick up some 95 Bordeaux Amy had ordered, then cruised into the Cheeca Lodge in Islamorada FL (about 75 miles from Key West). We had a gorgeous room with an ocean view (literally right there by the water!) and a hot tub on the balcony. It was so nice just opening the sliding glass doors up, or sitting on the balcony and enjoying the view in the warm weather. The resort had some nice restaurants so we just ate at one of them — Atlantic’s Edge — that night.

IMG_20150121_114329_202

On our anniversary, Wednesday 1/21 we didn’t even leave the resort. 🙂 It was so….. relaxing. We slept in, ordered room service, had lunch at the Tiki Bar, drank some pina coladas, had dinner at Limoncello (the Italian restaurant), and enjoyed that 95 Bordeaux. It was a great day.

Thursday we ventured down to Key West. The traffic on all of those islands doesn’t move too fast so it took a couple of hours, but it was a nice scenic ride. While in Key West we visited the Southernmost Point, toured a lighthouse, saw the outside Hemingway’s house with all his six toed cats, ate at a little Italian Pizzeria, walked around a cemetery, and just did a lot of walking around. It got hot! By the time we got back in the car we were ready to head back to the resort for some more relaxation!

IMG_20150120_160602_170

We had to check out Friday, but weren’t in a big hurry. We sort of lazily went about our morning, eating breakfast down by the water and just enjoying the last little bit we could. When we finally did check out we stopped by a couple of places around Key Largo to get some souvenirs. We made another stop in Boynton Beach to eat lunch, and got two more bottles of that 95 Bordeaux — one to be opened on our 25th anniversary and one on our 50th! (God willing!). We stopped for the night in St. Augustine, had another great meal and finally got home on Saturday afternoon.

So, all in all we spent five nights away from home, three of those in the Keys. We logged over 2000 miles. We ate some great meals. Most importantly though we had a great time just being together. It was a great way to celebrate our anniversary.

Life is a broken computer

This poem was written completely by Jamie, it’s an original work 100% by him.

Life is a broken computer.
Now boy let me tell you this,
I’m not working right.
Viruses are hitting me everywhere, and I can’t even charge.
My chords are ripped and my screen is cracked.
My speakers are destroyed and my vision is blurry.
Many of my sites are messed up.

Even through this, I have been goin’ on.
When I shut down I don’t stay shut down.
I always come back on.
Even though my internet is slow, I still get to where I need to go.
Viruses never kept me from getting to places.

They never will and they should never keep you either boy!
Now boy don’t you shut down.
I’m still goin’, boy
I’m still goin’,
Even though I’m not working right.

Crossing Over

I just noticed this post I wrote back in April but never published! So here it is… better late than never?

====

Last weekend, 4/4 – 4/6 was Jamie’s last camping trip as a Cub Scout, and the last one with the 452/785 units. Jamie’s been a Cub Scout for 5 years now. He’s been to just about every camping trip (or maybe every one?), and I have to say this might have been the best camping trip yet. It sure had the best weather I can remember.

Jamie and I headed down to camp on Friday afternoon. I took off at lunch on Friday to finish packing, so that shortly after Jamie got home from school we could take off. We ended up getting to the camp around 5pm. It seems everyone was a little later getting there this year. Only a few people beat us there; we pretty much had our pick of spots to set up on.

Friday was the typical Camporee Friday: it’s all about “getting there” and getting set up. Since we were there so early we helped others as they rolled in. I probably helped put up 5 or 6 tents that afternoon. Jamie helped some too, in between running around with other boys, shaking sticks and playing whatever game they had going with the neighboring pack. (I heard something about a truce, and the breaking of the truce, and preparations for war…)

On Saturday things went a little differently. Normally all the boys in all dens stay together as they float from activity to activity, escorted along by some of the parents. This year the older boys had separate activities. From 9am-11am they built rockets, launched rockets, practiced the scout Oath and Law (in preparation for Cross Over that evening), and for the first time I can remember…. tomahawk throw!!!

As Jamie transitions into Boy Scouts it strikes me how fast it all went by. As one of the mom’s of one of Jamie’s fellow Cub Scouts put it… “in the blink of an eye they became Boy Scouts.”

tomahawk_throw

spring_camporee_2014_meandboys

color_guard

kitchen_patrol

chowtime

Sad News

It is with great sadness that I write this.

After a short but difficult struggle with lung cancer, Amy’s dad Rene passed away on Dec. 19th. When I say short, it was really short. We were just camping with him in August! He had a backache at the time (and had back problems since early May), but thought it was a result of some work he had done around the house. And in fact, that’s how the doctors were treating it – with muscle relaxers. It wasn’t until late August that he had an x-ray and they discovered some spots that might be cancerous. That suspicion was confirmed in September as he was checked into Wake Forest Baptist Medical Center in Winston Salem NC. He never went home again. From the hospital he went to a nursing home for rehabilitation, and eventually to the VA Hospice in Salisbury NC.

I will say this about my father-in-law: he was one of the kindest, gentlest and most sincere people I have ever met. He was a good man and he’ll be missed. I hate that our kids have been robbed of both of their grandfathers now but I’m really very grateful for the example that he was to them. I’m grateful for the example he was to me.

Rene, we love you and miss you.

This picture was taken in Aug. 2008 at one of our annual camping trips to Cade’s Cove.

16_SicardsSwaffords

Swafford Consulting Hired for TrACER-R Project

I’m very pleased and excited to announce that Swafford Consulting has been selected by IVIR Inc. (Information Visualization and Innovative Research) to rewrite and expand the Training/Test Assessment Capabilities and Reporting for Research (TrACER-R) System.

The following information has been publicly released by IVIR and posted on this website with permission from them.

TrACER is an automated assessment and evaluation system, designed for research and test conduct. It automatically produces test instruments, collects tests data, correlates data and produces both statistical and descriptive analysis for final test reports. The system can be used for any procedure or skill set identified in critical research areas. It produces objective evaluation of subjects, and observer/controller performance for cognitive tasks, psychomotor skills, affective measurement, and decision making performance. It is particularly useful for medical research.

Swafford Consulting has done work for IVIR before, on the F2MC Trainer project .