We’ve all seen videos of Rubik’s cube champions who can solve the puzzle in less than 5 seconds. And there are cube-twisting robots that can solve the cube even faster, often in under a second. This Rubik’s cube solver is not one of those robots, but it’s still pretty cool.
The reason we like Dexter Industries’ “BricKuber” is not for its lightning speed — it takes a minute or two to solve the puzzle. What we like is the simplicity of the approach to manipulating the cube. Built from LEGO parts, including Mindstorms motors and a BrickPi controller, the BricKuber uses only two motors to work the cube. One motor powers a square turntable upon which the cube sits, while the other powers an arm that does double duty — it either clamps the cube so the turntable can rotate a layer, or it rakes the cube to flip it 90° on the turntable. With a Pi Cam overhead, the rig images all six faces, calculates a solution to the cube, and then flips and twists the cube to solve it. It’s simultaneously mind-boggling and strangely relaxing to watch.
All the code is open source, and we strongly suspect a similar and possibly faster robot could be built without the LEGO parts. You might even be able to build one with popsicle sticks and an Arduino.
Continue reading “Solving a Rubik’s Cube with Just Two Motors”
What if we told you that you are likely to have more computers than you think? And we are not talking about things that are computers while not looking like one, like most modern cars or certain lightbulbs. We are talking about the powerful machines hiding in your desktop computer called ‘graphics card’. In the ordinary gaming rig graphics cards that are much more powerful than the machine they’re built into are a common occurrence. In his tutorial [Viktor Chlumský] demonstrates how to harness your GPU’s power to solve a maze.
Software that runs on a GPU is called a shader. In this example a shader is shown that finds the way through a maze. We also get to catch a glimpse at the limitations that make this field of software special: [Viktor]’s solution has to work with only four variables, because all information is stored in the red, green, blue and alpha channels of an image. The alpha channel represents the boundaries of the maze. Red and green channels are used to broadcast waves from the beginning and end points of the maze. Where these two waves meet is the shortest solution, a value which is captured through the blue channel.
Despite having tons of cores and large memory, programming shaders feels a lot like working on microcontrollers. See for yourself in the maze solving walk through below.
Continue reading “Solving Mazes with Graphics Cards”
Wolfram Alpha has been “helping” students get through higher math and science classes for years. It can do almost everything from solving Laplace transforms to various differential equations. It’s a little lacking when it comes to solving circuits, though, which is where [Grant] steps in. He’s come up with a tool called OneSolver which can help anyone work out a number of electrical circuits (and a few common physics problems, too).
[Grant] has been slowly building an online database of circuit designs that has gotten up to around a hundred unique solvers. The interesting thing is that the site implements a unique algorithm where all input fields of a circuits design can also become output fields. This is unique to most other online calculators because it lets you do things that circuit simulators and commercial math packages can’t. The framework defines one system of equations, and will solve all possible combinations, and lets one quickly home in on a desired design solution.
If you’re a student or someone who constantly builds regulators or other tiny circuits (probably most of us) then give this tool a shot. [Grant] is still adding to it, so it will only get better over time. This may be the first time we’ve seen something like this here, too, but there have been other more specific pieces of software to help out with your circuit design.
[Gadget Addict] found out about a contest being held by a shoe seller. Their mobile app has a game very much like Bejeweled. The high scorer each month gets £500. His choices were to be better at the game than everyone else, or to be smarter. He chose the latter by writing a computer vision program to play the game.
There are two distinct parts of a hack like this one. The first is just figuring out a way to programmatically detect the game board and correctly identify each icon on it. This is an iPad game. [Gadget Addict] is mirroring the screen on his laptop, which gives him easy access to the game board and also allows for simulated swipes for automatic play. Above you can see two examples where black pixels may be counted in order to identify the icon. A set of secondary checks differentiates similar entries after the first filtering. The other part of the hack involves writing the algorithms to solve for the best move.
If you liked this one, check out a super-fast Bejeweled solver from several years back. We should also mention that this was just a proof of concept and [GA] never actually entered the contest.
This grid of letters is a puzzle game for tablet devices called Ruzzle. The contraption attached is an automated solver which uses LEGO Mindstorm parts to input the solutions on the screen. [Alberto Sarullo] is the mastermind behind the project. As you can seen in his demo video after the break he has a flair for the cinematic. But he makes you work a little bit to discover the details of his project.
His post gives a general overview of how this works. A Linux box takes a screenshot of the Ruzzle board. After processing the graphics with Imagemagick he uses Tesseract — an Optical Character Recognition program — to figure out which letter is on each square of the playing area. From there NodeJS is used to discover all possible words with the help of a dictionary file. The final solutions are pushed to the LEGO parts to be traced out on the touch screen with a stylus. The nice thing is that he published all of his code, so you can drill much deeper into the project by pawing through his repository.
Continue reading “LEGO stylus solves Ruzzle tablet game”
We think we have found project that will take over our holiday free time. [Bai Li] just published an excellent article about writing a program that can automatically solve the game of Minesweeper. For those of you who are unfamiliar, Minesweeper gives you a grid in which land mines have been randomly placed. As you click on boxes to reveal what is underneath you are greeted with a number which represents how many mines surround that box. [Bai’s] project examines how the puzzle may be solved programmatically.
He chose to use Java to write the solver. This works well both reading from the screen as well as simulating mouse clicks on the game. The reading portion of the program uses color detection with a screenshot. There were two problems associated with this, the numeral one is almost the same color as an uncovered square, and the numerals seven and three use identical colors. The input portion was much simpler as he’s able to use the existing Robot class.
The logic behind writing an efficient solver is very interesting. One of the most fascinating examples is shown above. What should you do when there is no possible way to ensure a safe move? As with traditional chess games, [Bai] has the solver calculate all possible solutions and choose the move that has the best odds of success.
His source code is available, but won’t this one be fun to hack out from the concepts alone? For some reason this seems more accessible to us than something like the Bejeweled Blitz solver.
Continue reading “How to write your own Minesweeper solver”
Programmers don’t need to get good at a game to achieve a high score, they code a bot for that instead. Take [hypnotizd] for instance. He was learning to write in the C# language and decided to make a bot that plays Bejeweled Blitz on Facebook. He figures he took between 48 and 72 hours of coding over a couple of weeks, but remember, he was learning the language at the same time. We think you’d be hard pressed to achieve a 1.5 million range score by yourself, even with that amount of practice time.
We spoke with [hypnotizd] yesterday afternoon to get a bit of background on how he made this happen. His code (he’s not releasing it so you’ll have to write your own) scrapes the screen image as input. You can see at the beginning of the video after the break that he sizes his app to properly align each jewel in its grid. The program then identifies each game piece by finding the center of the cell and taking a 25 square-pixel average color. Many of the jewels are easily recognized in this first pass, but some are harder and require several different tests to identify. That’s the difficult part, choosing the best move is just a matter of coming up with your own rules on how the bot should play the game.
Continue reading “Bejeweled Blitz bot makes your high score look just sad”