Initial Commit

This commit is contained in:
2022-10-07 00:22:46 -03:00
commit bdcf6d3e1c
465 changed files with 15466 additions and 0 deletions

8
Source Code/Assignment12/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Assignment12\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT" />
</component>
</project>

6
Source Code/Assignment12/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Assignment12.iml" filepath="$PROJECT_DIR$/Assignment12.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resource" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,13 @@
5
rrrcfieeeindtsndedogxceht
3
kcnanaehrduowahtrelilngaaxyttnipsivofct
7
mehnteeoumtaotpelunosisrcinmnozbozktageshsoeorlrpeowtnuo
4
xdutenkyeevnotomhooxxnyioweuoerymessngot
6
xnodithbonttchonyecneieejplmaompilro
2
aoerniewlltnroiryounfmawibeargadct
0

View File

@ -0,0 +1,73 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* Decodes encrypted text in a specific format
* @author Isaac Shoebottom (3429069)
*/
public class Decoder {
public static void main(String[] args) throws FileNotFoundException {
Scanner scanFile = new Scanner(new File(args[0]));
int cycleCount = 0;
scanFile.useDelimiter("\\A");
String in = scanFile.next();
String[] codes = in.split("\\r?\\n");
for (String i: codes) {
if (i.length() > 1) {
int columns = Integer.parseInt(codes[cycleCount * 2]);
int rows = codes[cycleCount * 2 + 1].length() / columns;
char[][] decode = new char[rows][columns];
char[] chars = i.toCharArray();
int charCounter = 0;
for (int k = 0; k < columns; k++) {
if (k % 2 != 0) {
for (int j = 0; j < rows; j++) {
decode[j][k] = chars[charCounter];
charCounter++;
}
}
else {
for (int j = rows - 1; j > -1; j--) {
decode[j][k] = chars[charCounter];
charCounter++;
}
}
}
charCounter = 0;
char[] decodedChar = new char[i.length()];
for (int j = 0; j < rows; j++) {
if (j % 2 == 0) {
for (int k = 0; k < columns; k++) {
decodedChar[charCounter] = decode[j][k];
charCounter++;
}
}
else {
for (int k = columns - 1; k > -1; k--) {
decodedChar[charCounter] = decode[j][k];
charCounter++;
}
}
}
cycleCount++;
String output = String.valueOf(decodedChar);
System.out.println(output);
}
else if (i.equals("0")) {
break;
}
}
}
}