RSS

Using Alloy Analyzer to solve the first Google Davinci Code Quest puzzle!

As I was searching for something on google, I saw an ad at the bottom of the page. The ad was about the Davinci code new movie that is coming out. I clicked and found a sudoku like puzzle, related to the movie. The puzzle is explained in the following two pictures (description can also be found on: http://student-rant.blogspot.com/2006/04/googles-da-vinci-code-quest-1.html)

Well… it is clearly a very simple problem for a constraint solver, like Alloy Analyzer! I created the following model (took me half an hour, so no comments or too much thought about it).

module testopen util/ordering[Natural] as ord

abstract sig Natural{}

one sig One extends Natural{}
one sig Two extends Natural{}
one sig Three extends Natural{}
one sig Four extends Natural{}

abstract sig Symbol{}

one sig Cross extends Symbol{}{}
one sig Fi extends Symbol{}{}
one sig Blade extends Symbol{}{}
one sig Star extends Symbol{}{}

sig Cell{
symbol: one Symbol,
rowIndex: Natural,
columnIndex: Natural,
inRange: Natural
}

fact Numbers{
ord/first() = One
ord/next(One) = Two
ord/next(Two) = Three
ord/last() = Four

}

pred defineRange(row:Natural,column:Natural,r:Natural){
all c:Cell |
c.rowIndex = row && c.columnIndex = column => c.inRange = r
}

fact DefineRange{
defineRange(One,One,Two)
defineRange(One,Two,One)
defineRange(One,Three,One)
defineRange(One,Four,One)
defineRange(Two,One,Two)
defineRange(Two,Two,Two)
defineRange(Two,Three,Three)
defineRange(Two,Four,One)
defineRange(Three,One,Four)
defineRange(Three,Two,Two)
defineRange(Three,Three,Three)
defineRange(Three,Four,Three)
defineRange(Four,One,Four)
defineRange(Four,Two,Four)
defineRange(Four,Three,Four)
defineRange(Four,Four,Three)
}

pred staticSymbols(row:Natural, column:Natural, s:Symbol){
all c:Cell |
c.rowIndex = row && c.columnIndex = column =>
c.symbol = s
}

fact{
staticSymbols(One,Four,Fi) &&
staticSymbols(Two,Two,Cross) &&
staticSymbols(Four,Two,Blade) &&
staticSymbols(Four,Three,Star)
}

// No two same symbols in the same Range
fact{
all disj c,c’:Cell |
c.inRange = c’.inRange =>
c.symbol != c’.symbol
}

// All cells have different rowIndex and columnIndex
fact{
no disj c,c’:Cell | (c.rowIndex = c’.rowIndex && c.columnIndex = c’.columnIndex)
}

//No two same symbols in the same row Column
fact{
all disj c,c’:Cell |
c.rowIndex = c’.rowIndex =>
c.symbol != c’.symbol

all disj c,c’:Cell |
c.columnIndex = c’.columnIndex =>
c.symbol != c’.symbol
}

pred solution(){
#Cell = 16
}

run solution for 16 Cell

Alloy Analyzer came up with a solution in 3 seconds, on the dual core 2GB RAM opteron server running linux!

The solution is the following one:

symbol= { (Cell_0 Blade_0) (Cell_1 Blade_0) (Cell_2 Blade_0) (Cell_3 Blade_0) (Cell_4 Fi_0) (Cell_5 Fi_0) (Cell_6 Fi_0) (Cell_7 Fi_0) (Cell_8 Cross_0) (Cell_9 Cross_0) (Cell_10 Cross_0) (Cell_11 Cross_0) (Cell_12 Star_0) (Cell_13 Star_0) (Cell_14 Star_0) (Cell_15 Star_0) }

rowIndex = { (Cell_0 One_0) (Cell_1 Two_0) (Cell_2 Three_0) (Cell_3 Four_0) (Cell_4 One_0) (Cell_5 Two_0) (Cell_6 Three_0) (Cell_7 Four_0) (Cell_8 One_0) (Cell_9 Two_0) (Cell_10 Three_0) (Cell_11 Four_0) (Cell_12 One_0) (Cell_13 Two_0) (Cell_14 Three_0) (Cell_15 Four_0) }

columnIndex = { (Cell_0 One_0) (Cell_1 Four_0) (Cell_2 Three_0) (Cell_3 Two_0) (Cell_4 Four_0) (Cell_5 Three_0) (Cell_6 Two_0) (Cell_7 One_0) (Cell_8 Three_0) (Cell_9 Two_0) (Cell_10 One_0) (Cell_11 Four_0) (Cell_12 Two_0) (Cell_13 One_0) (Cell_14 Four_0) (Cell_15 Three_0) }

It is quite straightforward! The symbol of Cell_0 is Blade, its row is One and column One. The symbol of Cell_1 is Blade again, he row is Two and Column Four etc.

The symbol names are not related to the movie or book symbol names. In my model Blade is the pyramid like shape, Fi is the Greek letter fi, Cross is the symbol that looks like a cross and Star is the symbol that looks like a star. I know that I spent half an hour to solve a problem that would have taken me around 10 minutes to solve manually, but as a proper nerd I prefer to use my (few) grey cells to think how to use a computer to solve a problem for me, instead of solving the problem myself.

Well.. that’s it! I don’t want to spend more than 1 hour on this!

There are a couple of blogs with solutions to the puzzles.
Links to solutions:
http://student-rant.blogspot.com/2006/04/warning-solution-to-google-da-vinci.html
http://googlefact.blogspot.com/

UPDATE: I used the model on my P4 running @ 2.8G with 712 MB ram and took AA 23 seconds to solve the problem. Not bad at all! But for bigger problems the state space will be increased by too much. Looks like an AI technique should be used to find a solution.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

Weird files (advertismen.com and pushowXX.dll)

Last night I found on a P2P network an exe file that was supposed to be a screensaver. Well…yes I did double click! It gave me a usual “do you want to proceed with the installation?” window and I said yes! Well… that was it! It finished the installation, but I could not find any new screen saver on the control panel or anywhere else. Weird isn’t it?

Now, I downloaded a trial version of Ashampoo Uninstaller platinum to see the changes the installation made to my system. I installed Ashampoo and run the “screensaver” installer again. This time I noticed that somewhere in the text of the terms and conditions a company named “ADVERTISMEN.COM” appeared. Tried to google it but wasn’t lucky. I also did a DSN lookup of the url and found out that the domain name was registered on the 5th of April of 2006. Is it a new spyware?

Well, after the installation was finished, Ashampoo generated a log file, which showed that the install.exe had installed two files in the windows/system32 folder. The files were called pushow67.dll and pushow55.dll. I used DLL Export Viewer to find out that they exposed one interface called “Uninstall”. It also created a registry key under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ called “UninstallString” with value: rundll32.exe C:\WINNT\system32\pushow55.dll Uninstall

It also created another key under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows called AppInit_DLLs. The value was pushow55.dll.

All this is weird! I deleted the files and the registry entries, run ad-aware and spybot and they didn’t find anything. Finally I logged to my online banking system (didn’t enter my real credentials though) running Etheral. After inspecting the packets I didn’t find anything alarming.

Well… I am not sure if it is a new spyware, Trojan or something, but I know I should have thought twice before running that bloody exe file. Now I just hope I have cleaned my system from whatever it was!


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

At last a new monitor!

Well… I am so excited! It’s 9:00 am and I am typing into my blog. I got a new 19” monitor, which I am now using as an external monitor for my laptop.

My laptop’s lcd screen got completely screwed up over the last days. It’s full of blank horizontal lines. After a quick market research it seems that a new one (even a used one) would have cost me around £200, which is quite a lot for a 15” lcd screen. So… I decided to get a new external 19” monitor to use with my laptop for £175.

I got a Yusmart 198QP LCD monitor. It’s… big! It’s a wonder how both the monitor and the laptop fit on my tiny desk. I got two pictures, one of the desk and one of the monitor. The quality of the picture is acceptable and I can now have 1280×1024 resolution, which means I can see more text while I type (or program).

At last I can now work from home! (Well… the desk is still too small and the house does not inspire me to study, but I have that option when I want to program, check or type emails etc).


My desk with both the monitor and the laptop.

The new monitor!

The only problem I am having is that it has around 20 cm depth, which means that it’s too close to my eyes when I sit on the chair to type. I will see if I find a solution to that problem soon.Regarding the rest of the news these days… I will post an update!



Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

Wow!!

Things back home are getting a bit rough! They had two 6R earthquakes (one at 8:45 in the morning and another one at around noon), but I just read on naftemporiki that a possible bird flu incident has appeared at Aignousa. I suppose it’s a bit too much news for a day.

Yesterday we were supposed to play basketball for the IMS league but the medics did not even show up, so we just trained for a while! It was really fun!

I also established a rough timetable for each day of the week and try to follow it. It seemed to work well today, though I had a rather big break after 16:00. Tomorrow the whole day is assigned to demonstrating tasks. We have a meeting at 10 in the morning and then lab sessions. I am planning to go to the city centre to watch Panathinaikos against Barcelona. It should be a nice game and if we lose by less than 5 goals… I am happy!

Researchwise I have started writing rigorous transformation rules from OCL to Alloy in the ATL language. I am going to define the rules for a very small subset of OCL initially and then implement them to a tool. Right now I am just too tired to write about anything! Going home to relax.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

A very very lazy Saturday…

Well… even though I did absolutely nothing the whole week, I am still not planning to do anything today. In the morning I met again my flatmate from Jarratt (while I was staying over there two years ago). He came back from China for a while and I saw him again after almost 1 year. It is great to see people from the past.

I am also going to play basketball at 16:00 and then go home, have a shower and go to the GR with Thanos, Elias and Philipp to watch the Greece-Denmark game. That means no work today! Well.. tomorrow I have to get back to heavy research business, otherwise I will start getting stressed, which is not good!

In the morning I was woken up by Telewest. After that I tried to sleep a bit, but couldn’t really and I saw some of the most weird dreams I had ever seen! Anyway… I off to basketball… I just hope it stops raining… it’s been raining like hell for the past 2 hours and it’s gonna be difficult to go out…


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

The end of a very busy week…

This is the end of a quite busy week. The bottomline of this week is that there was no or little progress with research, as I had other issues to take care of. Had to register for the new term, give 2 lectures, demonstrate at the labs and take vivas. I honestly can not understand how time flies like that. It seems like yesterday as the previous week was coming to an end. Well.. in more details…

On Monday I started preparing for Tuesday’s lecture on the Foundations of Computer Science. On Tuesday I had the meeting for SSC1 and in the afternoon I had to demonstrate at the labs. So there goes 2 days. In the evening I also had to prepare for Wednesday’s lecture. Not so many people turned up, so I guess they didn’t like the first one on Tuesday. :) Then I went home and had to sleep. On Thursday morning I had quite a lot of sleep and then came to the uni for the labs sessions. Today, in the morning I had to stay in and wait for the technicians to come and fix the gas boiler. They didn’t for another time, claiming that their dealer didn’t have the spare parts they were supposed to get. So we rearranged the appointment for the coming Wed. morning.

