Course | Introduction of Computer Science |
---|---|
Github Repo | https://github.com/pyshen-watson/QR-Code-Generator |
Author | 沈韋辰、黃義峰 |
Environment | Windows 10 |
Language | C |
Introduction
This program can turn a string (1~17 characters) into a QR code.
How to run
Method 1
Run the executable file directly.
Method 2
- Follow this video to install MinGW.
- Set the environment variable correctly.
- Use the command
mingw32-make
to compile the source code. - Execute
generator.exe
.
Note
- This program can only run on Windows due to the dependency
windows.h
.
Report
1 Motivation
In the first half of the lecture, we learned many knowledge about Boolean algebra and logic. So, I thought QR code is one of the most practical and iconic applications of Boolean algebra, especially it’s just formed by black and white blocks but can be used in modern life every day.
Nowadays, almost every smartphone has the scanner to scan these white-and-black blocks. However, few users know how the patterns produced and the facts behind them. Hence, we decide to dig into its secret, and try to make one by ourselves.
2 Method
Creating a new QR code includes 4 steps: encode the context, turn them into pattern, mask the pattern, and add the other information such as location point or other formatting information.
3 Challenge
3.1 The pattern scale
QR code has different scale from version1 (21×21) to version40 (177×177). Larger scale makes the QR code be able to store more information, but the algorithm will also more complicated. Consider to our coding ability and time limitation, we decided to make the simplest one (version1). In our experiment, version 1 can only store 17 characters, scanning fails when it up to 18 characters.
3.2 The error correction
There is a sequence of numbers in the QR code called “error correction”, which can ensure the correctness when a part of QR code is damaged. However, this sequence includes many difficult algorithms, it took us much time to understand how it work and how to calculate its value.
3.3 Turn into pattern
In this semester, we learned how to program by C language and produce graph by hack. However, we didn’t know how to produce graph by C. So, it also took us much time to learn this skill. Thankfully, we finally find a library called “window.h”, though, it can’t work in any OS except Windows. It’s still a big milestone that we finally finished our first colorful programming.
4 Reflection
All in all, we learned so many new knowledge of programming. Hope this experience will be helpful when we learning programs with GUI in the future.