Skip to content

Instantly share code, notes, and snippets.

@tnoda
Created July 20, 2015 09:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnoda/61f32035992577d94a65 to your computer and use it in GitHub Desktop.
Save tnoda/61f32035992577d94a65 to your computer and use it in GitHub Desktop.
コロッケ食べ放題
(ns tnoda.eat.croquettes
(:import (org.openqa.selenium By)
(org.openqa.selenium.firefox FirefoxDriver)
(org.openqa.selenium.interactions Actions)))
(defn -main
"Eats more than one thousand pieces of croquettes"
[& args]
(let [driver (doto (FirefoxDriver.)
(.get "http://vnctst.tir.jp/op0012-4/"))
_ (Thread/sleep 10000)
canvas (.findElement driver (By/tagName "canvas"))
click (fn
[x y]
(.. (Actions. driver)
(moveToElement canvas (int x) (int y))
click
perform))
start #(click 320 310)
carpet-bomb #(doseq [[x y] (shuffle
(for [x (range 5 640 5)
y (range 80 360 5)]
[x y]))]
(click x y))
t0 (System/currentTimeMillis)]
(start)
(Thread/sleep 5000)
(loop []
(when (> 1e6 (- (System/currentTimeMillis) t0))
(carpet-bomb)
(recur)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment