2018年4月18日:開源日報第41期

每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,歡迎關注開源日報。交流QQ群:202790710;電報群 https://t.me/OpeningSourceOrg


今日推薦開源項目:《微信跳一跳 Python 小助手

推薦理由:微信跳一跳想必很多朋友都玩過,但是有想過自己做一個嗎?國內就有大神做了個 Python 開源版並且登上熱榜,內附 GitHub 地址,動手一起玩吧

開源項目精選:微信跳一跳 Python 小助手

核心原理:

每次落穩之後截圖,根據截圖算出棋子的坐標和下一個塊頂面的中點坐標,根據兩個點的距離乘以一個時間係數獲得長按的時間。

識別棋子:

靠棋子的顏色來識別位置,通過截圖發現最下面一行大概是一條直線,就從上往下一行一行遍歷,比較顏色(顏色用了一個區間來比較)找到最下面的那一行的所有點,然後求個中點,求好之後再讓 Y 軸坐標減小棋子底盤的一半高度從而得到中心點的坐標。

識別棋盤:

靠底色和方塊的色差來做,從分數之下的位置開始,一行一行掃描,由於圓形的塊最頂上是一條線,方形的上面大概是一個點,所以就用類似識別棋子的做法多識別了幾個點求中點,這時候得到了塊中點的 X 軸坐標,這時候假設現在棋子在當前塊的中心,根據一個通過截圖獲取的固定的角度來推出中點的 Y 坐標。

最後:根據兩點的坐標算距離乘以係數來獲取長按時間(似乎可以直接用 X 軸距離)

開源項目精選:微信跳一跳 Python 小助手

這個思路非常典型,就是去找所需屬性的特徵,而且這個遊戲的設定完美地避開了這個演算法的漏洞:基本上沒有與平台相同的顏色(當然相同的話是會被玩家吐槽的),並且遊戲的視角沒有出現過旋轉或者縮放。如果有的話識別上會有一定難度。

利用背景色色差來識別棋盤:

跳一跳的背景現在會逐漸變色,有的時候甚至會與下一個平台的顏色一模一樣,不過截圖也就一瞬間的事,對於這個演算法來說並不是什麼問題。作者還專門優化了當小人的圖案位於下個矩形頂部上方的情況。不過識別平台大小的演算法對於雜色效果並不好,筆者測試的時候大部分都是這個時候掛掉的( ̄ε(# ̄) Σ

對這個程序的探索大概到這裡就結束了,這個小項目後續的更新基本上是對識別的進一步優化以及防反外掛機制。本篇延展權當大家學習中的一個小插曲,希望它能讓大家在鑽研之餘輕鬆一刻。

開源項目精選:微信跳一跳 Python 小助手

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

()
第0屆學生開源年會 SOSCON 將於6月在重慶大學舉辦
學生開源年會 SOSCON 啟動招募志願者
暫無評論
做你所想,開源工場

開源工場是一個校園風格的古典開源文化社區,通過開源協作形式來創造生產力和寓技術於樂趣的頻分多址非盈利開源社區。主張享受開源審美和動手做開源。目前有全球流行開源項目榜中榜開源周報、開源日報、媛寶、猿帥、開源尚青、開源工寮等原創欄目及主辦學生開源年會(sosconf)。了解我們加入我們

聯繫我們

中國:重慶市沙坪壩區沙正街174號重慶大學
新加坡:113 Jalan Besar, Singapore 208833

編程浪子
編程浪子
人不堪其憂,我不改其樂 base64 -d "d2VuQGJvb3RpbmdtYW4ub3Jn"
153
文章
35
評論
97
喜歡