Christmas Bash Wordsearch Bonus


This could be you…
I’ve got a second Nerf Gun for the person that the highest number of the 54 “Departmental Christmas” words in the Wordsearch below:
D G S Z T G R Y S U I R O T S I P E I L A C R F X W C E X Z
M G U F T T E S P M O T N A I R B C L K V E G Y O S H V T Z
B I P T U Y D B P X G R A X S I M N M O D L I E B M R H D H
W D E C K N O S N I B O R R E T E P M N E A R R X I I O J W
D A R S L L E B K R A M J K U I L S A O N E X G H K S O I B
S O L A Z N E N F I U I N K T S D X N N T O A D X E T V A J
E Q A B V E I K C M N E R R A D E A I U A L J I Y B M Y P M
L Z B M A R T I N W A L K E R L R S P B G N W V A I A Q W I
I D A V I D G L O V E R V V A D P M U A E X I A S E S I A C
M W O R D S E A R C H M P E O A O E N I K L N D E L A K R R
B T M U U R W S E M I A N B P C Y D L R S S D C K B M R R O
O T I I A Y I Q W J J A O A X W R G B H I V O F O Y A V E S
R H K L Q D Q H V S J T D C A O O T F W D C W F O D N J N O
K J E O R Z C D M A T O I K I R U R G H D X S A R K D O V F
C O B A B J Y W M A P W R D D V Y Q U X R G T T B B A H I T
O G R T I S W M C O D A X O T F U J I Z A T E Z M U M N A N
C N A N N O E I U C H A N D R A K A M B H A M P A T I R N O
N A Y A G N B L G S T H G I R W N E L E H Y Y R H R L A T S
A I S H W Y O F L L D A R R Y L D A V I S Q J P A E L Y N I
H J H D A S P E R Y Y E D Y X U D B N F I K N L R R S N Z P
W G A C N A N L E N L Q A C S H P F I N J S W R G H O E E P
E N W U G E E E P N S G V Z V Z O B G U C A E F B O N R C A
R I S B L K H C P M T M I H D J P D G G Z T M G R Y F W E L
D P H E X Z M N O O A G D F C L E K V G S V T E G Z B I T C
N U H U Y D O B H R R P P X G L Y E R G N O M I S O R A X O
A S I M L Z N M N R B O A H I D H W D R O C K E T W O C K J
M O J W A L D A A E U S R J K U I L S X H O I B O A A G Z N
E N F M I U I N O L C K K Y T I S R E V I N U L L U H R L T
S D A O A X V A J L K J E Q J A N S P R I N G E R B V A D E
L J Y Y P Z B G A Q S V R S P A C E C H E E S E B A T T L E
Send me a picture of your solution and you can puck up the prize from my office if you are the the best one. Pictures must be sent in before the end of today (Thursday).
Simon Grey is not allowed to take part.

.and we have two winners. Josh Naylor and Josh Moon have both won after sterling efforts (even finding some great words that I didn't put in...)
They can come and get their winnings from me this morning (Friday).

Christmas Bash 2012

We had a great Christmas Bash today. A nice select turnout and plenty of fun was had.
We had a whole bunch of expensive hardware and a Wordsearch. Guess what everyone spent their time doing.
… and guess who won.
A lot of fun was had with Simon’s newly acquired toy…

What a room full of Computer Scientists do if you shout “Strike a Pose”
..and we even had Rocksmith as well. You can find all the pictures I took here.

Delegates and Dice

I’ve been marking the First Year “Space Cheese Battle” implementations and it has been great fun. The aim of the work is to implement the board game “Space Cheese Battle”, which is a bit like Snakes and Ladders crossed with Ludo. Using rockets. And cheese.
The program uses a dice to control movement and in the final implementation this must of course be completely random. However when the program is being tested a random dice is exactly what you don’t want. What you want is a way of getting particular numbers so that you can test the program more easily. I first hit this kind of problem when I wrote a pontoon (blackjack) playing program and I had to wait for ages for the game to deliver a King followed by an Ace, so I could test the part of the program that deals with that. Eventually I figured out that a good way to speed things up was to allow me to type in the card being dealt, rather than have it picked randomly. Later on I worked out that it is even easier to test if you have a “pre-set” list of cards that are dealt automatically.
We can do the same thing with the dice for Space Cheese Battle. I can make three dice methods:
static Random rand = new Random(); static int RandomThrow() { return rand.Next(1, 7); }
This is the “production” dice throw method. It just delivers a value between 1 and 6.
static int InputThrow() { int result = 0; while (true) { Console.Write("Enter throw value: "); try { result = int.Parse(Console.ReadLine()); break; } catch { } } return result; }
This is the “manual entry” dice method. It returns whatever the user types in. Note that I’ve not limited the values at all. It is sometimes useful to put in very large dice throws so that you can move the player onto particular squares for testing.
static int[] diceValues = new int[] { 3,4,5,4 }; static int throwPos = 0; static int FixedThrow() { int result = diceValues[throwPos]; throwPos = throwPos + 1; if (throwPos == diceValues.Length) throwPos = 0; return result; }
This is the “fixed sequence” dice. I can create a whole set of values and then have them replayed by the dice. This is great for automated testing.
Of course the difficultly comes when I have to write my program and I need to switch between these dice behaviours. The students had hit this problem too, and some had created tests that checked the dice mode and then called the appropriate method when the program ran. These work, but the best way to select the kind of dice that you want to use is to create a delegate which refers to a particular method.
delegate int DiceThrow();
A delegate is a type of variable that can refer to a method with a particular signature. The statement above creates a delegate type called DiceThrow which can refer to a method that accepts no parameters and returns an integer, just like the dice methods above. I can create a variable of type DiceThrow.
static DiceThrow ActiveDice;
The variable ActiveDice can refer to any method that accepts no parameters and returns an integer. I use it like this:
ActiveDice = new DiceThrow(RandomThrow);
The variable ActiveDice now refers to a new delegate instance connected to the RandomThrow method. Which means that the statement:
Console.WriteLine(ActiveDice());
- will call the RandomThrow method and print out what it returns. In other words I can use the ActiveDice method exactly as if it was a method that accepts no parameters and returns an integer. When the delegate is called it will follow the reference to the method it has been connected to and then run that method. The great thing about my game code is that I don’t need to change the code that uses the dice to make it pick up new dice behaviours. I just have to call the delegate.
Note: The C# implementation also incudes a Delegate class (note the capital D) which intellisense might try to get you to use. This does something different and confusing. Make sure you use the delegate with the lower case d.
Christmas Bash 2012 is Coming

We will be having our Christmas Bash on Wednesday 12th of December in the department. There will be hastily set up video games, food ordered at the last minute, and staff arriving just in time to be beaten at Team Fortress and whatever other gaming goodies that we can find, including a Wii U or two if we can get them to work. There will also be a last minute wordsearch with a prize that we will only just have had time to buy. In fact, this event is so "thrown together" that we've had to use the artwork from a couple of years ago.
But it will be fun for all that. Tickets are available from the departmental office. The fun starts at 4:30 pm in the Design Lab. And yes, we will be setting up the famous “Pink Christmas trees” once we’ve found them in the office stores.
