从零开始的 Rust 学习笔记(3)——Yet Another Way to Kill Your Brain

于是结合前面看到的语法,再加上 Google 的帮助,用 Rust 来写一个 Brainfuck 解释器吧~

这一篇与另一篇 post 联动,Brainfuck Interpreter in C++17——A Modern Approach to Kill Your Brain

其实在有了 C++ 写的经历之后,用 Rust 来重写一次,几乎就是熟悉一下 Rust 的基本语法,然后一些小的地方(比如 std::vector, std::stack, std::map 在 Rust 中的等价的类是什么)就靠着 Google 和 Rust 官方文档基本就可以写出来了

另外 Brainfuck 解释器的话,与别的很多东西比起来,似乎没有那么困难,写起来还是蛮快的

当然,有些 C++ 里的就没法依葫芦画瓢放到 Rust 里了,但终归只是一些小的修改~

Continue reading 从零开始的 Rust 学习笔记(3)——Yet Another Way to Kill Your Brain

从零开始的 Rust 学习笔记(0)

----------------------------
| Hello fellow Rustaceans  |
----------------------------
              \
               \
                  _~^~^~_
              \) /  o o  \ (/
                '_   -   _'
                / '-----' \

一点点前言~这个系列一大部分算是学习 Rust 语言的自用笔记,另一部分也算是分享给有需要的人,整体上来说会跟着「The Rust Programming Language」这本书来走,可能偶尔也会突然自己写点什么小东西~

虽然说是自用笔记,但是既然写了还是会尽力让看到的人能够看明白这样子;同时也因为是自用笔记,所以在跟着「The Rust Programming Language」书的时候,并不一定会在所有东西第一次出现时就解释得非常清晰,我会以自己的学习风格为主来写这个系列

首先是安装 Rust,https://www.rust-lang.org/learn/get-started,打开这个链接之后会见到如何安装 Rust 的操作。比如 macOS 或者其他 Unix-like 的系统的话,则是利用如下命令安装

curl https://sh.rustup.rs -sSf | sh
Continue reading 从零开始的 Rust 学习笔记(0)

Magic Image(3)——Implementation in Python3 with Either OpenCV3 or PIL

It has been 3 years since the last update on Magic Image, https://await.moe/2016/09/magic-image2-mathematical-model/, which talked about the mathematical model of creating the mix image.

And to be honest, the Python implementation actually wrote 4 months ago, but it only support OpenCV then. And today, out of personal interest, I added PIL support. Now it could run with PIL only. (But if it detects the existence of OpenCV, that would be preferred)

Continue reading Magic Image(3)——Implementation in Python3 with Either OpenCV3 or PIL