The Geeks Shall Inherit the Earth

Personal Ramblings of the Techhouse Admin

Skip to: Content | Sidebar | Footer

Minister for Digital Britain thinks an IP address is an “Intellectual Property address” – Boing Boing

9 April, 2010 (11:59) | Tech | By: Brian

Because I’m a bit of a geek and technology fan, I have slightly more than a passing interest in technology-related news and lawmaking. Particularly in the areas of intellectual property rights, security, privacy and net neutrality. A few days ago the United Kingdom passed a dangerously-draconian and ludicrous digital rights bill that makes our lawmakers almost appear competent and knowledgeable by comparison.

Minister for Digital Britain thinks an IP address is an “Intellectual Property address” – Boing Boing.

The problem is not just that the current copyright laws are apocryphal and out of touch with reality, but so are the people attempting to update the laws.

Some cool videos

9 April, 2010 (09:26) | Uncategorized | By: Brian

From the internet comes this amazing video of 8-bit video games invading New York: “PIXELS”, by Patrick Jean.

And also check out this music video version with a very different feel:

And for something truly bizarre, check out this YouTube channel of commentated Starcraft 2 matches in HD. Yes, people are so dedicated to this game that they will listen to other people commentate, like sports commentators, on skilled player matches. They’re actually pretty good at it, too.

Getting Started in the Train Yard

8 April, 2010 (20:48) | Erlang | By: Brian

I’ve started working on my Erlang implementation of the trainyard assignment from my AI CISC class at UD. First I had to decide on a data structure for the problems. They currently look like this:

yard1() ->
 { {yard, [{t1, t2}, {t1, t3}, {t3, t5}, {t4, t5}, {t2, t6}, {t5, t6}]},
 {init_state, [{t1, [engine]}, {t2, [e]}, {t4, [b, c, a]}, {t6, [d]}]},
 {goal_state, [{t1, [engine, a, b, c, d, e]}] } }.

yard2() ->
 { {yard, [{t1, t2}, {t2, t3}, {t2, t4}, {t1, t5}]},
 {init_state, [{t1, [engine]}, {t2, [d]}, {t3, [b]}, {t4, [a, e]}, {t5, 1}]},
 {goal_state, [{t1, [engine, a, b, c, d, e]}] } }.

yard3() ->
 { {yard, [{t1, t2}, {t1, t3}]},
 {init_state, [{t1, [engine]}, {t2, [a]}, {t3, [b]}]},
 {goal_state, [{t1, [engine, a, b]}, {t2, []}, {t3, []}] } }.

yard4() ->
 { {yard, [{t1, t2}, {t1, t3}, {t1, t4}]},
 {init_state, [{t1, [engine]}, {t2, [a]}, {t3, [b, c]}, {t4, [d]}]},
 {goal_state, [{t1, [engine, a, b, c, d]}, {t2, []}, {t3, []}] } }.

yard5() ->
 { {yard, [{t1, t2}, {t1, t3}, {t1, t4}]},
 {init_state, [{t1, [engine]}, {t2, [a]}, {t3, 1}, {t4, [d]}]}, %note c and b are out of order
 {goal_state, [{t1, [engine, a, b, c, d]}, {t2, []}, {t3, []}] } }.

I’m still trying to figure out what standard data structures look like in Erlang, but this is what I have currently. Here a Yard is really made up up three parts. First is the track definition, which is a list of left-to-right connected tracks. Thus yard-3, the simplest of the yards, is a simple switch. Because the actual numbers of the tracks aren’t used for anything computationally, I’ve decided to name them t1, t2 … tx. The second and third parts of the representation are states of the track. Here a state is a list of tagged tuples. The tag is the name of the track, the value is a list of cars on that track. In this representation I’m choosing to not list empty tracks like {t1, []}. I think that’s a waste, I can write functions to return an empty list if a track isn’t found in the state. The first state is the initial state of the track and the second state is the goal state of the track. The object of the assignment is to try to figure out a series of legal moves that will transition from the initial state to the goal state.

To help in testing and fetching data, I wrote three quick getters for parsing the data structure.

get_yard({{yard, Yard}, _, _ }) -> Yard.
get_init({_, {init_state, State}, _ }) -> State.
get_goal({_, _, {goal_state, State} }) -> State.

I use these for passing test data into the functions I’m writing. I’ve started work on the first part of the assignment, which starts with this:

%%Problem 1
possible_moves(Yard, State) ->
 lists:filter(
 fun(Move) -> not is_illegal_move(Move, Yard, State) end, generate_all_moves(Yard) ).

%%generate_all_moves(Yard)
generate_all_moves(Yard) ->
 lists:foldl(
 fun({Left, Right}, Moves) -> [{left, Right, Left}, {right, Left, Right} | Moves] end, [], Yard).

Just have to finish writing the illegal move test function and that will be done. Calls to these functions look like:

trainswitch:possible_moves(
trainswitch:get_yard(trainswitch:yard1()),
trainswitch:get_init(trainswitch:yard1())).

Once I finish this first part of the assignment I want to revisit the functions in the previous post and write better versions of them using the built-in-functions of the language and better pattern matching.

Code Syntax Highlight Test

7 April, 2010 (23:44) | Uncategorized | By: Brian

This is just a quick test of a code syntax highlight plug-in that I’m testing out. Here are some of the terribly-written beginner programs I wrote in erlang as answers to an old programming homework.

palinedromep([])  ->
 true;
palinedromep(List) when is_list(List), length(List) == 1 ->
 true;
palinedromep([First | Rest]) ->
 First == lists:last(Rest) andalso palinedromep(all_except_last(Rest)).

all_except_last ([_]) -> [];
all_except_last ([First|Rest]) ->
 [First | all_except_last(Rest)].

presentp(_, []) -> false;
presentp(Atom, [Head | Rest]) when is_atom(Atom), is_list(Head) ->
 presentp(Atom,Head) orelse presentp(Atom, Rest);
presentp(Atom, [Head | Rest]) when is_atom(Atom), is_tuple(Head) ->
 presentp(Atom,tuple_to_list(Head)) orelse presentp(Atom, Rest);
presentp(Atom, [Head | Rest]) when is_atom(Atom) ->
 Atom == Head orelse presentp(Atom, Rest).

duplicate_entries(Atom) when is_atom(Atom) -> false;
duplicate_entries([]) -> false;
duplicate_entries([_]) -> false;
duplicate_entries([Head | Rest] ) ->
 lists:member(Head, Rest) orelse duplicate_entries(Rest).

After looking back over them, I can think of much better ways of writing these samples using some of the built-in list libraries and/or tail recursion.

Learning Some Stuff

7 April, 2010 (23:20) | Erlang, Work | By: Brian

Lately I’ve been thinking about my career and where I want to take it. Eventually I want to be leading teams instead of working for one, and I want to get back to more science and research stuff. Toward those ends I’ve been educating myself in a few ways and changing how I approach my current job and my responsibilities there. At work I’ve been taking on more team leader and project management roles. Essentially my job is to make my boss’s job easier. I try to take a lot of the resource management, project design, project planning, time and cost estimations and actual development from him. These things are going pretty well for me, I think. My two year review is coming up soon, so I guess I’ll find out more about that then.

In addition to taking on more tasks at work, I’ve also been working on my own knowledge base. I’ve been reading a leadership training book called “Leadership Skills for Managers, Fourth Edition.” This book is a pretty good collection of ideas about what makes a good leader, how to use good leadership for productivity and how to improves one’s leadership. I’m finding the information pretty useful and have started to work it into how I coordinate with the teams I work on.

Another step I’ve started working on is also pretty industrious, but a bit more fun. I’m teaching myself a new programming language, one very different from the classic imperative languages I’m used to working in. After looking at a lot of newer languages and technologies, I’ve finally settled on giving Erlang a try. This is a bit risky, in that Erlang is not a standard language for the kind of work I’m currently doing. I will probably never be able to work it into my current job, but it’s just so interesting and different that I really want to mess with it. Erlang is a programming language designed at the Ericsson Computer Science Laboratory. It has some great features built-in to the language for concurrency, functional programming, distributed processing, hot code loading (changing the code of a running program on-the-fly!), fault tolerance and a bunch of other neat stuff. It’s a bit like Lisp, but also very much not like Lisp. My process for this self-education so far has mostly been to read a bunch of tutorial material, copy/paste/edit/run a few tutorial programs and to re-implement some old homework assignments in it. Because it is a functional programming language at its base, I took some assignments from my A.I. class that were written for Lisp, and translated them to Erlang. I’ll post some of those examples after I find a nice code-displaying plug-in for WordPress. The first few things I wrote were tiny functional programming examples of recursive algorithms (programs that call themselves until they complete). Now I’m working on rewriting my most favorite assignment from any of my classes, the trainyard. My original solution in Lisp can be found here. The interesting thing is that even though I technically already have this assignment “done,” the style of coding in Erlang is so different that I can’t even really copy and paste. It’s mostly just an algorithm reference and a memory jogger. I’ll show some examples of how this is going soon, too.

