properly rename october 2013 mispell

This commit is contained in:
Xevion
2020-02-22 05:48:28 -06:00
parent 22ed622f05
commit f1529d4a14
103 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

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 (1)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</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$/12.iml" filepath="$PROJECT_DIR$/12.iml" />
</modules>
</component>
</project>

6
uil/aplus-october-2013/12/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View File

@@ -0,0 +1,332 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1fd89a9c-d895-4e45-acab-398cb78a9403" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/bin/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="1210997399">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="3" />
<entry key="project.open.time.4" value="1" />
<entry key="project.open.time.5" value="1" />
<entry key="project.open.time.6" value="1" />
<entry key="project.opened" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="dat" value="1" />
<entry key="java" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="JAVA" value="3" />
<entry key="PLAIN_TEXT" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="dat" value="127" />
<entry key="java" value="2680" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="2680" />
<entry key="PLAIN_TEXT" value="127" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/problem12.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="481">
<caret line="158" column="29" selection-start-line="158" selection-start-column="29" selection-end-line="158" selection-end-column="29" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>debug</find>
<find>offsets</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
</component>
<component name="GradleLocalSettings">
<option name="projectSyncType">
<map>
<entry key="A:/Programming/Modding/Minecraft/EnderStorage" value="PREVIEW" />
<entry key="A:/Programming/Modding/Minecraft/Fabric/fabric-example-mod" value="PREVIEW" />
<entry key="A:/Programming/Modding/Minecraft/HelloWorldMod" value="PREVIEW" />
</map>
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/input.dat" />
<option value="$PROJECT_DIR$/src/problem12.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="351" />
<option name="y" value="-16" />
<option name="width" value="974" />
<option name="height" value="1057" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="12" type="b2602c69:ProjectViewProjectNode" />
<item name="12" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="12" type="b2602c69:ProjectViewProjectNode" />
<item name="12" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="12" type="b2602c69:ProjectViewProjectNode" />
<item name="12" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="problem12.java" type="529ef68f:ClassesTreeStructureProvider$PsiClassOwnerTreeNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1569034632346" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../../exercism/java/hello-world" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="problem12" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="problem12" />
<module name="12" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.problem12" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="1fd89a9c-d895-4e45-acab-398cb78a9403" name="Default Changelist" comment="" />
<created>1568926083487</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1568926083487</updated>
</task>
<servers />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2553305" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
<window_info id="UI Designer" order="4" />
<window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.32939914" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39914164" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" weight="0.32939914" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.32939914" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Palette&#9;" order="6" />
<window_info anchor="right" id="Maven Projects" order="7" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/com/sun/xml/internal/ws/api/message/HeaderList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="112" column="13" selection-start-line="112" selection-start-column="13" selection-end-line="112" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/AdoptOpenJDK/jdk-8.0.212.04-hotspot/src.zip!/java/util/ArrayList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="442">
<caret line="444" column="13" selection-start-line="444" selection-start-column="13" selection-end-line="444" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/input.dat">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="8" lean-forward="true" selection-start-line="13" selection-start-column="8" selection-end-line="13" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/problem12.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="481">
<caret line="158" column="29" selection-start-line="158" selection-start-column="29" selection-end-line="158" selection-end-column="29" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8 (2)</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>12</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>11</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<projectDescription>
<name>12</name>
<comment/>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,11 @@
{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - problem12",
"request": "launch",
"mainClass": "problem12",
"projectName": "12"
}
]
}

View File

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

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -0,0 +1,17 @@
2
B B
B B B
B B B
B B
B B R
R R R R
R R R R
R R R
B B B B
B
B B B R
R
B
R R
R B R
R R R R

View File

