Birger Schacht: Another round of rust
A couple of weeks ago I had to undergo surgery, because one of my kidneys
malfunctioned. Everything went well and I m on my way to recovery. Luckily the
most recent local heat wave was over just shortly after I got home, which made
being stuck at home a little easier (not sure yet when I ll be allowed to do
sports again, I miss my climbing gym ).
At first I did not have that much energy to do computer stuff, but after a week
or so I was able to sit in front of the screen for short amounts of time and I
started to get into writing Rust code again.
carl
The first thing I did was updating carl. I updated all
the dependencies and switched the dependency that does coloring from
carl
The first thing I did was updating carl. I updated all
the dependencies and switched the dependency that does coloring from
ansi_term, which is
unmaintained, to
nu-ansi-term. When I then updated the
clap dependency to version 4 I realized that
clap now depends on the anstyle crate for
text styling - so I updated carls coloring code once again so it now uses
anstyle, which led to less dependencies overall. Implementing this change I
also did some refactoring of the code.
carl how also has its own website as well as a
subdomain1.
I also added a couple of new date properties to carl, namely all weekdays as
well as odd and even - this means it is now possible choose a separate color
for every weekday and have a rainbow calendar:
This is included in version 0.1.0 of carl, which I published on
crates.io.
typelerate
Then I started writing my first game -
typelerate. It is a copy of the great
typespeed, without the multiplayer
support.
To describe the idea behind the game, I quote the typespeed website:
Typespeed s idea is ripped from ztspeed (a DOS game made by Zorlim). The
Idea behind the game is rather easy: type words that are flying by from left
to right as fast as you can. If you miss 10 or more words, game is over.
Instead of the multiplayer support, typelerate works with UTF-8 strings and
it also has another game mode: in typespeed you only type whats scrolling
via the screen. In typelerate I added the option to have one or more
answer strings. One of those has to be typed instead of the word flying
across the screen. This lets you implement kind of an question/answer game. To
be backwards compatible with the existing wordfiles from typespeed2, the
wordfiles for the question/answer games contain comma separated values. The
typelerate repository contains
wordfiles with Python and Rust keywords as well as wordfiles where you are
shown an Emoji and you have to type the corresponding Github shortcode. I m
happy to add additional wordfiles (there could be for example math
questions ).
marsrover
Another commandline game I really like, because I am fascinated by the animated
ASCII graphics, is the venerable
moon-buggy. In this game you have to
drive a vehicle across the moon s surface and deal with obstacles like craters or
aliens.
I reimplemented the game in rust and called it marsrover:
I published it on crates.io, you can find
the repository on github. The game uses
a configuration file in $XDG_CONFIG_HOME/marsrover/config.toml - you can
configure the colors of the elements as well as the levels. The game comes with
four levels
predefined,
but you can use the configuration file to override that list of levels with
levels with your own properties. The level properties define the probabilities
of obstacles occuring on your way on the mars surface and a points setting that
defines how many points the user can get in that level (=the game switches to
the next level if the user reaches the points).
[[levels]]
prob_ditch_one = 0.2
prob_ditch_two = 0.0
prob_ditch_three = 0.0
prob_alien = 0.5
points = 100
After the last level, the game generates new ones on the fly.
-
thanks to the service from https://cli.rs.
-
actually,
typelerate is not backwards compatible with the typespeed
wordfiles, because those are not UTF-8 encoded
Typespeed s idea is ripped from ztspeed (a DOS game made by Zorlim). The Idea behind the game is rather easy: type words that are flying by from left to right as fast as you can. If you miss 10 or more words, game is over.Instead of the multiplayer support,
typelerate works with UTF-8 strings and
it also has another game mode: in typespeed you only type whats scrolling
via the screen. In typelerate I added the option to have one or more
answer strings. One of those has to be typed instead of the word flying
across the screen. This lets you implement kind of an question/answer game. To
be backwards compatible with the existing wordfiles from typespeed2, the
wordfiles for the question/answer games contain comma separated values. The
typelerate repository contains
wordfiles with Python and Rust keywords as well as wordfiles where you are
shown an Emoji and you have to type the corresponding Github shortcode. I m
happy to add additional wordfiles (there could be for example math
questions ).
marsrover
Another commandline game I really like, because I am fascinated by the animated
ASCII graphics, is the venerable
moon-buggy. In this game you have to
drive a vehicle across the moon s surface and deal with obstacles like craters or
aliens.
I reimplemented the game in rust and called it marsrover:
I published it on crates.io, you can find
the repository on github. The game uses
a configuration file in $XDG_CONFIG_HOME/marsrover/config.toml - you can
configure the colors of the elements as well as the levels. The game comes with
four levels
predefined,
but you can use the configuration file to override that list of levels with
levels with your own properties. The level properties define the probabilities
of obstacles occuring on your way on the mars surface and a points setting that
defines how many points the user can get in that level (=the game switches to
the next level if the user reaches the points).
[[levels]]
prob_ditch_one = 0.2
prob_ditch_two = 0.0
prob_ditch_three = 0.0
prob_alien = 0.5
points = 100
After the last level, the game generates new ones on the fly.
-
thanks to the service from https://cli.rs.
-
actually,
typelerate is not backwards compatible with the typespeed
wordfiles, because those are not UTF-8 encoded
[[levels]]
prob_ditch_one = 0.2
prob_ditch_two = 0.0
prob_ditch_three = 0.0
prob_alien = 0.5
points = 100
- thanks to the service from https://cli.rs.
-
actually,
typelerateis not backwards compatible with thetypespeedwordfiles, because those are not UTF-8 encoded
For setting up subdomain on
I dug out a computer running Fedora 28, which was released 2018-04-01 - over 5 years ago. Backing up the data and re-installing seemed tedious, but the current version of Fedora is 38, and while Fedora supports updates from N to N+2 that was still going to be 5 separate upgrades. That seemed tedious, so I figured I'd just try to do an update from 28 directly to 38. This is, obviously, extremely unsupported, but what could possibly go wrong?
















Mais uma edi o da 













A few weeks ago, my friend and neighbor J r me (