private void wrapperPBEKeyTest(Provider p) throws InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { for (String alg : PBE_ALGORITHM_AR) { String baseAlgo = alg.split("/")[0].toUpperCase(); // only run the tests on longer key lengths if unlimited version // of JCE jurisdiction policy files are installed if (Cipher.getMaxAllowedKeyLength(alg) < Integer.MAX_VALUE && (baseAlgo.endsWith("TRIPLEDES") || alg .endsWith("AES_256"))) { out.println("keyStrength > 128 within " + alg + " will not run under global policy"); continue; } SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p); SecretKey key = skf.generateSecret(new PBEKeySpec("Secret Lover" .toCharArray())); wrapTest(alg, alg, key, key, Cipher.SECRET_KEY, true); } }
/** * See wflow_adapt.py: * # Try and read config file and set default options * config = ConfigParser.SafeConfigParser() * config.optionxform = str * config.read(case + "/" + iniFile) * * # Get outpumapstacks from wflow ini * mstacks = config.options('outputmaps') * for a in mstacks: * var = config.get("outputmaps",a) * * @return String[] outmap names. */ public String[] getOutputMapNamesFromConfig(File configFile) { try { this.jep.eval("tempConfig = ConfigParser.SafeConfigParser()"); this.jep.eval("tempConfig.optionxform = str"); String configFilePath = BBUtils.getFilePathStringForPython(configFile); this.jep.set("configFilePath", configFilePath); this.jep.eval("tempConfig.read(configFilePath)"); this.jep.eval("tempOutputMaps = tempConfig.options('outputmaps')"); int numberOfOutputMaps = (Integer) this.jep.getValue("len(tempOutputMaps)"); String[] outputMapNames = new String[numberOfOutputMaps]; for (int i = 0; i < outputMapNames.length; i++) { this.jep.set("tempIndex", i); outputMapNames[i] = (String) this.jep.getValue("tempConfig.get('outputmaps', tempOutputMaps[tempIndex])"); } return outputMapNames; } catch (JepException e) { throw new RuntimeException(getClass().getSimpleName() + ": exception during call to python code. Message was: " + e.getMessage(), e); } }
public static synchronized void readPcRasterMapValues(Jep jep, String variableName, double[] dest) throws JepException { String bufferName = "readPcRasterMapValues" + dest.length; Map<Integer, DoubleBuffer> map = readPcRasterMapValuesBuffers.get(jep); if (map == null) { map = new HashMap<Integer, DoubleBuffer>(); readPcRasterMapValuesBuffers.put(jep, map); } DoubleBuffer buffer = map.get(dest.length); if (buffer == null) { buffer = buffers.get(dest.length); if (buffer == null) { buffer = createNativeDoubleBuffer(dest.length); buffers.put(dest.length, buffer); } declareDoubleArray(jep, bufferName, buffer); map.put(dest.length, buffer); } jep.eval(bufferName + "[:]=reshape(pcr2numpy(" + variableName + ", 1E31), " + dest.length + ')'); buffer.rewind(); buffer.get(dest); }
public AntennaFields(@Nonnull String __typename, @Nullable Coordinates coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; }
public NearestAntennaFromOrange(@Nonnull String __typename, @Nullable Coordinates coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromBouygues(@Nonnull String __typename, @Nullable Coordinates1 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromSfr(@Nonnull String __typename, @Nullable Coordinates2 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromFree(@Nonnull String __typename, @Nullable Coordinates3 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromOrange1(@Nonnull String __typename, @Nullable Coordinates4 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromBouygues1(@Nonnull String __typename, @Nullable Coordinates5 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromFree1(@Nonnull String __typename, @Nullable Coordinates7 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromOrange2(@Nonnull String __typename, @Nullable Coordinates8 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromBouygues2(@Nonnull String __typename, @Nullable Coordinates9 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromSfr2(@Nonnull String __typename, @Nullable Coordinates10 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromFree2(@Nonnull String __typename, @Nullable Coordinates11 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromOrange3(@Nonnull String __typename, @Nullable Coordinates12 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromBouygues3(@Nonnull String __typename, @Nullable Coordinates13 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromSfr3(@Nonnull String __typename, @Nullable Coordinates14 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public NearestAntennaFromFree3(@Nonnull String __typename, @Nullable Coordinates15 coordinates, @Nullable String generation, @Nullable String provider, @Nullable String lastUpdate, @Nullable String status, @Nullable Integer dist, @Nullable String insee, @Nullable String city, @Nullable String addressLabel, @Nonnull Fragments fragments) { if (__typename == null) { throw new NullPointerException("__typename can't be null"); } this.__typename = __typename; this.coordinates = coordinates; this.generation = generation; this.provider = provider; this.lastUpdate = lastUpdate; this.status = status; this.dist = dist; this.insee = insee; this.city = city; this.addressLabel = addressLabel; if (fragments == null) { throw new NullPointerException("fragments can't be null"); } this.fragments = fragments; }
public void clickAction(){ JTextField hours = new JTextField(); JTextField minutes = new JTextField(); JTextField seconds = new JTextField(); Object[] message = { "Hours", hours, "Minutes", minutes, "Seconds",seconds }; int option = JOptionPane.showConfirmDialog(null, message, "Time Limit", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { try{ w.setTimeLimit(Integer.parseInt(hours.getText()), Integer.parseInt(minutes.getText()), Integer.parseInt(seconds.getText()),0); }catch(Exception e){ w.setTimeLimit(Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE); } } }
public String getCaryString(){ int humanNum = 0; int timeLimitNum=99999; int timeBonusNum=99999; if(redBot){ humanNum+=(2*redDepth+4);//(redDepth/2+1)*4 } if(blueBot){ humanNum+=(blueDepth/2+1); } if(timeLimit[1]!=Integer.MAX_VALUE){ timeLimitNum = timeLimit[1]; timeBonusNum = timeBonus; } if(screen==2){ boardStart = getBoard(); moveSequence = ""; } String result = rules+","+Math.max(WIDTH,HEIGHT)+","+timeLimitNum+","+timeBonusNum+","+humanNum+","+boardStart+moveSequence; return result; }
public String getBoard(){ String result=""; int counter=2; int sum=0; ArrayList<Integer> triplets = new ArrayList<Integer>(); for(int x=0; x<WIDTH; x++){ for(int y=HEIGHT-1;y>=0;y--){ Tile t=allTiles[x][y]; sum+=(Math.pow(4,counter)*t.getState()); if(counter==0){ triplets.add(sum); sum=0; counter=3; } counter--; } } if(counter!=2){ triplets.add(sum); } for(int i:triplets){ result+=charTable.toCharArray()[i]; } return result; }
public void setTimeLimit(int hours,int minutes,int seconds, int milliseconds){ timeLimit = new int[]{hours,minutes,seconds,milliseconds}; if(screen==3){ removeObjects(getObjectsAt(750,180,Text.class)); if(hours==Integer.MAX_VALUE){ addObject(new Text("Untimed",30),750,180); }else{ String maxTimeString = String.valueOf(hours)+":"+ String.valueOf(minutes)+":"+ String.valueOf(seconds); addObject(new Text(maxTimeString,30),750,180); } } }
public static void main(String... args) throws Exception { String value = System.getProperty("java.ext.dirs"); System.out.format("java.ext.dirs = '%s'%n", value); if (args.length > 0) { int index = Integer.valueOf(args[0]); String expectedValue = VALUES[index]; if (!(expectedValue == value || (value != null && value.isEmpty()) || (expectedValue != null & expectedValue.equals(value)))) { throw new RuntimeException("java.ext.dirs (" + value + ") != " + expectedValue); } // launched by subprocess. return; } if (value != null) { throw new RuntimeException("java.ext.dirs not removed: " + value); } fatalError(0, "-Djava.ext.dirs=foo"); start(0); start(1, "-Djava.ext.dirs="); start(2, "-Djava.ext.dirs=\"\""); }
public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames, ByteString unknownFields) { super(ADAPTER, unknownFields); this.viewBoxWidth = viewBoxWidth; this.viewBoxHeight = viewBoxHeight; this.fps = fps; this.frames = frames; }
private void wrapperBlowfishKeyTest() throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException { // how many kinds of padding mode int padKinds; // Keysize should be multiple of 8 bytes. int KeyCutter = 8; int kSize = BLOWFISH_MIN_KEYSIZE; String algorithm = "Blowfish"; int maxAllowKeyLength = Cipher.getMaxAllowedKeyLength(algorithm); boolean unLimitPolicy = maxAllowKeyLength == Integer.MAX_VALUE; SecretKey key = null; while (kSize <= BLOWFISH_MAX_KEYSIZE) { for (String mode : MODEL_AR) { // PKCS5padding is meaningful only for ECB, CBC, PCBC if (mode.equalsIgnoreCase(MODEL_AR[0]) || mode.equalsIgnoreCase(MODEL_AR[1]) || mode.equalsIgnoreCase(MODEL_AR[2])) { padKinds = PADDING_AR.length; } else { padKinds = 1; } // Initialization KeyGenerator kg = KeyGenerator.getInstance(algorithm); for (int k = 0; k < padKinds; k++) { String transformation = algorithm + "/" + mode + "/" + PADDING_AR[k]; if (NOPADDING.equals(PADDING_AR[k]) && kSize % 64 != 0) { out.println(transformation + " will not run if input length not multiple" + " of 8 bytes when padding is " + NOPADDING); continue; } kg.init(kSize); key = kg.generateKey(); // only run the tests on longer key lengths if unlimited // version of JCE jurisdiction policy files are installed if (!unLimitPolicy && kSize > LINIMITED_KEYSIZE) { out.println("keyStrength > 128 within " + algorithm + " will not run under global policy"); } else { wrapTest(transformation, transformation, key, key, Cipher.SECRET_KEY, false); } } } if (kSize <= LINIMITED_KEYSIZE) { KeyCutter = 8; } else { KeyCutter = 48; } kSize += KeyCutter; } }
@Override public int hashCode() { int result = 0; result = result * 31 + Integer.valueOf(param1).hashCode(); result = result * 31 + Boolean.valueOf(param2).hashCode(); return result; }
@Override public int hashCode() { int result = 0; result = result * 31 + Integer.valueOf(param1).hashCode(); result = result * 31 + Boolean.valueOf(param2).hashCode(); result = result * 31 + Float.valueOf(param3).hashCode(); result = result * 31 + Double.valueOf(param4).hashCode(); return result; }
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
@Override public String createEvent(Uri eventsUri, String title, long startTime, long endTime, String description, String location, Long firstReminderMinutes, Long secondReminderMinutes, String recurrence, int recurrenceInterval, String recurrenceWeekstart, String recurrenceByDay, String recurrenceByMonthDay, Long recurrenceEndTime, Long recurrenceCount, String allday, Integer calendarId, String url) { eventsUri = eventsUri == null ? Uri.parse(CONTENT_PROVIDER + CONTENT_PROVIDER_PATH_EVENTS) : eventsUri; return super.createEvent(eventsUri, title, startTime, endTime, description, location, firstReminderMinutes, secondReminderMinutes, recurrence, recurrenceInterval, recurrenceWeekstart, recurrenceByDay, recurrenceByMonthDay, recurrenceEndTime, recurrenceCount, allday, calendarId, url); }
AutoValue_TestClassBundledGCM(Bundle bundle, byte someByte, boolean someBoolean, short someShort, int someInt, long someLong, char someChar, float someFloat, double someDouble, String someString, CharSequence someCharSequence, Parcelable someParcelable, ArrayList<Parcelable> someParcelableArrayList, SparseArray<Parcelable> someParcelableSparseArray, Serializable someSerializable, ArrayList<Integer> someIntegerArrayList, ArrayList<String> someStringArrayList, ArrayList<CharSequence> someCharSequenceArrayList, byte[] someByteArray, short[] someShortArray, char[] someCharArray, float[] someFloatArray, UnknownObject someUnknownObject, ArrayList<UnknownObject> someUnknownObjectList, TestEnum testEnum) { super(bundle, someByte, someBoolean, someShort, someInt, someLong, someChar, someFloat, someDouble, someString, someCharSequence, someParcelable, someParcelableArrayList, someParcelableSparseArray, someSerializable, someIntegerArrayList, someStringArrayList, someCharSequenceArrayList, someByteArray, someShortArray, someCharArray, someFloatArray, someUnknownObject, someUnknownObjectList, testEnum); }
public void readBoard(String in,boolean update){ moveSequence = ""; redTurn = true; blueTurn = false; try{ String[] parts; boolean newMode = false; char[] id = in.toCharArray(); if(id[0]=='B'){ int indexOfFirstComma = in.indexOf(","); int indexOfFirstSlash = in.indexOf("/"); birth.clear(); survive.clear(); for(int i=1;i<indexOfFirstSlash;i++){ birth.add(Character.getNumericValue(id[i])); } for(int i=indexOfFirstSlash+2;i<indexOfFirstComma;i++){ survive.add(Character.getNumericValue(id[i])); } parts = in.substring(indexOfFirstComma+1).split(","); }else{ parts = in.split(","); } if (parts.length < 5) { throw new IOException(); } WIDTH = HEIGHT = Math.min(Math.max(Integer.parseInt(parts[0]),3),20); timeLimit[0]=0; timeLimit[1] = Integer.parseInt(parts[1]); timeLimit[2]=0; timeLimit[3]=0; timeBonus = Integer.parseInt(parts[2]); int humanNum = Integer.parseInt(parts[3]); stringToBoard(parts[4],update); /*redDepth = (int)(((humanNum/4)-1)*2); blueDepth = (((humanNum%4)-1)*2); if(redDepth<0){ redBot = false; }else{ redBot = true; } if(blueDepth<0){ blueBot = false; }else{ redBot = true; }*/ int noSwapsUntil = -1; String[] moves = new String[parts.length-5]; for(int i = 0; i<moves.length; i++){ moves[i]=parts[i+5]; } int moveLimit = Integer.MAX_VALUE; if(screen==4){ moveArray = moves; totalMoves = moveArray.length; moveNumber = 0; saveTiles(); }else{ saveTiles(); for (int t = 0; t < moves.length; t++) { // Go through all the moves. makeMove(moves[t]); } } updateNumbers(); updateLists(); boardStart = getBoard(); }catch (Exception e) { JFrame frame = new JFrame("Error"); JOptionPane.showMessageDialog(frame, "Illegal game string", "Error", 0); } }
public void makeMove(String s){ String[] moveParts = s.split("\\+"); if (moveParts.length == 3) { redTimer.set(Integer.parseInt(moveParts[1])*(long)(0.01f)); blueTimer.set(Integer.parseInt(moveParts[2])*(long)(0.01f)); }else{ redTimer.set(0); blueTimer.set(0); } int moveType = charTable.indexOf(moveParts[0].charAt(moveParts[0].length()-1))-12; if (moveType <= 3) { int x = charTable.indexOf(moveParts[0].charAt(0))-12; int y = charTable.indexOf(moveParts[0].charAt(1))-12; if(moveType==1){ if(redTurn){ allTiles[x][HEIGHT-y-1].setState(1); }else if(blueTurn){ allTiles[x][HEIGHT-y-1].setState(2); } }else{ int swapWith = 0; allTiles[x][HEIGHT-y-1].setState(0); } allTiles[x][HEIGHT-y-1].preupdate(allTiles); allTiles[x][HEIGHT-y-1].updateNeighbours(allTiles); }else if (moveType == 4){ //moveNumber = 0; //totalMoves = 0; doTurn(); }else{ int endGameCause = moveType-5; endGameCause = 2+3*(moveType-5); return; } }
public void playerSelect(){ killAll(); selected = 0; screen = 3; HEIGHT = 20; WIDTH = 20; birth.clear(); survive.clear(); birth.add(3); survive.add(2); survive.add(3); redBot = false; blueBot = false; timeLimit = new int[]{Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE}; timeBonus = 0; addObject(new Text("Player 1", Color.red, 70+fontScale), 200, 40); addObject(new SelectPlayers(this, 6),200,120); addObject(new Text("Player 2", Color.blue, 70+fontScale), 200, 200); addObject(new SelectPlayers(this, 6),200,280); addObject(new BoardSize(this),500,120); addObject(new Text("20x20",30),500,150); addObject(new ChangeRules(this),500,240); drawRules(); addObject(new TimeLimit(this),750,120); addObject(new Text("Untimed",30),750,180); addObject(new TimeBonus(this),750,240); addObject(new Text("0s",30),750,300); addObject(new PlayGame(this),435,450); addObject(new MainMenu(this), 435,530); }
public void updateNumbers(){ if(redNumber!=null){ removeObject(redNumber); } if(blueNumber!=null){ removeObject(blueNumber); } redNumber = new Text(Integer.toString(reds.size()),30+fontScale); blueNumber = new Text(Integer.toString(blues.size()),30+fontScale); addObject(redNumber,700,70); addObject(blueNumber,700,161); }
public void clickAction(){ JTextField width = new JTextField(); JTextField height = new JTextField(); Object[] message = { "Width:", width, "Height:", height }; int option = JOptionPane.showConfirmDialog(null, message, "Board Size", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { try{ w.setBoardSize(Integer.parseInt(width.getText()),Integer.parseInt(height.getText())); }catch(Exception e){} } }