@@ -0,0 +1,233 @@
import static java.lang.System.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Collection;
import java.util.Collections;
// Point representing and (X, Y) coordinate
class Point {
String type;
int x, y;
// Untyped Point Constructor
Point(int x, int y) {
this.x = x;
this.y = y;
this.type = "";
}
// Typed Point Constructor
Point(int x, int y, String type) {
this.x = x;
this.y = y;
this.type = type.equals(" ") ? "" : type;
}
// Returns a point which is the translated end-point based on the other point (offset).
Point merge(Point other) {
return new Point(this.x + other.x, this.y + other.y, this.type);
}
// Offsets the point by a Point's (x, y) set
void offset(Point other) {
this.x += other.x;
this.y += other.y;
}
// Point string representation
public String toString() {
return String.format(
"Point(\"%s\", %d, %d)",
(this.type.equals("") ? "?" : this.type),
this.x,
this.y
);
}
boolean isEmpty() {
return this.type.equals("");
}
// equals() method for testing equality of two Point() objects
// positional untyped equality test, see fullEquals()
private boolean equals(Point other) {
return this.x == other.x && this.y == other.y;
}
// tests equality of x, y and type
public boolean fullEquals(Point other) {
return this.equals(other) && this.type == other.type;
}
// Returns whether a point could be found in a collection
boolean collectionContains(Collection<Point> collection) {
for(Point other : collection) {
if(this.x == other.x && this.y == other.y) {
return true;
}
}
return false;
}
// Class method that searches a List
// Returns -1 if item not found in list
public int findPoint(List<Point> list) {
for(Point other : list) {
if(this.x == other.x && this.y == other.y)
return list.indexOf(other);
}
return -1;
}
// Creates a List of Points based on a primitive int[][] matrix
static List<Point> asList(int[][] primitivePoints) {
List<Point> points = new ArrayList<Point>();
for (int[] primPoint: primitivePoints) {
points.add(new Point(primPoint[0], primPoint[1]));
}
return points;
}
}
// Represents a checkers checkerboard
class CheckerBoard {
// Offsets
private List<Point> offsets = Point.asList(new int[][]{{-1, -1}, {1, -1}, {1, 1}, {-1, 1}});
private Point[][] matrix;
// Team Constants, Team1 is default team.
private String team1 = "R";
private String team2 = "B";
CheckerBoard(String[][] matrix) {
// Build the point matrix
this.matrix = new Point[8][8];
for(int x = 0; x < matrix.length; x++) {
for(int y = 0; y < matrix[x].length; y++) {
this.matrix[x][y] = new Point(x, y, matrix[x][y]);
}
}
}
// toString method for a Checkerboard, prints a matrix of types
public String toString() {
String[] result = new String[this.matrix.length];
for(int x = 0; x < this.matrix.length; x++) {
String[] temp = new String[this.matrix[x].length];
for(int y = 0; y < this.matrix[x].length; y++) {
temp[y] = this.matrix[x][y].type.equals("") ? " " : this.matrix[x][y].type; }
result[x] = String.join(" - ", temp);
}
return String.join("\n", result);
}
// Simple functions for identifying whether a point is inBounds.
private static boolean inBounds(Point point) {return CheckerBoard.inBounds(point.x, point.y);}
private static boolean inBounds(int x, int y) {return x >= 0 && y >= 0 && x < 8 && y < 8;}
// Simple internal getter functions
private Point getPoint(Point point) {return this.matrix[point.x][point.y];}
String getType(Point point) {return this.matrix[point.x][point.y].type;}
// Identifies whether two points are opposite in types. R(ed) != B(lack)
private boolean isReverse(Point first, Point second) {return (first.type.equals(team1) && second.type.equals(team2)) || (first.type.equals(team2) && second.type.equals(team1));}
// Just returns all Points with type designated
private List<Point> getCheckers(String type) {
List<Point> found = new ArrayList<Point>();
for (Point[] aMatrix : this.matrix) {
for(Point anAMatrix : aMatrix) {
if(anAMatrix.type.equals(type))
found.add(anAMatrix);
}
}
return found;
}
// Starter function for finding max jumps at a point.
private int getMaxJumps(Point point) {
List<Point> previous = new ArrayList<Point>();
previous.add(point);
return getMaxJumps(point, 0, previous);
}
// Recursively finds maximum possible jumps at a point.
private int getMaxJumps(Point point, int score, List<Point> previous) {
List<Integer> offsetScores = new ArrayList<Integer>();
offsetScores.add(score);
for(Point offset : this.offsets) {
if(offset.x == 1)
continue;
Point newPoint = point.merge(offset);
// Ensure new point is in matrix bounds
if(CheckerBoard.inBounds(newPoint)) {
// Ensure new point is of reverse type
Point realPoint = this.getPoint(newPoint);
if(this.isReverse(point, realPoint)) {
newPoint.offset(offset);
// Ensure second new point is inBounds & Empty
if(CheckerBoard.inBounds(newPoint)) {
if(this.getPoint(newPoint).isEmpty()) {
if(!newPoint.collectionContains(previous)) {
// add new point to blacklist, ensuring we don't get a infinite recursive nightmare
previous.add(new Point(newPoint.x, newPoint.y));
// will return at least 1
offsetScores.add(getMaxJumps(newPoint, score + 1, previous));
}
}
}
}
}
}
return Collections.max(offsetScores);
}
// Scanning methods for best jumps
public String scan() {return this.scan(this.team1);} // default to Red checkers
public String scan(String team) {
List<Point> entries = getCheckers(team);
List<Integer> jumps = new ArrayList<Integer>();
// Scan each entry point for jumps
for(Point entry : entries) {
jumps.add(getMaxJumps(entry));
}
// Find the best origin jump and it's score
Point bestpoint = new Point(-1, -1);
int bestscore = 0;
for(int i = 0; i < entries.size(); i++) {
if(bestscore < jumps.get(i)) {
bestscore = jumps.get(i);
bestpoint = entries.get(i);
}
}
return String.format("%s %s %s", bestpoint.x, bestpoint.y, bestscore);
}
}
class problem12 {
public static void main(String[] args) throws FileNotFoundException {
// Constants
File input = new File("input.dat");
Scanner read = new Scanner(input);
int lines = Integer.parseInt(read.nextLine());
// Start reading and processing the matrix into
for(int i = 0; i < lines; i++) {
String[][] rawMatrix = new String[8][8];
for(int x = 0; x < 8; x++) {
String line = read.nextLine();
for(int y = 0; y < 8; y++)
rawMatrix[x][y] = line.substring(y, y+1);
}
CheckerBoard cb = new CheckerBoard(rawMatrix);
out.println(cb);
out.println(cb.scan());
}
read.close();
}
}