I also paid the tuition fees this week. £3085! I have filled in the form to ask for the receipt, so as to send it back to IKY and get back the money. I hope I get it back soon!

I also booked the tickets for the Dio concert on Friday the 21rst. I hope it’s gonna be fun!


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

No work today…

Well.. today it’s been a weird day. I had to wake up at 7:00 am local time in order to call a foundation in Greece at 9:00 am Greek time. That means I didn’t sleep much, I have a terrible headache and I am feeling sleepy all day long! I will be heading home in a short while.

I am also going to give some lectures on Tues. and Wed. and I have to prepare for those as well over the weekend, so I am expecting a quite busy weekend.

Researchwise I will try to use the latest QVT to define the transformation rules. We will see how this goes.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

Busy days.

The past days have been quite busy. On Thursday and Friday I had been at the desk of the Hellenic Society at the freshers fair. Some pics can be found at: http://students.bugs.bham.ac.uk/hellenic/portal/boxx/knowledgebase.asp?Type=4&Cat=18

We signed up some 30+ members. We also decided to have a basketball team on the IMS. The team is called Greece’2005 after our national team won the Eurobasket 2005. That was a great event!

I am also back to research. Feel quite fresh and productive after 2 weeks of holidays. I wish I had more (I think I’ve said that before). I also had my first session as a demonstrator of SSC1 a while ago. As it was the first day, not so many people turned up, so things were quite relaxed. Having a snack break and going to watch Panathinaikos against Bremen. I am sure we won’t win (not to mention lose) but I am too bored to work and I want to see how bad the team will play.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

Back from holidays!

I am back after two weeks of holidays. It was great. Just great! Had lot’s of rest, ouzo and food. The weather was great. Sunny and warm. Didn’t go swimming, but still… it was very nice and relaxing. Some pics:

My father outside the house.


My mom preparing a very nice barbecue.

Now back to work. The new term starts on Monday and a really busy winter is waiting for me! That’’s it… can’t write more! Have to get used to the laptop and long hours in the office again.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis

Preparations…

Well… looks like the preparations for the holidays are quite demanding! I have to clean the desk at the office, clean the house, pack my staff and take care of a couple of other bureaucratic details and install the new hdd at last!

I booked the tickets for the coach today. The return trip is going to be a mess. I will be arriving at Heathrow at 21:00 and the only coach available is at 23:59. I will be arriving home at 03:00 and I will have to wake up at 08:30.

On the outbound trip, I will be leaving Athens on the 9th after all. That gives me 11 days at the island. It should be enough to be bored to death…

P.S. I still haven’t received feedback for the first item I sold on eBay.


Bookmark this post
These icons link to social bookmarking sites where readers can share and discover new web pages.

  • Y!GG
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn
  • TwitThis