RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.irobot.data; 00002 00003 import java.util.Random; 00004 00005 public class IRobotSongs { 00006 static private final Random random = new Random(0); 00007 00008 static public final int[] ViveLeVent = new int[] { 00009 66, 20, 66, 20, 66, 34, 00010 66, 20, 66, 20, 66, 34, 00011 66, 20, 69, 20, 62, 22, 64, 14, 00012 66, 70 }; 00013 static public final int[] CloseEncounter = new int[] { 00014 74, 40, 76, 40, 72, 40, 60, 40, 67, 50 }; 00015 static public final int[] Beethov5 = new int[] { 00016 55, 16, 55, 16, 55, 16, 51, 48, 128, 16, 53, 16, 53, 16, 53, 16, 50, 48 00017 }; 00018 static public final int[] Beethov9 = new int[] { 00019 83, 16, 83, 16, 84, 16, 86, 16, 86, 16, 00020 84, 16, 83, 16, 81, 16, 79, 16, 79, 16, 00021 81, 16, 83, 16, 83, 32, 81, 8, 81, 16 00022 }; 00023 static public final int[] DarthVador = new int[] { 00024 43, 48, 43, 48, 43, 48, 00025 39, 32, 46, 16, 43, 48, 00026 39, 32, 46, 16, 43, 32, 00027 }; 00028 static public final int[] Piaf = new int[] { 00029 74, 100, 76, 16, 74, 16, 74, 80, 128, 8, 74, 100, 78, 16, 76, 16, 74, 16, 72, 16, 71, 16, 71, 32 00030 }; 00031 static public final int[] StarTrek = new int[] { 00032 62, 32, 67, 16, 72, 48, 00033 128, 2, 71, 22, 67, 22, 64, 22, 00034 69, 22, 74, 64 00035 }; 00036 static public final int[][] Repertoire = { 00037 ViveLeVent, CloseEncounter, Beethov5, Beethov9, DarthVador, StarTrek, Piaf 00038 }; 00039 00040 public static int[] composeHappySong() { 00041 int songLength = random.nextInt(5) + 7; 00042 int[] song = new int[songLength * 2]; 00043 for (int i = 0; i < songLength; i++) { 00044 int noteIndex = i * 2; 00045 song[noteIndex] = random.nextInt(10) + 96; 00046 song[noteIndex + 1] = 2 + random.nextInt(8); 00047 } 00048 return song; 00049 } 00050 00051 public static int[] composeSadSong() { 00052 int songLength = random.nextInt(2) + 3; 00053 int[] song = new int[songLength * 2]; 00054 for (int i = 0; i < songLength - 1; i++) { 00055 int noteIndex = i * 2; 00056 song[noteIndex] = random.nextInt(5) + 31; 00057 song[noteIndex + 1] = 20 + random.nextInt(20); 00058 } 00059 song[song.length - 2] = 31; 00060 song[song.length - 1] = 20; 00061 return song; 00062 } 00063 }