math.randomseed(get_world_state().frame_tick)
Uke = {}

Uke.sequences = {
}

function initUke()
  Uke.cursor = 1
  Uke.randIndex = math.random(1, #Uke.sequences)
  for i=0, 19 do
    set_joint_state(1, i, 4)
  end
end

function randomMove()
  for k, v in pairs(Uke.sequences[Uke.randIndex][Uke.cursor]) do
    set_joint_state(1, v[1], v[2])
  end
  Uke.cursor = Uke.cursor + 1
end


add_hook("new_game", "initUke", initUke)
add_hook("exit_freeze", "moveUke", randomMove)