Video Poker Takes Your Money In 10 Lines Of BASIC

It wasn’t easy, but [D. Scott Williamson] succeeded in implementing Jacks or Better Video Poker in 10 lines of BASIC, complete with flashing light and sound! Each round, one places a bet then plays a hand of 5-card draw, hoping to end up with Jacks or better.

This program is [Scott]’s entry into the 2024 BASIC 10 Liner Contest, which at this writing has concluded submissions and expects to announce results on April 6th 2024. Contestants may choose any 8-bit computer system BASIC, and must implement their program within ten lines of code (classically limited to 80 characters per line, but there are different categories with different constraints on line width.)

10 lines of BASIC is truly an exercise in information density.

We’ve seen impressive 10-line BASIC programs before, like this re-implementation of the E.T. video game. (Fun fact: while considered one of the worst video games of all time, there’s a compelling case to be made that while it was a flop, it was ahead of its time and mostly just misunderstood.)

These programs don’t look much like the typical BASIC programs many of us remember. They are exercises in information density, where every character counts. So we’re delighted to see [Scott] also provides a version of his code formatted and commented for better readability, and a logical overview that steps through each line.

He spends a little time talking about the various challenges, as well. For example, hand ranking required a clever solution. IF…THEN conditionals would rapidly consume the limited lines of code, so hands are ranked programmatically. The 52-card deck is also simulated, rather than simply generating random cards on the fly.

The result looks great, and you can watch it in action in the video, just under the page break. If this sort of challenge tweaks your interest, there’s plenty of time to get started on next year’s BASIC 10 Liner Contest. Fire up those emulators!

Continue reading “Video Poker Takes Your Money In 10 Lines Of BASIC”

Weird Things To Do With FPGAs

There’s an old joke about how can you find the height of a building using a barometer. One of the punchlines is to drop the barometer from the roof and time how long it takes to hit the ground. We wonder if [Alexlao512] had that in mind when he wrote a post about unconventional uses of FPGAs. Granted, he isn’t dropping any of them off a roof, but still. The list takes advantage of things we usually try to avoid such as temperature variation, metastability, and the effects of propagation delays.

For example, you probably know that hooking up an odd number of inverters into a loop forms an oscillator—the so-called ring oscillator. The post discusses how you can use an oscillator like that to measure propagation delay or even as a strain gauge. If you put pressure on the FPGA chip, the frequency of the ring oscillator will subtly vary.

Continue reading “Weird Things To Do With FPGAs”

Left: a DIY chording keyboard with seven keys Right: the guts of said keyboard

Chording Keyboard Leaves Your Mouse Hand Free

[akmnos22] was getting tired of moving one hand to the mouse and back to the keyboard. Rather than integrating mouse controls into a keyboard, they decided to really lean in and create a chording keyboard — one that creates characters with combinations of key presses, like playing chords on a piano.

This project was inspired in part by the Infogrip BAT, which has graced these pages before. Much like the BAT, this uses a total of seven Cherry MX switches: one for each finger, and three for the thumb. In order to get the placement just right for you, [akmnos22] suggests laying your hand in a comfortable position on a piece of paper and marking where your fingers naturally rest, then importing these markings into CAD software to decide where the key switch holes should be.

The brains of this operation is a Raspberry Pi Pico, which provides more than enough GPIO pins to do the job. [akmnos22] does a nice job of explaining exactly how to put one of these together, from the design concept through the programming process and how to actually chord on the thing.

Would you rather chord with two hands? It might be even faster.

Vastly Improved Servo Control, Now Without Motor Surgery

Hobby servos are great, but they’re in many ways not ideal for robotic applications. The good news is that [Adam] brings the latest version of his ServoProject, providing off-the-shelf servos with industrial-type motion control to allow for much, much tighter motion tracking than one would otherwise be limited to.

Modifying a servo no longer requires opening the DC motor within.

The PID control system in a typical hobby servo is very good at two things: moving to a new position quickly, and holding that position. This system is not very good at smooth motion, which is desirable in robotics along with more precise motion tracking.

[Adam] has been working on replacing the PID control with a more capable cascade-based control scheme, which can even compensate for gearbox backlash by virtue of monitoring the output shaft and motor position separately. What’s really new in this latest version is that there is no longer any need to perform surgery on the DC motor when retrofitting a servo; the necessary sensing is now done externally. Check out the build instructions for details.

The video (embedded just below) briefly shows how a modified servo can perform compared to a stock one, and gives a good look at the modifications involved. There’s still careful assembly needed, but unlike the previous version there is no longer any need to actually open up and modify the DC motor, which is a great step forward.

Continue reading “Vastly Improved Servo Control, Now Without Motor Surgery”

A Binary Version Of The Enigma Machine

The Enigma machine is the most well-known encryption tool used by German forces in World War II, mostly because it was so famously cracked by the Allies to great effect. Like many hackers, [christofer.jh] was intrigued by the design of the Enigma, and felt compelled to build a binary version of his own design.

The original Enigma machine was designed to scramble the 26 letters in the Latin alphabet. This design is altogether simpler. Instead of 26 letters, it will scramble 1s and 0s of binary code based on the initial settings of the scrambler rings.

Continue reading “A Binary Version Of The Enigma Machine”

Why X86 Needs To Die

As I’m sure many of you know, x86 architecture has been around for quite some time. It has its roots in Intel’s early 8086 processor, the first in the family. Indeed, even the original 8086 inherits a small amount of architectural structure from Intel’s 8-bit predecessors, dating all the way back to the 8008. But the 8086 evolved into the 186, 286, 386, 486, and then they got names: Pentium would have been the 586.

Along the way, new instructions were added, but the core of the x86 instruction set was retained. And a lot of effort was spent making the same instructions faster and faster. This has become so extreme that, even though the 8086 and modern Xeon processors can both run a common subset of code, the two CPUs architecturally look about as far apart as they possibly could.

So here we are today, with even the highest-end x86 CPUs still supporting the archaic 8086 real mode, where the CPU can address memory directly, without any redirection. Having this level of backwards compatibility can cause problems, especially with respect to multitasking and memory protection, but it was a feature of previous chips, so it’s a feature of current x86 designs. And there’s more!

I think it’s time to put a lot of the legacy of the 8086 to rest, and let the modern processors run free. Continue reading “Why X86 Needs To Die”

Magnetic Power Cable Makes Mobility Scooter Much Better

Sometimes, you have to wonder what major manufacturers of assistive tech are thinking when they design their products. [Niklas Frost]’s father has MS and uses an electric mobility scooter to get around. It’s a good solution to a terrible problem, except it stops short of the most important part — the charging scheme. Because of the aforementioned mobility issues, [Niklas]’s father can’t plug and unplug it without assistance. So much for independence.

And so [Niklas] gave it some thought and came up with an incredibly easy way that Dad can charge his scooter. It’s even non-intrusive — all it took was a handful of off-the-shelf components and some 3D printed parts to make what’s essentially an extension cord between the charger and the scooter. Really, there’s nothing more to it than three 10 A magnetic connectors, an XLR female port, an XLR male connector, and some very helpful plastic.

Something interesting to note: [Niklas] spent a year or so tinkering with a robot that could drive the plug over to the charger and plug it in. A book on the subject made him destroy that robot, however, when he realized that he was being driven more by cool technologies than solving the problem at hand. Within a few days of changing course, [Niklas]’ dad was charging his own scooter.

Now, if [Niklas] wants to see about making the scooter move a whole lot faster, we have just the thing.