FAO Recruitment agency workers

Hello and good day to any recruitment agency workers who have made their way to my site from the link on my C.V.

Since November 2013 I have been in employment. However, some of the C.V. sites out there may still have me listed as unemployed and still looking for work. Sorry to disappoint you folks but since I’m already employed, I won’t be applying for any jobs you have available.

However at the very least, thank you for considering me as a possible candidate and I do hope you find someone to fill the role as soon as possible.

-Carl Mitchell

Welcome

Welcome.

This site serves as the portfolio of Carl Mitchell.

Here is a contents list specifying the name of the projects and the languages/technologies used for your convenience:

Do note that this is a newly created and continually updated site, so not all of my projects may have been written about just yet. For example,  some C# projects are in the process of being finished and will appear on this site soon. I’ve also recently started using the Unity game engine and hope to have some projects appear in this portfolio in the nearby future.

If you have obtained my C.V and wish to know more about any of the projects, feel free to contact me via the details specified on my C.V.

Final Fantasy XIV Mini-Cactpot Helper (C++)

Yesterday (24th Feb 2015), the online MMORPG Final Fantasy XIV launched a patch that included, among many other things, the Mini-Cactpot lottery, a sort of scratchcard lottery that isn’t entirely dependent on luck. Here is a short summary of the rules, pasted from the patch notes:

Every ticket has nine spaces, each numbered randomly from one to nine. At the start, however, eight of these nine spaces will be hidden. To begin, select three numbers from the eight hidden on your ticket. Next, select one of eight lines─vertical, horizontal, or diagonal. When selecting a line, the sum of the three numbers in that line will determine the amount of MGP you receive.

Common sums receive smaller amounts of “MGP” (the currency) whereas the rarest sum (6, which can you can only get with a line of 1, 2, 3) gets the grand prize of 10000. As you can see in the rules, 4 of the 9 values will be un-hidden meaning you can calculate all combinations of what each line (column, row, diagonal) can produce and find which line gives the better odds of landing on a sum with a higher payout. It all just depends on where the 4 initial un-hidden numbers were and what numbers they were. After that it’s just a very large amount of sums, finding the payouts for each of these sums and calculating the average payout for each line. Simple to do on paper but very time consuming and tedious.

So I wrote a program that does it all for me.

It asks the user to input the un-hidden numbers and place them into the correct positions and then:

  1. Finds out which numbers weren’t used in the initial un-hiding stage. These are the numbers used to generate all possible combinations with the un-hidden numbers
  2. For each of the 8 lines (3 columns, 3 rows, 2 diagonals), find out how many hidden numbers (denoted by a value of 0) remain.
    1. If there are 0 hidden numbers, there is only 1 combination and the sum & payout are easy to calculate
    2. If there is 1 hidden number, sum the 2 un-hidden ones in that line and find all 5 combinations between the two known numbers and each of the 5 unknown numbers
    3. If there are 2 or 3 hidden numbers, we do practically the same thing but the generation of all possible sums (and their payouts) is a little more complex. 2 hidden values requires a loop within a loop and 3 hidden values requires a loop within a loop within a loop but is still overall not too complex.
  3. Prints out all the sums and payouts for each line along with the average (mean) payout

Note that you can’t guarantee a great win at all, random is still random, luck is still luck but this helps steer you towards the lines which are more likely to give a higher payout.

A picture of it in action. The zeroes correspond to the unknown hidden values and the 4 non-zero values are the 1 value the game gives me and the results of the 3 choices I get to unveil more values.

Click on the image to make it larger and more legible.

Click on the image to make it larger and more legible.

As we can see from the output, there are two lines (row 2 and the diagonal going from top-right to bottom-left) that are much more likely to give me better prizes than the other lines. Row 2 technically has the highest expected payout but it also has a lot of very small payouts (36 is the worst and there are multiple 36 payouts) whereas the diagonal line has a smaller average but at worst will give 72, twice the smallest in row 2. So seeing both the average payout and also all of the possible payouts allows you to reason more easily which line you want to choose to maximise your odds of getting a good payout.

In the future I intend to produce a visual version of the program using C# and WPF but at the moment my time is taken up by work and my studies on Haskell and the Unreal Engine 4. A post about Haskell and some stuff I’ve written with it will hopefully appear soon.

As with all my other projects, if you wish to see the source code then please email me at the address specified on my C.V if and only if I have applied to your company and I would be more than happy to show you.

Procedural World Map Generation (JavaScript, HTML5)

Next in line for JavaScript is an application that can create and draw world maps consisting of several continents.

