MAINT: Apply pre-commit

Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
This commit is contained in:
Martin Thoma
2022-03-05 09:29:23 +01:00
parent f5e33ae38f
commit e64fb6795c
536 changed files with 6267 additions and 5556 deletions

View File

@@ -162,7 +162,7 @@ namespace banner
// numSections decides how many 'sections' need to be printed
// for a given line of each character
int[] numSections = new int[7];
// fillInSection decides whether each 'section' of the
// fillInSection decides whether each 'section' of the
// character gets filled in with the character or with blanks
int[] fillInSection = new int[9];

View File

@@ -11,21 +11,21 @@ import java.lang.Math;
* <p>
* Note: The idea was to create a version of the 1970's BASIC game in Java, without introducing
* new features - no additional text, error checking, etc has been added.
*
*
* Converted from BASIC to Java by Darren Cardenas.
*/
public class Banner {
public class Banner {
private final Scanner scan; // For user input
public Banner() {
scan = new Scanner(System.in);
} // End of constructor Banner
public void play() {
public Banner() {
scan = new Scanner(System.in);
} // End of constructor Banner
public void play() {
int bitIndex = 0;
int centerFlag = 0;
@@ -38,19 +38,19 @@ public class Banner {
int vertical = 0;
int vIndex = 0;
int writeIndex = 0;
int[] writerMap = new int[10];
int[] writeLimit = new int[10];
int[] writeLimit = new int[10];
String centerResponse = "";
String characters = "";
String letter = "";
String lineContent = "";
String lineContent = "";
String setPage = "";
String statement = "";
String token = ""; // Print token
Map<String, int[]> symbolData = new HashMap<String, int[]>();
Map<String, int[]> symbolData = new HashMap<String, int[]>();
symbolData.put(" ", new int[]{0,0,0,0,0,0,0,0 });
symbolData.put("A", new int[]{0,505,37,35,34,35,37,505 });
symbolData.put("G", new int[]{0,125,131,258,258,290,163,101});
@@ -92,133 +92,133 @@ public class Banner {
symbolData.put("=", new int[]{0,41,41,41,41,41,41,41 });
symbolData.put("!", new int[]{0,1,1,1,384,1,1,1 });
symbolData.put("0", new int[]{0,57,69,131,258,131,69,57 });
symbolData.put(".", new int[]{0,1,1,129,449,129,1,1 });
symbolData.put(".", new int[]{0,1,1,129,449,129,1,1 });
System.out.print("HORIZONTAL? ");
System.out.print("HORIZONTAL? ");
horizontal = Integer.parseInt(scan.nextLine());
System.out.print("VERTICAL? ");
vertical = Integer.parseInt(scan.nextLine());
System.out.print("CENTERED? ");
System.out.print("VERTICAL? ");
vertical = Integer.parseInt(scan.nextLine());
System.out.print("CENTERED? ");
centerResponse = scan.nextLine().toUpperCase();
centerFlag = 0;
// Lexicographical comparison
if (centerResponse.compareTo("P") > 0) {
centerFlag = 1;
centerFlag = 1;
}
System.out.print("CHARACTER (TYPE 'ALL' IF YOU WANT CHARACTER BEING PRINTED)? ");
System.out.print("CHARACTER (TYPE 'ALL' IF YOU WANT CHARACTER BEING PRINTED)? ");
characters = scan.nextLine().toUpperCase();
System.out.print("STATEMENT? ");
statement = scan.nextLine().toUpperCase();
// Initiates the print
System.out.print("SET PAGE? ");
setPage = scan.nextLine();
setPage = scan.nextLine();
// Begin loop through statement letters
for (letterIndex = 1; letterIndex <= statement.length(); letterIndex++) {
for (letterIndex = 1; letterIndex <= statement.length(); letterIndex++) {
// Extract a letter
letter = String.valueOf(statement.charAt(letterIndex - 1));
// Begin loop through all symbol data
for (String symbolString: symbolData.keySet()) {
// Begin loop through all symbol data
for (String symbolString: symbolData.keySet()) {
// Begin letter handling
if (letter.equals(" ")) {
for (index = 1; index <= (7 * horizontal); index++) {
if (letter.equals(" ")) {
for (index = 1; index <= (7 * horizontal); index++) {
System.out.println("");
}
}
break;
} else if (letter.equals(symbolString)) {
} else if (letter.equals(symbolString)) {
token = characters;
if (characters.equals("ALL")) {
if (characters.equals("ALL")) {
token = symbolString;
}
}
for (dataIndex = 1; dataIndex <= 7; dataIndex++) {
// Avoid overwriting symbol data
tempVal = symbolData.get(symbolString)[dataIndex];
for (bitIndex = 8; bitIndex >= 0; bitIndex--) {
if (Math.pow(2, bitIndex) < tempVal) {
writerMap[9 - bitIndex] = 1;
tempVal -= Math.pow(2, bitIndex);
if (tempVal == 1) {
writeLimit[dataIndex] = 9 - bitIndex;
if (tempVal == 1) {
writeLimit[dataIndex] = 9 - bitIndex;
break;
}
} else {
writerMap[9 - bitIndex] = 0;
writerMap[9 - bitIndex] = 0;
}
} // End of bitIndex loop
for (hIndex = 1; hIndex <= horizontal; hIndex++) {
// Add whitespace for centering
// Add whitespace for centering
lineContent = " ".repeat((int)((63 - 4.5 * vertical) * centerFlag / token.length()));
for (writeIndex = 1; writeIndex <= writeLimit[dataIndex]; writeIndex++) {
if (writerMap[writeIndex] == 0) {
for (vIndex = 1; vIndex <= vertical; vIndex++) {
for (index = 1; index <= token.length(); index++) {
lineContent += " ";
}
}
if (writerMap[writeIndex] == 0) {
for (vIndex = 1; vIndex <= vertical; vIndex++) {
for (index = 1; index <= token.length(); index++) {
lineContent += " ";
}
}
} else {
for (vIndex = 1; vIndex <= vertical; vIndex++) {
for (vIndex = 1; vIndex <= vertical; vIndex++) {
lineContent += token;
}
}
}
} // End of writeIndex loop
System.out.println(lineContent);
} // End of hIndex loop
} // End of hIndex loop
} // End of dataIndex loop
// Add padding between letters
for (index = 1; index <= 2 * horizontal; index++) {
for (index = 1; index <= 2 * horizontal; index++) {
System.out.println("");
}
} // End letter handling
} // End loop through all symbol data
} // End loop through statement letters
// Add extra length to the banner
for (index = 1; index <= 75; index++) {
for (index = 1; index <= 75; index++) {
System.out.println("");
}
}
} // End of method play
} // End of method play
public static void main(String[] args) {
Banner game = new Banner();
game.play();
} // End of method main
} // End of class Banner

View File

@@ -12,10 +12,10 @@ function input()
{
var input_element;
var input_str;
return new Promise(function (resolve) {
input_element = document.createElement("INPUT");
print("? ");
input_element.setAttribute("type", "text");
input_element.setAttribute("length", "50");
@@ -107,7 +107,7 @@ async function main()
as = await input();
print("SET PAGE"); // This means to prepare printer, just press Enter
os = await input();
for (t = 0; t < as.length; t++) {
ps = as.substr(t, 1);
for (o = 0; o < 50 * 8; o += 8) {
@@ -156,13 +156,13 @@ async function main()
str += xs;
}
}
print(str + "\n");
print(str + "\n");
}
}
for (h = 1; h <= 2 * x; h++)
for (h = 1; h <= 2 * x; h++)
print("\n");
}
}
}
}
main();

View File

@@ -77,8 +77,7 @@ def print_banner():
g1 = 0
if input("Centered ").lower().startswith("y"):
g1 = 1
mStr = input(
"Character (type 'ALL' if you want character being printed) ").upper()
mStr = input("Character (type 'ALL' if you want character being printed) ").upper()
aStr = input("Statement ")
# This means to prepare printer, just press Enter
oStr = input("Set page ")
@@ -92,11 +91,11 @@ def print_banner():
else:
for u in range(0, 7):
for k in range(8, -1, -1):
if 2 ** k >= s[u]:
if 2**k >= s[u]:
j[8 - k] = 0
else:
j[8 - k] = 1
s[u] = s[u] - 2 ** k
s[u] = s[u] - 2**k
if s[u] == 1:
f[u] = 8 - k
break

View File

@@ -146,7 +146,7 @@ Module Banner
' numSections decides how many 'sections' need to be printed
' for a given line of each character
Dim numSections(7) As Integer
' fillInSection decides whether each 'section' of the
' fillInSection decides whether each 'section' of the
' character gets filled in with the character Or with blanks
Dim fillInSection(9) As Integer