public int Update(double[
currentState)
{
Tensor<double> input = new DenseTensor<double>(new[
{3);
input[0
= currentState[0
;
input[1
= currentState[1
;
input[2
= currentState[2
;
// Setup inputs and outputs
var inputs = new List<NamedOnnxValue>()
{
// the model has only one input the state tuple
NamedOnnxValue.CreateFromTensor<double>(\"0\" input)
;
using (var results = session.Run(inputs))
{
Tensor<double> outputs = results.First().AsTensor<double>();
var maxValue = https://mparticle.uc.cn/api/outputs.Max();
var maxIndex = outputs.ToList().IndexOf(maxValue);
return maxIndex;
使用 Harmony 进行输入SMAPI 缺少的API是能够在游戏中提供输入 , 因为 99.999% 的mod不需要这样的东西 。为了进行输入我找到了一个名为 Harmony 的 C# 库在可以在运行时更改游戏的内部函数 , 这样我就可以让游戏以为它收到了鼠标输入 。这就是上面让mode自己玩游戏的方法 。非常感谢 Drynwynn , Mod FishingAutomaton 的作者 , 我使用了很多代码来设置我的 mod 。
[HarmonyPatch(typeof(Game1) \"isOneOfTheseKeysDown\")
class IsButtonDownHack
{
// ...
// some important stuff
// ...
// change function return value to true
// makes the game think a mouse left button click ocurred
__result = true;
return;
最终结果目前 , 该模型可以捕获所有“简单”和“中级”的鱼 。还不能训练它捕捉传说中的鱼 。
这个gif是未训练完成的演示
下面是我们训练的结果 , 效果还不错
资源和引用非常感谢 Stardew Valley 的mod社区帮助并让我更好地理解游戏:)
C# mod 和 Python 训练的所有代码都可以在这里找到!
github/ThiagoLira/AutoFisher-SV
https://www.overfit.cn/post/8f82fe918b644ce58a8e525243db87a4
作者:Thiago Lira
- 观众|双鸭山市首次通过云上直播迎新春音乐会
- 招聘|这一“国企”招聘不限学历,面试通过就可以上岗,专科生机会更大
- |80后手艺人用2022根树枝做冬奥会雕塑:通过自己的手艺为冬奥会加油
- 冰墩墩$80后手艺人用2022根树枝做冬奥会雕塑:通过自己的手艺为冬奥会加油
- |长城币2角硬币,流通过的收藏价值300元左右,你能找到吗?
- 论述|陕西“非物质文化遗产”全国征文大赛第四十九赛区第(1)批征稿初审通过名单
- 翡翠|翡翠原石如何通过皮壳判断赌石种老和种嫩
- 童子$太上老君与菩提祖师的差距,已经通过徒弟之间的对比显现了出来
- 招商证券|如何提升面试通过率?教你一招,面试前把这些功课做好
- 高宗&清代用儒家道统强化统治合法性,以祀孔尊儒来贯穿知识分子的思想