It is essentially a variant of the fractal Midpoint displacement algorithm and works as so:

For each island:

  • Pick a number of initial points, low numbers like 2 or 3 will form a line shaped or triangle shaped continent and higher numbers will form a circle.
  • Pick a radius, essentially the size of the island
  • Pick an offset, during the tessellation stage, when randomness is added, how much randomness should be used to offset the newly created point?
  • Pick a scale factor, for each level of tessellation the offset needs to be decreased in size and this scale will determine by what % it will decrease (0.5 = 50% for example).
  • With these 4 pieces of data:
    • Generate the initial points using the radius and number of initial points required. For now, the island is simply placed at (0, 0) and generates the points on a circle connect by lines
    • For N levels of tessellation (9 seems to be the most before any more detail added is smaller than 1 pixel):
      • Find the middle of each pair of points
      • Add a random offset to the x and y values, determined by the value set as the “offset” before
      • Add the newly generated point to the list of points
      • Once all points have been subdivided and offset, reduce the offset value by the scale factor

And doing so for M number of islands which each have a position vector that can be used to move them around.

The application also comes with the following features:

  • Regenerate any selected island with new random data without changing the others
  • Reposition any selected island with new x and y coordinates
  • Change any of the following, that will be used the next time an island is regenerated (essentially every variable is changeable):
    • Number of initial points used
    • Radius
    • Offset
    • Scale factor
  • Add new islands to the existing world map, which will also automatically select it as the “currently selected island” when applying changes.
  • Remove selected islands from the existing world map
  • Place all the islands in random positions, large islands may merge into larger islands allowing you to create complex looking continents
  • Choose the draw the islands “number” so when selecting an island with the GUI, you know which one you are modifying
  • Click to select the island you want to change, a circle will be drawn around the current chosen island. Deselect by clicking on the ocean or clicking the Deselect option from the GUI (if you place too many islands and there’s no ocean to click!). Selecting an island will also automatically update the GUI values such as x position, y position and selected island.

The GUI is from the datGUI library.

See this video: I recommend watching in full screen and at a HD resolution if you can in order to see the finer details of the fractal and to also be able to see the GUI properly.

Overall I’m quite pleased with the application but there is one thing I wish I could do with it. At the moment it only shows a blue ocean and green islands, there’s nothing on the islands such as elevation data, river data, etc. Unfortunately since I’m only storing the points of the islands coast and not the points in between, then I would have to go about this application in a very different way if I wanted something on the actual islands. They would have to be split into (and drawn separately as) polygons rather than being outlined and filled in in-place like it is now. Maybe some other day?

As with my other work, if you want to see the source then please contact me via the details on my CV I’ve sent you.

Collision Detection and Resolution Part 2: 3D (JavaScript, HTML5, ThreeJS)

As well as learning JavaScript, I’m also learning how to use the various JavaScript libraries out there. One of the more exciting libraries is the ThreeJS library that allows you to create WebGL applications in JavaScript and use the GPU for rendering to the HTML5 canvas (rather than CPU rendering, also known as Software renderering, which is remarkably slower).

So I decided to create a 3D version of this which in turn is a JavaScript port of this.

Unfortunately, due to Google* Drive’s new “update” under the guise of “making it easier for our users” (read: removing commonly used features in order to save money), I can no longer use it to host my javascript work so I’ll have to use the same method as before: either a video of it in action uploaded onto youtube or a series of pictures. Here’s the video:

