id
stringlengths
36
36
text
stringlengths
1
1.25M
bff23120-1437-4426-8ec8-d9e68558ce4c
public F5Random(final byte[] password) { this.random = new SecureRandom(); this.random.engineSetSeed(password); this.b = new byte[1]; }
6ee8891c-0fe4-4765-a328-8d00135cd3f6
public int getNextByte() { this.random.engineNextBytes(this.b); return this.b[0]; }
72f18085-5fd4-4be2-997c-a160cfc4a07f
public int getNextValue(final int maxValue) { int retVal = getNextByte() | getNextByte() << 8 | getNextByte() << 16 | getNextByte() << 24; retVal %= maxValue; if (retVal < 0) { retVal += maxValue; } return retVal; }
fe35d381-c6c5-43ad-b5d2-072e71e9a31c
public static void main(final String args[]) { Image image = null; FileOutputStream dataOut = null; File file, outFile; JpegEncoder jpg; int i, Quality = 80; // Check to see if the input file name has one of the extensions: // .tif, .gif, .jpg // If not, p...
28a43e58-2e56-40f0-b828-822f754265c3
public static void StandardUsage() { System.out.println("F5/JpegEncoder for Java(tm)"); System.out.println(""); System.out.println("Program usage: java Embed [Options] \"InputImage\".\"ext\" [\"OutputFile\"[.jpg]]"); System.out.println(""); System.out.println("You have the follow...
c1c741cd-9443-493d-83b8-72beb3d06acb
public static void extract(final InputStream fis, final int flength, final OutputStream fos, final String password) throws IOException { carrier = new byte[flength]; fis.read(carrier); final HuffmanDecode hd = new HuffmanDecode(carrier); System.out.println("Huffman decoding s...
56af0078-df10-4f31-9470-5ba0970d0099
public static void main(final String[] args) { embFileName = "output.txt"; password = "abc123"; try { if (args.length < 1) { usage(); return; } for (int i = 0; i < args.length; i++) { if (!args[i].startsWith("-")...
83326d00-c5df-479f-912f-c007eb3216eb
static void usage() { System.out.println("java Extract [Options] \"image.jpg\""); System.out.println("Options:"); System.out.println("\t-p password (default: abc123)"); System.out.println("\t-e extractedFileName (default: output.txt)"); System.out.println("\nAuthor: Andreas Westf...
56320b3a-ca4b-4297-baa9-bd3dee0c232a
public Bmp(final String fileName) { try { this.imageFile = new BufferedInputStream(new FileInputStream(fileName)); readBitmapFileHeader(); readBitmapInfoHeader(); this.pixel = new int[this.biWidth * this.biHeight]; int padding = 3 * this.biWidth % 4; ...
3816fefd-7f1a-4a7d-8639-36a6e4750767
public Image getImage() { MemoryImageSource mis; mis = new MemoryImageSource(this.biWidth, this.biHeight, this.pixel, 0, this.biWidth); return Toolkit.getDefaultToolkit().createImage(mis); }
6553a1b0-5ce8-4ce9-8e11-807cd4ab29ef
void readBitmapFileHeader() throws Exception { if (this.imageFile.read() != 'B') throw new Exception(); if (this.imageFile.read() != 'M') throw new Exception(); this.bfSize = readInt(); readInt(); // ignore 4 bytes reserved this.bfOffBits = readInt(); ...
b519ae43-d207-47de-88d5-4e30f76ba192
void readBitmapInfoHeader() throws Exception { this.biSize = readInt(); this.biWidth = readInt(); this.biHeight = readInt(); this.biPlanes = readShort(); this.biBitCount = readShort(); if (this.biBitCount != 24) throw new Exception(); this.biCompressio...
2342ca39-a460-4c54-ac27-162958d33158
int readInt() throws IOException { int retVal = 0; for (int i = 0; i < 4; i++) { retVal += (this.imageFile.read() & 0xff) << 8 * i; } return retVal; }
7ea7f77b-2760-485f-bc17-ea2e6db696cf
int readPixel() throws IOException { int retVal = 0; for (int i = 0; i < 3; i++) { retVal += (this.imageFile.read() & 0xff) << 8 * i; } return retVal | 0xff000000; }
fddf42a8-35f3-4714-8fe9-ec3f5ea56b31
int readShort() throws IOException { int retVal; retVal = this.imageFile.read() & 0xff; retVal += (this.imageFile.read() & 0xff) << 8; return retVal; }
429a165f-902a-44f5-93b9-b906e01f85d9
public static void main(final String args[]) { Image image = null; FileOutputStream dataOut = null; File file, outFile; JpegEncoder jpg; String string = new String(); int i, Quality = 80; if (args.length < 2) { StandardUsage(); } if (!a...
2fdadd21-8dbf-4454-9697-ca276a45074f
public static void StandardUsage() { System.out.println("JpegEncoder for Java(tm) Version 0.9"); System.out.println(""); System.out.println("Program usage: java Jpeg \"InputImage\".\"ext\" Quality [\"OutputFile\"[.jpg]]"); System.out.println(""); System.out.println("Where \"Input...
863302fd-eac7-48eb-a69e-2d092da4a242
public DCT(final int QUALITY) { initMatrix(QUALITY); }
d01734c4-1bb6-4e16-bb16-28a706c6a4ad
public double[][] forwardDCT(final float input[][]) { final double output[][] = new double[this.N][this.N]; double tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; double tmp10, tmp11, tmp12, tmp13; double z1, z2, z3, z4, z5, z11, z13; int i; int j; // Subtracts 1...
872afcca-7220-4d3e-b4c9-acebcbc93888
public double[][] forwardDCTExtreme(final float input[][]) { final double output[][] = new double[this.N][this.N]; final double tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; final double tmp10, tmp11, tmp12, tmp13; final double z1, z2, z3, z4, z5, z11, z13; final int i; ...
b1445843-6664-4a15-b817-3b0831fff6c3
private void initMatrix(final int quality) { final double[] AANscaleFactor = { 1.0, 1.387039845, 1.306562965, 1.175875602, 1.0, 0.785694958, 0.541196100, 0.275899379 }; int i; int j; int index; int Quality; int temp; // converting quality setting ...
a9cb057b-f0a3-451f-aa60-66ef04de5ca8
public int[] quantizeBlock(final double inputData[][], final int code) { final int outputData[] = new int[this.N * this.N]; int i, j; int index; index = 0; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { // The second line results in significantly ...
69fad664-035f-4089-bac1-a2535a352167
public int[] quantizeBlockExtreme(final double inputData[][], final int code) { final int outputData[] = new int[this.N * this.N]; int i, j; int index; index = 0; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { outputData[index] = (int) Math.round(...
4a1692a8-5446-4ebc-8e2d-4115dc486b50
public Huffman(final int Width, final int Height) { this.bits = new Vector<int[]>(); this.bits.addElement(this.bitsDCluminance); this.bits.addElement(this.bitsACluminance); this.bits.addElement(this.bitsDCchrominance); this.bits.addElement(this.bitsACchrominance); this.v...
b71e7b05-4fd5-4e10-aea6-31d1298d85dc
void bufferIt(final BufferedOutputStream outStream, final int code, final int size) { int PutBuffer = code; int PutBits = this.bufferPutBits; PutBuffer &= (1 << size) - 1; PutBits += size; PutBuffer <<= 24 - PutBits; PutBuffer |= this.bufferPutBuffer; while (Put...
b8c110dd-a700-4e98-8878-93c90c1b1bfc
void flushBuffer(final BufferedOutputStream outStream) { int PutBuffer = this.bufferPutBuffer; int PutBits = this.bufferPutBits; while (PutBits >= 8) { final int c = PutBuffer >> 16 & 0xFF; try { outStream.write(c); } catch (final IOException e...
1a07ddcb-fbbf-4c9d-a4a0-2ca7f45b055a
public void HuffmanBlockEncoder(final BufferedOutputStream outStream, final int zigzag[], final int prec, final int DCcode, final int ACcode) { int temp, temp2, nbits, k, r, i; this.NumOfDCTables = 2; this.NumOfACTables = 2; // The DC portion temp = temp2 = zigzag[...
f13958bd-4dd7-45b5-b616-51e848629d8d
public void initHuf() { this.DC_matrix0 = new int[12][2]; this.DC_matrix1 = new int[12][2]; this.AC_matrix0 = new int[255][2]; this.AC_matrix1 = new int[255][2]; this.DC_matrix = new Object[2]; this.AC_matrix = new Object[2]; int p, l, i, lastp, si, code; ...
d1ace73b-480f-4236-a4da-b5d441174098
public JpegEncoder(final Image image, final int quality, final OutputStream out, final String comment) { final MediaTracker tracker = new MediaTracker(this); tracker.addImage(image, 0); try { tracker.waitForID(0); } catch (final InterruptedException e) { // Got to...
4746d860-89ba-4d29-b198-35a7e3e5d395
public void Compress() { WriteHeaders(this.outStream); WriteCompressedData(this.outStream); WriteEOI(this.outStream); try { this.outStream.flush(); } catch (final IOException e) { System.out.println("IO Error: " + e.getMessage()); } }
25ddb771-42fa-497c-bd18-eae1c9f861ab
public void Compress(final InputStream embeddedData, final String password) { this.embeddedData = embeddedData; this.password = password; Compress(); }
0af70c28-5b7c-40fd-b21f-2320c8c866e1
public int getQuality() { return this.Quality; }
3f93bbf0-d3e7-4da0-b9bb-4d25e8dc8ecc
public void setQuality(final int quality) { this.dct = new DCT(quality); }
978982cc-fea1-4918-91dd-8773d69b15bb
void WriteArray(final byte[] data, final BufferedOutputStream out) { final int i; int length; try { length = ((data[2] & 0xFF) << 8) + (data[3] & 0xFF) + 2; out.write(data, 0, length); } catch (final IOException e) { System.out.println("IO Error: " + e...
d3d665d1-1178-4150-a14b-b16fb2922b3c
public void WriteCompressedData(final BufferedOutputStream outStream) { final int offset; int i, j, r, c, a, b; final int temp = 0; int comp, xpos, ypos, xblockoffset, yblockoffset; float inputArray[][]; final float dctArray1[][] = new float[8][8]; double dctArray...
ef258749-e7bb-418c-8654-a5bc906286b9
public void WriteEOI(final BufferedOutputStream out) { final byte[] EOI = { (byte) 0xFF, (byte) 0xD9 }; WriteMarker(EOI, out); }
b968e9d6-5d15-4d1f-86ff-f30093197c7d
public void WriteHeaders(final BufferedOutputStream out) { int i, j, index, offset, length; int tempArray[]; // the SOI marker final byte[] SOI = { (byte) 0xFF, (byte) 0xD8 }; WriteMarker(SOI, out); // The order of the following headers is quiet inconseq...
22da2a07-d5d6-4aea-b4a1-5edc5cf623ec
void WriteMarker(final byte[] data, final BufferedOutputStream out) { try { out.write(data, 0, 2); } catch (final IOException e) { System.out.println("IO Error: " + e.getMessage()); } }
8b40d90e-9a77-496b-a9bf-f1c6eabd4157
public JpegInfo(final Image image, final String comment) { this.Components = new Object[this.NumberOfComponents]; this.compWidth = new int[this.NumberOfComponents]; this.compHeight = new int[this.NumberOfComponents]; this.BlockWidth = new int[this.NumberOfComponents]; this.BlockH...
73bc25c0-5f5e-4c8a-93f9-f484e3e28ebf
float[][] DownSample(final float[][] C, final int comp) { int inrow, incol; int outrow, outcol; float output[][]; float temp; int bias; inrow = 0; incol = 0; output = new float[this.compHeight[comp]][this.compWidth[comp]]; for (outrow = 0; outrow <...
584296fa-7fde-43bd-8f3e-6f3d181464ac
public String getComment() { return this.Comment; }
7f538fe5-5e9a-44fa-8921-86209ef77009
private void getYCCArray() { final int values[] = new int[this.imageWidth * this.imageHeight]; int r, g, b, y, x; // In order to minimize the chance that grabPixels will throw an // exception // it may be necessary to grab some pixels every few scanlines and // process ...
d68f3845-8b3c-40c8-8eac-372f3231c43c
public void setComment(final String comment) { this.Comment.concat(comment); }
387f5260-beaf-4e07-a12f-4d2b8203ebad
public HuffTable(final DataInputStream d, final int l) { this.dis = d; // System.out.println("L�nge="+l); // Get table data from input stream this.Ln = 19 + getTableData(); // System.out.println(Ln); Generate_size_table(); // Flow Chart C.1 Generate_code_table(); ...
734b81eb-89d7-4816-a9cf-7ffc994c0d42
private void Decoder_tables() { // Decoder table generation Flow Chart F.15 this.I = 0; this.J = 0; while (true) { if (++this.I > 16) return; if (this.BITS[this.I] == 0) { this.MAXCODE[this.I] = -1; } else { ...
7000892d-41d7-462f-aa79-459015792503
private void Generate_code_table() { // Generate Code table Flow Chart C.2 this.K = 0; this.CODE = 0; this.SI = this.HUFFSIZE[0]; while (true) { this.HUFFCODE[this.K++] = this.CODE++; if (this.HUFFSIZE[this.K] == this.SI) { continue; ...
9dbb81c8-6204-4348-a825-4a9825f14448
private void Generate_size_table() { // Generate HUFFSIZE table Flow Chart C.1 this.K = 0; this.I = 1; this.J = 1; while (true) { if (this.J > this.BITS[this.I]) { this.J = 1; this.I++; if (this.I > 16) { ...
bbbe4c2f-800e-4e84-b094-bfe34a727437
private int getByte() { try { return this.dis.readUnsignedByte(); } catch (final IOException e) { return -1; } }
8ad1480d-0472-4282-9eaa-c3528a984e73
public int[] getHUFFVAL() { return this.HUFFVAL; }
acd6f4e5-029e-4ae0-b627-35d323ba786b
public int getLen() { return this.Ln; }
c9072728-59e1-4e67-b006-84d1dfbcbefb
public int[] getMAXCODE() { return this.MAXCODE; }
e6f26f63-a126-4c59-9178-8d8dcd96cab2
public int[] getMINCODE() { return this.MINCODE; }
d10b8d4b-e3b9-49c7-a524-e72aa7a00567
private int getTableData() { // Get BITS list int count = 0; for (int x = 1; x < 17; x++) { this.BITS[x] = getByte(); count += this.BITS[x]; } // Read in HUFFVAL for (int x = 0; x < count; x++) { // System.out.println(Ln); ...
d90cb175-87bd-471c-91e1-0a3647187f4f
public int[] getVALPTR() { return this.VALPTR; }
15c62df2-10f4-4624-bdc8-442b89db1c2c
private void Order_codes() { // Order Codes Flow Chart C.3 this.K = 0; while (true) { this.I = this.HUFFVAL[this.K]; this.EHUFCO[this.I] = this.HUFFCODE[this.K]; this.EHUFSI[this.I] = this.HUFFSIZE[this.K++]; if (this.K >= this.LASTK) { ...
25562a54-6de7-40f0-91ed-4f91d17937ac
public HuffmanDecode(final byte[] data) { this.size = (short) data.length; this.dis = new DataInputStream(new ByteArrayInputStream(data)); // Parse out markers and header info boolean cont = true; while (cont) { if (255 == getByte()) { switch (getByte(...
9cb1eb49-12b6-46a6-be48-121d0cfccfaa
private int available() { try { return this.dis.available(); } catch (final IOException e) { e.printStackTrace(); } return 0; }
2e317739-f88f-41fd-ae77-2f46b7758526
private void closeStream() { // Close input stream try { this.dis.close(); // close io stream to file } catch (final IOException e) { } }
248a4e63-699b-473a-887a-f8e07fcdfb80
public int[] decode() { final int x, y, a, b, line;// , sz = X * Y; int /* col, */tmp; final int blocks, MCU;// , scan=0; int[] Cs, Ta, Td; final int[] PRED = new int[this.Nf]; for (int nComponent = 0; nComponent < this.Nf; nComponent++) { PRED[nComponent] = 0...
7548a894-b73a-47ac-87bc-79c6c1fe45c8
private int DECODE() { int I, CD, VALUE; CD = NextBit(); I = 1; while (true) { // System.out.println(hftbl+" "+I); if (CD > this.MAXCODE[this.hftbl][I]) { CD = (CD << 1) + NextBit(); I++; } else { break...
b40a2205-6b6e-4f4e-8e1f-ef4ba7dd5d8a
private void Decode_AC_coefficients() { this.K = 1; // Zero out array ZZ[] for (this.lp = 1; this.lp < 64; this.lp++) { this.ZZ[this.lp] = 0; } while (true) { // System.out.println(hftbl); this.RS = DECODE(); this.SSSS = this.RS %...
41eecc02-44e8-4346-9847-3742ac84a4ae
private void Decode_ZZ(final int k) { // Decoding a nonzero AC coefficient this.ZZ[k] = RECEIVE(this.SSSS); this.ZZ[k] = EXTEND(this.ZZ[k], this.SSSS); }
b4c86261-68e6-47de-80b5-4d350bbb53df
private void dht() { // Read in Huffman tables // System.out.println("Read in Huffman tables"); // Lh length // Th index // Tc AC? this.Lh = getInt(); while (this.Lh > 0) { this.Tc = getByte(); this.Th = this.Tc & 0x0f; this.Tc ...
114d0347-a5ff-40bf-b86a-09121d1bb472
private void dqt() { // Read in quatization tables this.Lq = getInt(); this.Pq = getByte(); this.Tq = this.Pq & 0x0f; this.Pq >>= 4; switch (this.Tq) { case 0: for (this.lp = 0; this.lp < 64; this.lp++) { this.QNT[0][this.lp] = getByt...
1152e1d8-7c09-4e1d-b9f0-2019eff1ec66
private void dri() { getInt(); this.RI = getInt(); }
4be9da4e-2cc7-474e-8d4f-addc3c4d6db5
private int EXTEND(int V, final int T) { int Vt; Vt = 0x01 << T - 1; if (V < Vt) { Vt = (-1 << T) + 1; V += Vt; } return V; }
1f711a74-aa4f-4d19-a7d9-bb528cfcc29e
public int getBlockCount() { switch (this.Nf) { case 1: return (this.X + 7) / 8 * ((this.Y + 7) / 8); case 3: return 6 * ((this.X + 15) / 16) * ((this.Y + 15) / 16); default: System.out.println("Nf weder 1 noch 3"); } return 0; }
d1d366dc-6633-46e4-9c0d-39fc4631f763
public int getByte() { int b = 0; // Read Byte from DataInputStream try { b = this.dis.readUnsignedByte(); } catch (final IOException e) { e.printStackTrace(); } return b; }
4cb633f3-f9f2-43de-8046-db97f6bee247
public int getComp() { return this.Nf; }
f39a5bb3-3dfd-4a72-ba82-bae1cab7bb30
public int getInt() { int b = 0; // Read Integer from DataInputStream try { b = this.dis.readUnsignedByte(); b <<= 8; final int tmp = this.dis.readUnsignedByte(); b ^= tmp; } catch (final IOException e) { e.printStackTrace(); ...
abb60e50-2716-4c10-b2c1-2c1dde2b400b
public int getPrec() { return this.P; }
93be85d2-0202-4ec8-aa0e-4179820b5840
public int getX() { return this.X; }
f9c024e4-2103-438c-8a44-c0282103b585
public int getY() { return this.Y; }
53392ce2-8056-4b80-bf5b-33a43e735ef5
public void HuffDecode(final int[][][] buffer) { int x, y, tmp; final int sz = this.X * this.Y, scan = 0; final int[][] Block = new int[8][8]; int Cs, Ta, Td, blocks; final long t; final double time; // Read in Scan Header information this.Ls = getInt(); ...
3d929adc-c4d1-4c8e-970d-55534ab8c425
private int NextBit() { // Get one bit from entropy coded data stream int b2; final int lns; int BIT; if (this.CNT == 0) { this.CNT = 8; this.B = getByte(); if (255 == this.B) { b2 = getByte(); } } B...
f26b8968-a627-4063-8b81-d8ea0adf0340
public void rawDecode(final int[][][] buffer) { int x, y, tmp; final int[][] Block = new int[8][8]; int Cs, Ta, Td, blocks; final long t; final double time; // Read in Scan Header information this.Ls = getInt(); this.Ns = getByte(); Cs = getByte()...
3c8f7714-c5fe-4ff9-aa0e-183efde04461
private int RECEIVE(final int SSS) { int V = 0, I = 0; while (true) { if (I == SSS) return V; I++; V = (V << 1) + NextBit(); } }
cd5b3546-1c8a-40dd-b442-2f5ff97a1886
public void RGBdecode(final int[][][] Lum) { int x, y, a, b, line, col, tmp; final int sz = this.X * this.Y; int blocks; final int MCU, scan = 0; final int[][] Block = new int[8][8]; int[] Cs, Ta, Td; final int[] PRED = { 0, 0, 0 }; final l...
8042ee07-c306-4dcf-bed2-261644af6b60
public void setCb(final int[][][] chrome) { this.Cb = chrome; }
d0e0fb34-3b48-4adf-a758-fd8e5fe746b4
public void setCr(final int[][][] chrome) { this.Cr = chrome; }
181af218-74e7-4dbb-a215-9fbe93d67d8c
private void skipVariable() { try { this.dis.skipBytes(getInt() - 2); } catch (final IOException e) { e.printStackTrace(); } }
51658e2a-49be-448c-8230-b9e9e0277366
private void sof0() { // Read in start of frame header data this.Lf = getInt(); this.P = getByte(); this.Y = getInt(); this.X = getInt(); this.Nf = getByte(); this.C = new int[this.Nf]; this.H = new int[this.Nf]; this.V = new int[this.Nf]; ...
abbb6c2e-3b29-4e92-93ff-ced4d46d5454
public Board() { board = new Piece[6][6]; graveyard = new ArrayList<Piece>(); Piece temp; //Place all the pawns on the board for (int count = 0; count < 6; count++) { temp = new Piece(ColorEnum.BLACK, PieceEnum.PAWN); board[1][count] = temp; temp = new Piece(ColorEnum.WHITE, PieceEnum.PAWN); ...
2781fa4c-b3ce-482b-af18-26923469107e
public ArrayList<Piece> getGraveyard() { return graveyard; }
b1350008-24a7-4e5f-8838-673fe74cc697
public void setGraveyard(ArrayList<Piece> graveyard) { this.graveyard = graveyard; }
cbdd9a93-909a-47d1-ab6a-bcf07af5fea3
public String toString() { String output; output = " -------------------\n"; for (int cx = 0; cx < 6; cx++) { output += 6-cx; output += "|"; for (int cy = 0; cy < 6; cy++) { if (board[cx][cy] == null) { output += " |"; } else { output += board[cx][cy].toString() + "...
acc69ba4-b1ce-4b94-a71e-e390bb913635
public Piece[][] getBoard() { return board; }
4f1ae87f-a0aa-4d3e-8430-baf04a1b852b
public void setBoard(Piece[][] board) { this.board = board; }
4ccd636b-eb24-4a77-b193-9a476a724ec8
public void movePiece(Move move) { //If a piece is being captured if (board[move.getB().getRow()][move.getB().getCollumn()] != null) { //Transfer it to the graveyard graveyard.add(board[move.getB().getRow()][move.getB().getCollumn()]); } //Move the piece to its destination board[move.getB().getRow()]...
357c2f3c-09d4-4f75-90eb-13804d9b94cf
public GameStatus getResultingGameStatus() { return resultingGameStatus; }
5b8c49b6-3d81-43e5-a0bb-75c300f58918
public void setResultingGameStatus(GameStatus resultingGameStatus) { this.resultingGameStatus = resultingGameStatus; }
5cde2f40-cf48-4b5b-84f7-86da6855db0c
public BoardPosition getA() { return a; }
6bb3e021-d23e-408b-99f9-5227e2c710de
public void setA(BoardPosition a) { this.a = a; }
6ae31c35-a506-4de4-8f7d-21db71334b1d
public BoardPosition getB() { return b; }
3201c9dd-1ba7-4bf7-b017-2cbb05a35bde
public void setB(BoardPosition b) { this.b = b; }
ce1e852b-2a9c-47c5-b259-880982ed0683
Move(BoardPosition a, BoardPosition b, GameStatus resultingGameStatus) { this.a = a; this.b = b; this.resultingGameStatus = resultingGameStatus; }
207d25f3-82d9-4afd-a27f-d41819895743
public Player(ColorEnum color, Board board) { this.color = color; this.board = board; }
c30ae8ba-43c8-44a9-97a6-3891f02f4b02
public Move makeMove() { Move move; //Keep looping and getting moves 'till we get a valid move while (true) { move = getMove(); System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); //If we're trying to move from positions that are actually in the board if (!(move.getA().isOutOfBounds() || move....
13ff652e-db06-442f-b6f5-467262786add
public Move getMove() { Move r; BoardPosition a; BoardPosition b; Scanner sc = new Scanner(System.in); int row; String collumn; System.out.print("Enter the row of the position of the piece you would like to move: "); row = sc.nextInt(); System.out.print("Enter the collumn of the position of the pie...
a283d084-8aa6-4f6b-b818-c6306710719a
private int getNumForCollumn(String i) { ArrayList<String> colNames = new ArrayList<String>(); colNames.add("a"); colNames.add("b"); colNames.add("c"); colNames.add("d"); colNames.add("e"); colNames.add("f"); int r = colNames.indexOf(i); return r; }