Quick Battle Calculator’s for Neptune’s Pride

15 February, 2010 (15:56) | Gaming | By: Brian

This week I discovered a great browser-based 4x game called “Neptune’s Pride.” Take Master of Orion with real-time fleet movement, slim down the tech tree and add a dash of Diplomacy and you have this game. It’s free, it’s elegant and it’s fun, all things I look for in a game. To help me with planning, I whipped up two quick and dirty battle calculators in PHP which can be found here. Nothing too fancy, but they should get the job done.

On a related note, I started up an account on the Andromeda server of OGame. OGame is essentially Ikarium with a space theme. Which I am also a sucker for. Both are good coffee break amusements for the time being.

I also bought Assassin’s Creed II for Lynn for Valentine’s Day, and we should enjoy playing that together, too!

F-35 Test Aircraft retired to live-fire testing

4 January, 2010 (10:00) | Uncategorized | By: Brian

I hope that this doesn’t mean it will be blown to smithereens. It would be incredible to see this in a museum. PAX River’s Naval Air Museum has a couple of design and test aircraft for this program and they’re awesome. I hear PAX River just got a second real F-35 to work with, too.

Awesome thing of the Day

21 December, 2009 (15:15) | Life In General | By: Brian

Penny Arcade has started their now annual Christmas series of comics, which are almost always amazing. This year they appear to be mixing How the Grinch Stole Christmas with the Elder Gods of H. P. Lovecraft and Mind Flayers from D&D. Awesome.

Kittens!

13 December, 2009 (21:05) | Lynn, Preston | By: Brian

Friday night Lynn and I received our new kitten from a great rescuer in NJ. Robin, the same woman that we got Preston from, works with a group called Maddie & Friends to rescue cats from bad areas of NJ and then get them adopted through Pet Finder and other means. We wanted to get Preston a playmate for when we’re gone and naturally we went back to her for help. She had a litter of orange-striped kittens, boys and girls, and we picked a young lady out. Her name is currently Charlotte, but it may still be up to debate. She’s very much a lap kitten, but doesn’t like to be held or carried. Loves to cuddle up in a warm lap, and as you can see below, loves video games, too. Her and Preston are still adjusting to each other. He wants to play a lot more roughly than she does, so she tends to roll on her back and claw at him when he gets too physical. But sometimes they will be cute and nice to each other, too. Hopefully it doesn’t take too much longer for them to adjust to each other’s tolerance for “fun.” And now, the part you’ve been waiting for:

Amazing looking 11th-hour game of the year candidate

10 December, 2009 (12:28) | Gaming | By: Brian

As my addiction to the Puzzle Quest games and Gyromancer will no doubt attest, I’m a fan of the puzzle/RPG hybrid genre that has sprung up recently on handhelds and the PC. I suppose Bookworm Adventures might also count. This week Capybara Games (totally awesome name!) released an impressive-looking entry into the field which takes the puzzle/RPG combo and adds some elements of turn-based tactics RPGs and Magical Drop move mechanics. It’s called “Might and Magic: Clash of Heroes”. Having read some of the early reviews and hands-on coverage, this quirky title has jumped straight to the top of my Xmas list. (Yes, I already own too many games to play and too many books to read, sue me.) Check out some video:

And the official sites.

2009 has already been an amazing year for video gaming with incredible sequels such as Left 4 Dead 2, Assassin’s Creed 2, plus brilliant new IPs such as Plants vs. Zombies and Torchlight. This strange little portable strategy title may blow them all away.