If you can, watch it full screen in HD. Also, youtube only shows videos at 30fps as of Aug 2014 which is a shame :( so the video won’t look as smooth as it actually runs.

As with all my work, if you want the original source, please contact me via the details on my CV and also state your name as I will only send to companies I have applied to.

It has the same problems as the 2D version in that I just place the cubes randomly so they might be intersecting from the word go, so give them a few frames to resolve any interpenetration.

Collision Detection & Resolution PORT (JavaScript, HTML5)

(Finally, I get some time to program some of my own stuff — my first bit of spare time in months)

If you asked me a year ago if I liked JavaScript, I would’ve said no but the thing is, I had never really learnt it. There was a single module in my bachelor’s degree (a second year module called Web Server Programming, I think) that had us writing a small amount of JavaScript. But that’s all the JavaScript I knew.

Similarly, if you ask others if they like JS, a seemingly large amount of people will say no too.

For me at least, I was wrong about JS.

I had noticed a large number of companies asking for it so I decided to learn it and to be honest, I actually kind of like it. There are plenty of pitfalls to be sure just as any language but there’s also a lot of really nice features that I like. Closure is absurdly useful and the fact that almost everything, even functions, are first class objects is very cool. I think when people say they dislike JS they mostly mean they dislike the DOM.

So after learning a bit of JS, I decided to port one of my previous projects, specifically the collision detection and resolution from here.

It turns out you need a paid account to host html/js/css/etc. on wordpress so it’s hosted on my google drive account. Hopefully this link actually works:

Click here to view the demo in your browser

There are some things to note however:

  • The physics detection is definitely working but the physics resolution seems to be slightly buggy under certain conditions. Sometimes the boxes turn red (collision detected) but don’t seem to move apart from each other (collision not resolved). I think it’s because the boxes all have 0 acceleration (any velocity change is done as an immediate impulse) and 0 relative acceleration is causing some small amount of imprecision.
  • When the program runs, it just places the boxes in random positions so it’s likely that some boxes will be overlapping from the very beginning, give it a few frames to correct itself!
  • Finally, the source code is minified, you can still technically read it but it’s difficult to do so. If you want the non-minified version that has comments and whitespace, please contact me either by email or phone as listed on my C.V. and please state who you are representing as I will only give out code to those who I have applied to

I want to do more stuff in JavaScript and I think the new JS program I do will be something interactive and something to do with fractals! Perhaps a world map generator? Eventually.

SQL Database for a make believe game (SQL Server, T-SQL)

This project involved making a database that a potential video game could use (or may use in the future).

Below is a short summary of the T-SQL features that were used:

  • Transactions for in-game purchases which also used error handling
  • After-Triggers to add purchases to an audit file
  • Views to hide sensitive data (such as player addresses) but show other data such as high scores
  • InsteadOf-Triggers to stop inserts/updates/deletions using the above view
  • Tables in 3rd Normalised form as industry standard
  • Relationships and constraints between each table such as primary keys, foreign keys, unique constraints, default constraints, check constraints etc. to make sure there is correct data integrity
  • Stored procedures to automate the process of purchasing items and update player profiles (incrementing their score, etc.)
  • User defined functions, both scalar and table, for processing player data and calculating derived data such as score per day
  • Old style defaults and rules – I would prefer to use the newer check constraints and default constraints however I’ve heard some companies refuse to update their SQL server version and hence there are some out there having to use these older ways so it was best to learn them as well.
  • Indexes – to speed up searches. An example: there is a unique clustered index on each table (since there are primary keys on each table) and a non-unique non-clustered index on the player table for the players score, which appears often in searches.
  • Subqueries to help with some searches
  • Joins – inner and outer, used whenever I needed data from more than one table.

If there’s anything missing on the list and it’s easier to use than at least one of the items on the list, then you can safely assume it has been used at some point. For example, I wouldn’t mention the use of aggregate functions since they are common but rest assured they have been used multiple times.

Media:

Media will be added soon

Code is available by request to the companies I have applied for. Please contact me by email, land-line phone or mobile phone using the details on the C.V. I sent you.

Fractional (or Fractal) Brownian Motion Generator

A small, mostly background working, application that generates Fractional Brownian Motion signal data. Uses Perlin noise as a basis function since it’s nice and quick. Parameters can be set to change the generated data:

  • Octaves – the number of times the Perlin noise is applied to each point
  • Lacunarity – Essentially what you multiply the signal frequency by and what you divide the signal amplitude by for each octave
  • Spread – How close the noise values are. Larger spread produces a smoother but flatter surface. However, a higher scale can reduce flatness.
  • Scale – uniform multiplication of the resultant values to increase/reduce flatness.
  • Byte array – if ticked, will return integer values between 0 and 255. If not, float values between 0 and 1 multiplied by the scale will be used.
  • Filename – the name of the output file.
  • Size – The square size of the signal data. A size of, say, 128 will generate a 128*128 signal data. The size has to be square but many fractal noise generators only work (or work best with) squares anyhow and other things that you might use alongside this data, such as textures, also work best when square.

The output is simply a text (.txt) file that is easily to read in for any language and contains the size used and the signal data itself.

A common use for this is for height maps and terrain generation.

It uses the CPU to generate the signal values but as my Masters Dissertation showed, using the GPU is far faster by many magnitudes.

Media:

The main menu

The main menu

The output results. In the example of terrain generation, these values are the y-value in each terrain vertex position, un-scaled.

The output results. In the example of terrain generation, these values are the y-value in each terrain vertex position, un-scaled.

Code is available by request to the companies I have applied for. Please contact me by email, land-line phone or mobile phone using the details on the C.V. I sent you.