Simo Råman
Building Roguelike in F#
I know many people who started programming because they wanted to write a game of their own. I myself had never done game programming but after I ran into articles about programming a roguelike in Haskell I decided to give it a try using F#.
First I wanted to get hero to move around on map.
These are the types I . . .
Generating music in F# part 3: Note values
Previous posts in series:
Part 1
Part 2
After last post the program can generate melodies using Markov chains generated from seed data. Next important aspect of a catchy melody is note value. Note value means a relative duration of a note.
Just like notes note values are modelled as a type:
type value =
| . . .
Posted in: f#
Generating music with F# part 2: Markov chains
Continuing from the previous post.
To make melody generation more interesting I decided to try applying statistical process called Markov chain. In the context of this post by Markov chain I mean that the next state of the system is not completely random but next states have different probabilities that depend on the current state.
. . .Posted in: f#
Generating music with F#
For a long time I have been fascinated with the idea of generating music programmatically. I decided to give it a go using F# and this is what I came up with. I wrote a program that generates a short melody in the key of C major. Not exactly Mozart, but it's a start.
I created a type for notes and a Map of notes to their . . .
Posted in: f#
Test Driving F#: String Calculator Kata
I finally took the time to code some F# again. This time I tried out Roy Osherove's String Calculator kata.
This was the first time I did development on a Mac using Mono. The experience was surprisingly pain-free. The biggest problem I had was MonoDevelop hanging when debugging. I was afraid that I would have to setup external . . .
Posted in: f#
Test driving F#: Bowling game
(published originally February 1, 2013 at simoraman.wordpress.com)
Some time ago I blogged about my first experience with F#. I took a course Functional Programming Principles in Scalarecently and it somewhat opened my eyes on problem solving in functional style. After that I felt confident enough to do something more complex than fizzbuzz with F# so the logical next step was Bowling game kata.
. . .
Posted in: f#
Test driving F#: FizzBuzz
(published originally September 19, 2012 at simoraman.wordpress.com)
I have been interested in F# for a long time, but haven't taken the time to actually do anything with it. Finally I decided to try and use it to implement the good old FizzBuzz. I used fsUnit as a unit test framework.
Here are the tests I ended up with:
[<TestFixture>]
type ``When to Fizz`` ()=
[< . . .
Posted in: f#