Shenzhen I/O: Personal Sandwich Maker

Shenzhen I/O: Personal Sandwich Maker

Yeah, this time we are going to make a personal sandwich maker. What could possibly go wrong when making food? Nothing right! This one took me a while to crack, or rather it was fairly easy to make solution. But it took me quite a few tries to make a good one.

The sandwich maker print board have an xbus input where it gets a number from 1 to 3 which is three different modes

  1. Normal sandwich
  2. Hold the cheese
  3. Extra mustard

Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments
Shenzhen I/O: Token-Based Payment Kiosk

Shenzhen I/O: Token-Based Payment Kiosk

You are into history or at least history reenactment? That is what this puzzle is about, but apparently we are to make a Token-based payment kiosk…. just like they had in the good old days. Let us not fight over historical details, but let us take a look at this fun problem.

Oh and just a side note, by this time in the game we finally got the gen instruction. So now we can use it without problem.

The overall machine takes in a price as well as three simple inputs signifying three coin types of 1, 5 and 12 in value. We are then going to keep accepting coins until the price is reached. After which we must ring a bell for 4 seconds as well as give back change in 5 and 1 with the least possible coins.  Continue reading →

Posted by Kristian in Shenzhen IO, 3 comments
Shenzhen I/O: Unknown Optimization Device

Shenzhen I/O: Unknown Optimization Device

Poseidon-779 a Decentralized Autonomous Corporation has decided that we need to help them go into Thorium mining. And while I wont steer off a tangent telling you about Thorium reactors, although they are pretty cool, we should just make this unknown optimization device also known as 2A27.

We get two simple inputs x and y and have to deliver a simple output with a given value. That means we at least have to use 2 micro controllers. So we should not be able to make a solution for less than 6¥. Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments

Shenzhen I/O: Color-Changing Vape Pen

Welcome back to china and our electronic building company. This time we got a contract with Cool Dad to make a color-changing vape pen – or rather millions for all his fans, so let’s see how we can implement that.

The specs here says that we will get a packet over radio which is either -999 which means that we should just sleep or it is four values with the meaning red, green, blue, duration. Which means the intensity of the 3 colors and the duration to hold it.

It also says that if we get a new instruction while we are currently running, we should override it. However, it only happens in the test set if the duration is 999. Otherwise it seems to run out. Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments
Shenzhen I/O – Laser Tag Equipment

Shenzhen I/O – Laser Tag Equipment

I did not know that our company made weapons. But I guess as long as it is laser tag equipment it should be okay. This is in my opinion the hardest problem so far. We are asked to make a computer to control the equipment for a game of laser tag. And there are quite a few rules we need to take into consideration. Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments
HackerRank: Between Two Sets in Python

HackerRank: Between Two Sets in Python

I found another really interesting problem on HackerRank called Between Two Sets. It is interesting because there was some math to be applied to the problem. The problem is a part of the implementation series on algorithms. The problem description is

Consider two sets of positive integers,  and . We say that a positive integer, x, is between sets A and B if the following conditions are satisfied:

  1. All elements in A are factors of x.
  2. x is a factor of all elements in B.

In other words, some x is between A and B if that value of x satisfies  for every  in A and also satisfies  for every  in B. For example, if  and  , then our possible x values are 6 and 12.

Given A and B, find and print the number of integers (i.e., possible x‘s) that are between the two sets.

There are some constraints given to the between two sets.  These constraints mean that it will be possible to make a bruteforce solution.  We could test every number between 1 and 100 to see if they satisfy the condition for all numbers in both A and B. However, we can also look at a little bit of math to find some properties of the numbers we are testing. Continue reading →

Posted by Kristian in HackerRank, 0 comments
Shenzhen I/O – Wireless Game Controller

Shenzhen I/O – Wireless Game Controller

Every hotel in Japan wants it only gaming console. And guess who is to make the wireless game controller for that! We are of course. The challenge here is to listen to the radio, and if there is a signal that we should send a reading back on the radio. We should read the two analogue joysticks (x and y) and send each value back as well as a value for the combination of a & b input 1 if a is active, 2 if b is active and 3 if both are active. Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments
Shenzhen I/O – Virtual Reality Buzzer

Shenzhen I/O – Virtual Reality Buzzer

VR is the next big thing, everyone agrees to that. And so does the employees in Shenzhen Longteng Electronics Company Ltd.. But once you are emerged you don’t notice if someone sneaks up on you. Therefore David really wants us to make a small buzzer for him that he can strap to his VR goggles to notify him if there is someone approaching him – aptly named the virtual reality buzzer.

We get readings from a non-blocking xbus port on a radio. If that is one then we should start the buzzer generating pulses of 1 width. If it is zero we should stop the buzzer again. And so on. If the reading is -999 we should just continue what we are doing. This results in the following verification signals.

Shenzhen IO - Virtual Reality Buzzer - signals Continue reading →

Posted by Kristian in Shenzhen IO, 0 comments
HackerRank: Kangaroo

HackerRank: Kangaroo

Everybody loves a kangaroo right? Except maybe if you are Australian! Anyway in this post we shall talk both about snakes and mammals, or more specific Python and Kangaroos. I have started on learning a bit of Python and using HackerRank to learn my ways around. I have been solving a few puzzles by now.  The ones I have solved so far, are no where near the complexity of Project Euler. Apart from the fact that quite a few of the project euler problems are actually represented at HackerRank, but with more test cases, so you have to write the code a little more generically. But more about that later, because I will likely solve a few of the Project Euler problems in Python while learning it.

Anyway, the first problem I solved, which might be worth spending a minute or two about, is the problem called Kangaroo.

The short description of the problem is as follows

There are two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location x1 and moves at a rate of v1 meters per jump. The second kangaroo starts at location x2 and moves at a rate of v2 meters per jump. Given the starting locations and movement rates for each kangaroo, can you determine if they’ll ever land at the same location at the same time?

Input Format
A single line of four space-separated integers denoting the respective values of x1, v1, x2 and v2

Note: The two kangaroos must land at the same location after making the same number of jumps.

Continue reading →

Posted by Kristian in HackerRank, 0 comments
Shenzhen I/O – Passive Infrared Sensor

Shenzhen I/O – Passive Infrared Sensor

I think we are at problem number 7 in Shezhen I/O where we are asked to help a security company design a passive infrared sensor that will trigger an alarm between a given time interval, if there is too much activity. We are given a problem where were have the a simple sensor input and a simple alarm output. We also have a simple input giving us time. Further more we have 2 xbus inputs giving us the on and off times. The problem description is simple enough, if the timer is between the on and off time (loop) and the sensor reading is 20 or higher we should trigger the alarm. Just like the signals here tells us

Shenzhen IO - Passive Infrared Sensor - signals Continue reading →

Posted by Kristian in Shenzhen IO, 1 comment
This site uses cookies.