Show HN: Iron-Wolf – Wolfenstein 3D source port in Rust
github.com
github.com
let mut found_info = None;
for info in &STAT_INFO {
if info.kind == item_type {
found_info = Some(info);
break;
}
}
When typically in rust this is just: let found_info = STAT_INFO.iter().find(|info| info.kind() == item_type);
Now I want to go through and feng shui all the code to look more like idiomatic rust just to waste some time on a saturday...If you do that, please share a link so I can learn from you! This is awesome!
> Was this translated automatically from C?
I'll note that when I convert code between languages, I often go out of my way to minimize on-the-fly refactoring, instead relying on a much more mechanical, 1:1 style. The result might not be idiomatic in the target language, but the bugs tend to be a bit fewer and shallower, and it assists with debugging the unfamiliar code when there are bugs - careful side-by-side comparison will make the mistakes clear even when I don't actually yet grok what the code is doing.
That's not to say that the code should be left in such a state permanently, but I'll note there's significantly more changes in function structure than I'd personally put into an initial C-to-Rust rewrite.
The author of this rewrite appears to be taking a different approach, understanding the codebase in detail and porting it bit by bit, refactoring at least some along the way. Here's the commit that introduced that fn, doesn't look like automatic translation to me: https://github.com/Ragnaroek/iron-wolf/commit/9014fcd6eb7b10...
How debug-able is the internals of the rust lambda version?
I will often write the code so I can simply insert a break point for debugging versus pure anonymous and flow-style functions.
C# example:
#if DEBUG
const string TestPoint = "xxxx";
#endif
var filtered = items.Where(x =>
{
#if DEBUG
if (x.Name == TestPoint)
x.ToString()
#endif
.....
});
vs var filtered = items.Where(x => ....);It's an old website for C programming from Stanford Uni by Nick Parlante [3].
For full blown treatment on linked list and doubly linked list please check this an excellent book Pointers on C by Kenneth Reek (1998) [4].
[1] Linked List Basics
http://cslibrary.stanford.edu/103/
[2] Linked List Problems:
http://cslibrary.stanford.edu/105/
[3] Essential C:
http://cslibrary.stanford.edu/101/
[4] Pointers on C:
See, for example:
You should add it to https://hnarcade.com
I think it cuts both ways. The Wolfenstein franchise has obviously relished in violence against Nazis, but also inadvertently is part of the trend of glorifying them.
https://steamcommunity.com/app/612880/discussions/0/14708409...
https://www.newstatesman.com/science-tech/2017/06/alt-right-...
Eisen means Iron. You could name it Wolfeneisen?
- Once started the shareware game on Chromium browsers seems to flicker like crazy which displays the "B.J. Blazkowicz" face.
- You missed adding the classic code that everyone knows, M-L-I!
I did a WASM port of the shareware from https://github.com/fabiangreffrath/wolf4sdl playable at https://midzer.de/wasm/wolfenstein/
Port it to 286, and then claim RUST victory