Advertisement
arthurcluet

Untitled

May 13th, 2022
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         gomoku
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://gomoku.yjyao.com/
  8. // @icon         https://www.google.com/s2/favicons?domain=yjyao.com
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (async function() {
  13.     'use strict';
  14.  
  15.     // Your code here...
  16.     let last = -1;
  17.     let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  18.     let p= true;
  19.     while(true){
  20.         let m = Array.from(document.querySelectorAll("div[currentPlayer] > .gomoku-10 > div")).indexOf(document.querySelector('[isLastMove][spot="1"]'))
  21.         if(m != last){
  22.             last = m;
  23.             let col = last % 15;
  24.             let row = parseInt(last / 15);
  25.             if(alphabet[col]){
  26.                 console.log(alphabet[col] + "" + (row+1));
  27.                 p = true;
  28.  
  29.             }
  30.  
  31.         }
  32.         if(document.querySelector('[isprimary="true"]') && p){
  33.             console.log("Nouvelle partie");
  34.             p = false;
  35.         }
  36.  
  37.  
  38.         await new Promise(r => setTimeout(r, 100));
  39.     }
  40. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement