每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;电报群 https://t.me/OpeningSourceOrg
今日推荐开源项目:《微信跳一跳 Python 小助手》
推荐理由:微信跳一跳想必很多朋友都玩过,但是有想过自己做一个吗?国内就有大神做了个 Python 开源版并且登上热榜,内附 GitHub 地址,动手一起玩吧
核心原理:
每次落稳之后截图,根据截图算出棋子的坐标和下一个块顶面的中点坐标,根据两个点的距离乘以一个时间系数获得长按的时间。
识别棋子:
靠棋子的颜色来识别位置,通过截图发现最下面一行大概是一条直线,就从上往下一行一行遍历,比较颜色(颜色用了一个区间来比较)找到最下面的那一行的所有点,然后求个中点,求好之后再让 Y 轴坐标减小棋子底盘的一半高度从而得到中心点的坐标。
识别棋盘:
靠底色和方块的色差来做,从分数之下的位置开始,一行一行扫描,由于圆形的块最顶上是一条线,方形的上面大概是一个点,所以就用类似识别棋子的做法多识别了几个点求中点,这时候得到了块中点的 X 轴坐标,这时候假设现在棋子在当前块的中心,根据一个通过截图获取的固定的角度来推出中点的 Y 坐标。
最后:根据两点的坐标算距离乘以系数来获取长按时间(似乎可以直接用 X 轴距离)
这个思路非常典型,就是去找所需属性的特征,而且这个游戏的设定完美地避开了这个算法的漏洞:基本上没有与平台相同的颜色(当然相同的话是会被玩家吐槽的),并且游戏的视角没有出现过旋转或者缩放。如果有的话识别上会有一定难度。
利用背景色色差来识别棋盘:
跳一跳的背景现在会逐渐变色,有的时候甚至会与下一个平台的颜色一模一样,不过截图也就一瞬间的事,对于这个算法来说并不是什么问题。作者还专门优化了当小人的图案位于下个矩形顶部上方的情况。不过识别平台大小的算法对于杂色效果并不好,笔者测试的时候大部分都是这个时候挂掉的( ̄ε(# ̄) Σ
对这个程序的探索大概到这里就结束了,这个小项目后续的更新基本上是对识别的进一步优化以及防反外挂机制。本篇延展权当大家学习中的一个小插曲,希望它能让大家在钻研之余轻松一刻。
GitHub 地址:https://github.com/wangshub/wechat_jump_game
今日推荐英文原文:《LG’s Linux-based webOS Goes Open Source, Again!》作者:
原文地址:https://itsfoss.com/webos-goes-open-source/
推荐理由:很多早年的机油们可能还记得 Palm 奔迈公司,其出品的掌上电脑和智能手机所用的 Palm OS 当年也是一霸,只可惜后来虎落平阳,接连被 HP 收购,更名为:webOS,宣布开源,后又被 LG 收购,不过它的所有人 LG 公司现在又再一次宣布开源,什么叫再一次?看了文章就知道了。
LG’s Linux-based webOS Goes Open Source, Again!
webOS has metamorphosed from Open webOS, HP webOS, Palm webOS and to LG webOS. It was originally developed by Palm for its Personal Digital Assistant. In 2010, HP bought Palm and thus acquired Palm webOS but a few years later, HP sold it to LG Electronics for them to use it on their web-enabled smart TVs replacing its NetCast platform.
Today, LG has expanded the use of the webOS from smart TVs to IoT devices. And to further expand its reach and lure developers, LG has launched an open source version of webOS called webOS OSE (open source edition). And thus webOS goes open source again.
Open Source once again
Did I say again? Yes, because in 2012, HP had open sourced this operating system.
The slick and user-friendly operating system which HP used to compete with Android and iOS platforms was considered by some at that time as an alternative to Android for Tablets. However, they couldn’t find a ready market and it was shut down abruptly and later sold to LG with LG gaining unlimited access to all of webOS source code and documentation.
webOS Open Source Edition is a software platform with innovative features that could be applied to different types of display products to home appliances and mobile devices. It is now open for web developers to design apps and services for webOS OSE.
The initial release can port webOS OSE to Raspberry Pi 3 and thus making it a lucrative option for IoT projects. This will be extended in future to other types of devices as well.
More open source stuff
Enact is used as the Web app framework for webOS Open Source Edition. Enact, which is also Open Source is built on React UI library. It has been optimized for webOS and facilitates app development as well as provides a reliable performance for apps in spite of its complexity and size.
The webOS OSE architecture consists of a set of layers that include Core Applications, Managers and Services, Application Framework, BSP/Kernel and Base Components. Check this out to find a detail of the webOS Open Source Edition Architecture.
According to LG Electronics CTO, “webOS has come a long way since then and is now a mature and stable platform ready to move beyond TVs to join the very exclusive group of operating systems that have been successfully commercialization at such a mass level. As we move from an app-based environment to a web-based one, we believe the true potential of webOS has yet to be seen.”
What do you think about this latest development from LG’s webOS going Open Source? Share your thoughts with us in the comment section below.
每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;电报群 https://t.me/OpeningSourceOrg