Showing posts with label computing. Show all posts
Showing posts with label computing. Show all posts

Thursday, 25 March 2010

This takes me back

Man, I nostalgia-d (I have no idea what the past tense of nostalgia is, come on people work with me here) hard when I saw this, I haven't written anything in qBasic in years:



I'm gonna have to dig out some of my old code again (and find a copy of qBasic again), only thing is I can't remember if I commented anything.

Sunday, 10 January 2010

A new hobby

Why is that going on holiday has made me more productive? Maybe I am actually solar-powered.  Anyway, I've managed to get interested in the fields of cryptography and cryptanalysis.  Obviously, I can't make much progress in learning about this field, but I've already got several books on order from Amazon, for when I return.

I have, however, managed to make some progress, having written a program to break any shift cipher like ROT13, or the Caesar cipher.  Such ciphers work by moving the encoding alphabet along and wrapping round the missing characters; so the ROT13 cipher looks like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

 So the message "Hello, World!" becomes: "Uryyb, Jbeyq!".  Decryption is done by performing the reverse. The small number of possible shift cipher's means that the decrypting can be done by brute force alone, and this is exactly what the program I'm writing does.  The difference is that after that the program uses a dictionary of words to find the decryption attempt with the most words which are actually valid.  This means that the system will be able to operate automatically.  I'll put the code up when the program is completed.

Saturday, 9 January 2010

Not so "diff"-icult after all

I've gone back and updated the way that the filename formatter would work on the command line, and it turns out that on the command line, it's a lot simpler than I'd previously thought.  So here's the ammended version:

perl -e 'print join("\\ ", @ARGV)' [FILE NAME]
I also feel no shame in using yet another "diff" based pun in the title.


Friday, 25 September 2009

Doing some AI stuff in Perl

So, I've written a semi-automated Word Search Solver in perl over the last couple of days, I haven't uploaded the code to here, because I haven't found an adequate way of formatting the code yet (I sense another project coming up), but the post link should send you to the page on perlmonks where I uploaded to the post too, all of the details are there, but for completeness sake and to tantalize you into going there, I'm going to post the details here:

Description:
The code below is for a semi-automatic word search solver, that uses a recursive function to search a multi-dimension array containing the puzzle for the word that the user asks for.

The program is semi-autonomous, in that the search itself is carried out automatically, but the puzzle is (for the moment) hard-coded, and the user must enter each word that they want to search for one-by-one.

Interface:The interface is a simplistic text-based one, the user enters the word that they want to search for, and the program responds with a set of coordinates for the start and end positions of the word being searched for, or 'NO RESULT' if the word can't be found.
The only command available to the user apart from the search ability is the '#quit' command which exits the program.

Considerations: The program relies on the assumption that the dimensions of the grid to be searched are equivalent, i.e. rows == cols

Planned Improvements:
  1. The option for the user to enter in the puzzle data 'on the fly'
  2. Removal of the final global variable '@end'
  3. The ability for the user to define a list of values to search for
If that doesn't peak your interest then this probably isn't the sort of thing for you, but if you're interested in AI search techniques, solving word searches, variable references, or how to do any of the previous in perl, check it out.