Skip to content

Instantly share code, notes, and snippets.

WARNING t_filter() results in empty solution set!!
solution edge: (0.102197, -1.68708)[1](t=1.03479) - (0.0976054, -1.71425)[1](t=1.06218)
solution edge: 58[1]{1} -[4]- 59[1]{0}
s1= LineSite: (0.389014, -0.692829) - (0.386091, -0.691995)(k=-1)
s2= PointSite: (0.159513, -0.653879)(k=1)
s3= LineSite: (-0.162121, -0.673332) - (0.42533, -0.6914)
Running solvers again:
The failing 6 solutions are:
(0.12838, -0.650985) t=0.031267 k3=1 e_err=0.0614641
min<t<max=0 s3.in_region=1 region-t=0.492875
import javax.swing.*;
import java.awt.*;
import java.util.List;
import java.util.ArrayList;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
public class DemoViewer {
public static void main(String[] args) {
import org.rogach.scallop._
import java.io.{Serializable, ByteArrayOutputStream, ByteArrayInputStream, ObjectOutputStream, ObjectInputStream}
val args = Array("--apples", "33")
private class ConfSerializationProxy(@transient private var orig: Conf) extends Serializable {
private def writeObject(out: ObjectOutputStream) {
out.defaultWriteObject()
out.writeObject(orig.args.toArray)
}
@Rogach
Rogach / Test.scala
Created May 25, 2018 03:14
scallop-bug-161 test code
object Test {
def main(args: Array[String]) {
val conf = new TestClass(args)
}
}
import org.rogach.scallop.{ScallopConf, ScallopOption, Serialization, ValueConverter, singleArgConverter}
class TestClass(args: Seq[String]) extends ScallopConf(args) with Serialization {
Alad commented on 2018-03-28 20:11
Thanks :)
runical commented on 2018-03-27 07:39
I'll probably have some time tomorrow evening. If that isn't a problem,
I'll be happy to apply the patches.
E: Currently updating and testing
@Rogach
Rogach / Test.scala
Last active October 5, 2018 12:27
scallop #137 bug
import org.rogach.scallop._
import java.io.{Serializable, ByteArrayOutputStream, ByteArrayInputStream, ObjectOutputStream, ObjectInputStream}
trait PropsArgument extends ScallopConf {
@transient val p: Map[String, String] = props[String]('D')
}
class TestConf(args: List[String]) extends ScallopConf(args) with Serialization with PropsArgument {
val apples = opt[Int]("apples")
verify()
(def W 1000)
(def input (clojure.string/split-lines (slurp "d06.txt")))
(let [lights (boolean-array (* W W))]
(doseq [s input]
(let [ m (re-matches #"(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)" s)
command (get m 1)
x1 (Integer/parseInt (get m 2))
y1 (Integer/parseInt (get m 3))
x2 (Integer/parseInt (get m 4))
y2 (Integer/parseInt (get m 5)) ]
;; input is from https://adventofcode.com/2015/day/6
(def W 1000)
(def input (clojure.string/split-lines (slurp "d06.txt")))
(defmacro control-lights [lights x1 y1 x2 y2 f]
(let [i (gensym)]
`(doseq [ x# (range ~x1 (inc ~x2))
y# (range ~y1 (inc ~y2))
:let [ ~i (+ (* y# W) x#) ] ]
public class GetProperties {
public static void main(String[] args) {
System.out.println(System.getProperties());
}
}
import sys
import math
range_min = int(sys.argv[1])
range_max = int(sys.argv[2])
def calculate_square_depth(range_min, range_max):
if range_max <= 3:
return 0
min_bound = math.ceil(range_min**0.5)