August 2018
Beginner
334 pages
10h 19m
English
This is a recipe that makes use of general types. It is recommended that you have at least a basic understanding of how they work, because it's important that we use them well.
The first thing to do is implement a data type for holding the actions and their probabilities, which is called KeyDataRecord.
The KeyDataRecord.cs file should look like this:
using System.Collections;
using System.Collections.Generic;
public class KeyDataRecord<T>
{
public Dictionary<T, int> counts;
public int total;
public KeyDataRecord()
{
counts = new Dictionary<T, int>();
}
}
Read now
Unlock full access