aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-04-10 12:43:08 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-04-10 12:43:08 +0200
commit1e6a83293f0aa47415d5480a773d6d12c09afb19 (patch)
tree05b4ae2e5192c722aa68d9bff66791f86006efd6 /src
parent2fb07a9a7d477253fb5ba4d96e0a08d770593d59 (diff)
downloadsebastiano.tronto.net-1e6a83293f0aa47415d5480a773d6d12c09afb19.tar.gz
sebastiano.tronto.net-1e6a83293f0aa47415d5480a773d6d12c09afb19.zip
Added blog post
Diffstat (limited to 'src')
-rw-r--r--src/blog/2023-04-10-the-big-rewrite/the-big-rewrite.md149
-rw-r--r--src/blog/blog.md1
-rw-r--r--src/blog/feed.xml7
3 files changed, 157 insertions, 0 deletions
diff --git a/src/blog/2023-04-10-the-big-rewrite/the-big-rewrite.md b/src/blog/2023-04-10-the-big-rewrite/the-big-rewrite.md
new file mode 100644
index 0000000..45da3cb
--- /dev/null
+++ b/src/blog/2023-04-10-the-big-rewrite/the-big-rewrite.md
@@ -0,0 +1,149 @@
1# The big rewrite
2
3Recently I have been working on [nissy](https://nissy.tronto.net),
4my command-line Rubik's cube solver. But things were not going the
5way I wanted. I was trying to implement some minor but rather complex
6optimizations. It was a challenging problem and I made some good progress,
7but coming back to my code after not looking at it for weeks made it
8hard to debug it.
9
10I could work on this project more often. I rarely have long hours or days
11in a row to spend on it, but I do have some free time here and there -
12I write somewhat regularly in this blog, after all. So why was I not
13spending some more time on this project that I like so much?
14
15I think I was trying to do too much. I was trying to write this complex
16optimization for the puzzle-solving logic basically to prove to myself
17that I am capable of it, but at the same time I wanted to keep the
18tool usable for the few people interested in it. As new ideas piled up,
19I rushed through my code changes. Code quality degraded, and I was not
20improving the tool.
21
22It was time for...
23[the big rewrite](https://dylanbeattie.net/songs/big_rewrite.html)!
24
25## What is nissy?
26
27Nissy is a command line Rubik's cube solver and
28*[fewest moves](https://www.speedsolving.com/wiki/index.php?title=Fewest_Moves_Challenge)*
29solving assistant. You can find it's source code on its
30[git page](https://git.tronto.net/nissy).
31As a cube solver it is quite fast, faster than the classic
32[Cube explorer](http://kociemba.org/download.htm), although it uses
33much more RAM. But there is room for improvement.
34Additional features related to
35[Thistlethwaite's algorithm](https://en.wikipedia.org/wiki/Optimal_solutions_for_Rubik%27s_Cube#Thistlethwaite's_algorithm)
36make it useful tool for a certain niche of speedcubers. Although
37these features are appreaciated by nissy's users, the CLI interface
38and general usability is not as well-received.
39
40I started working on it in 2019, and after a few months of I had something
41we could call useful, at least for me. As I added more features and tried
42to implement a faster optimal solver, I noticed that I could make some
43improvements to its design. So I decided to rewrite nissy from scratch.
44
45"Rewriting from scratch" is a bit of a taboo among programmers. It is
46exciting to start working on a new or "rebooted" project, but it is
47usually more time-efficient to just fix the old code. Nonetheless,
48starting over worked for me: at the end of 2021 nissy was much faster,
49and more useful for everyone.
50
51Fast-forward another year or so, and I was at the point I described in
52the first paragraph. Since stopping to think, redesign and rewrite worked
53for this project last time, I decided to do this again. I did not start
54nissy with a clear goal in mind, so it makes sense that I come up with
55better goals and design ideas as I go.
56
57## Setting a goal
58
59Nissy has been my pet project for the last 3.5 years or so. I started
60writing because I wanted to see if I could do it, and decided which
61features to include along the way. I have never had a precise goal for
62it, so I had to think about what I wanted nissy to be.
63
64Right now, nissy's most important features for its users (including
65myself) are:
66
67* Analyzing a "fewest moves" solution, helping the (human) solver spot
68 mistakes, oversigths and more advanced tricks that they missed.
69* Solving a Rubik's cube optimally, fast.
70
71The first part is basically already implemented, though some improvements
72can be made and some simple features can be added. Most importantly,
73the interface should be made more accessible to people not familiar with
74the command line - more on this later.
75
76For the second part, the interface is less important, and I can expect the
77users to be able to learn how to launch one single command. It is also
78the part that I find most interesting to work on, since the optimization
79problem is much more challenging. On the other hand, the optimal solver
80implemented in the current version of nissy is already good enough for
81most users.
82
83Once I had written down these two main features, I realized that
84I would be much happier working on this project if I just stuck to
85those two things. And since *one* program should do *one* thing, I
86decided to split the two features into separate projects. Any other
87cool idea I thought of implementing (a speed-solving assitant? a
88higher-order cube optimal solver? a generic, hackable puzzle solver like
89[ksolve+](https://mzrg.com/rubik/ksolve+)?) is deferred to future
90projects, or probably it will be never done. And that's OK.
91
92## New plan
93
94My plan is to split the work into the following parts:
95
96* Starting from the [stable branch](https://nissy.tronto.net/download)
97 of nissy, remove all the code that is needed only by the optimal
98 solver and other unnecessary steps. Work on a GUI and other simple
99 features useful for assisting fewest moves solvers.
100* Branch off the optimal solver from the current
101 [working branch](https://git.tronto.net/nissy/) of nissy. Remove
102 all the code that is not needed for the optimal solver and simplify
103 the logic, where possible, to address only this use case.
104 Finish implementing the solver, basically following Tomas Rokicki's
105 [nxopt](https://github.com/rokicki/cube20src/blob/master/nxopt.md),
106 or at least parts of it.
107
108For the user interface, I have been thinking about what would be
109the best library / framework / technology to use. I would like
110this to be as accessible as possible, so I have been considering
111[WebAssembly](https://webassembly.org) so that people can just run this
112in their browser. But apparently a WebAssembly app needs an http server
113to work. I don't want nissy to require an internet connection, and
114shipping a whole web server to run locally with it is overkill. I have
115also been thinking about [Flutter](https://flutter.dev), it supports all
116majow platforms and has the C language as a first-class citizen. I think
117I'll try making some proof of concept app with it and see how it goes.
118
119## A GUI app? Is this an April fools' joke?
120
121Am I a big fan of command line interfaces. I am such a fan of the command
122line that I dislike TUIs (such as
123[ncurses](https://en.wikipedia.org/wiki/Ncurses)-based programs), because
124they are just GUIs running in a terminal. So why am I even considering
125ruining my favourite personal project by adding a GUI?
126
127One reason is that I don't expect my (very few) users to be familiar with
128the command line. But this is not the main reason. I truly believe that,
129for this specific use case, a graphical user interface would be better.
130And it is not even a matter of showing a graphical representation of
131the cube - my users don't need it,
132[Singmaster notation](https://www.speedsolving.com/wiki/index.php/Singmaster_notation)
133is enough for them.
134
135The point is that this program is supposed to show you a bunch of
136information. The user might want to see more details, less details,
137group this information in different ways and so on. This information
138should be browsable. The user should, ideally, be able to follow a
139solution path proposed by nissy by simply selecting the suggested steps.
140
141This could all be done with commands, of course. But it would not be
142efficient. The command line is great when you know what information
143you want and you ask the computer to generate it or fetch it.
144But for interactively browsing information, especially when you do
145not know exactly what you are looking for, a GUI is better.
146
147## Ok, so when is it going be ready?
148
149Ah-ah. It will be ready when it's ready, no promises :)
diff --git a/src/blog/blog.md b/src/blog/blog.md
index 8589429..88c8e8b 100644
--- a/src/blog/blog.md
+++ b/src/blog/blog.md
@@ -5,6 +5,7 @@
5 5
6## 2023 6## 2023
7 7
8* 2023-04-10 [The big rewrite](2023-04-10-the-big-rewrite)
8* 2023-03-30 [The man page reading club: dc(1)](2023-03-30-dc) 9* 2023-03-30 [The man page reading club: dc(1)](2023-03-30-dc)
9* 2023-03-06 [Resizing my website's pictures with ImageMagick and find(1)](2023-03-06-resize-pictures) 10* 2023-03-06 [Resizing my website's pictures with ImageMagick and find(1)](2023-03-06-resize-pictures)
10* 2023-02-25 [Job control: one shell is all you need](2023-02-25-job-control) 11* 2023-02-25 [Job control: one shell is all you need](2023-02-25-job-control)
diff --git a/src/blog/feed.xml b/src/blog/feed.xml
index be949e6..c4fb4d9 100644
--- a/src/blog/feed.xml
+++ b/src/blog/feed.xml
@@ -9,6 +9,13 @@ Thoughts about software, computers and whatever I feel like sharing
9</description> 9</description>
10 10
11<item> 11<item>
12<title>The big rewrite</title>
13<link>https://sebastiano.tronto.net/blog/2023-04-10-the-big-rewrite</link>
14<description>The big rewrite</description>
15<pubDate>2023-04-10</pubDate>
16</item>
17
18<item>
12<title>The man page reading club: dc(1)</title> 19<title>The man page reading club: dc(1)</title>
13<link>https://sebastiano.tronto.net/blog/2023-03-30-dc</link> 20<link>https://sebastiano.tronto.net/blog/2023-03-30-dc</link>
14<description>The man page reading club: dc(1)</description> 21<description>The man page reading club: dc(1)</description>

Generated with cgit - Back to sebastiano.tronto.net