This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"flag" | |
"fmt" | |
"os" | |
"os/exec" | |
"path/filepath" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keyboard Input Handling | |
Keyboards are used in two different ways: As a way to enter text or as an array of buttons each of which has a different function. An input API should therefore provide you two kinds of information: which text was entered and what buttons were pressed. | |
For text I would actually prefer a string, because the most common thing to do is to append it to some form of buffer. If the input API gave you an UTF-32 char, you would have to convert it into UTF-8 before appending it to the buffer. | |
For the other kind of information - what buttons are pressed - the API should give you a "key position id". Note that I am avoiding the words scan code or virtual key code. The "key position id" treats keys more like buttons and it totally ignores what label is on each key. One important difference between keyboards is that US keyboards have 104 keys, while European keyboards have 105 keys (I don't know about other parts of the world). This is a difference that would need to be encoded in the "key posi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
vector<string> split(const string& line) { | |
vector<string> result; | |
string::size_type i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- For anyone who liked the SCATTER PLOT VIEWER puzzle included in some of the early | |
-- access builds of TIS-100... | |
-- INSTALLATION: Copy everything in this file. Open TIS-100. Go to the SPECIFICATION | |
-- EDITOR. Click on IMPORT SPECIFICATION FROM CLIPBOARD. Done! | |
-- The function get_name() should return a single string that is the name of the puzzle. | |
-- | |
function get_name() | |
return "SCATTER PLOT VIEWER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- For anyone who liked the PRIME DETECTOR puzzle included in some of the early access | |
-- builds of TIS-100... | |
-- INSTALLATION: Copy everything in this file. Open TIS-100. Go to the SPECIFICATION | |
-- EDITOR. Click on IMPORT SPECIFICATION FROM CLIPBOARD. Done! | |
-- The function get_name() should return a single string that is the name of the puzzle. | |
-- | |
function get_name() | |
return "PRIME DETECTOR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int led[] = {4, 5, 6, 7}; | |
int taster[] = {8, 9, 10, 11}; | |
int zufallszahl[100] // Semikolon | |
int durchlauf = 0; | |
int tasterstatus[4] // Semikolon | |
void setup() | |
{ | |
for (int x = 0; x < 4; x++); // Das Semikolon trennt die Schleife von dem Codeblock | |
{ |