kandi background
Explore Kits

polyglot | Multilingual text processing toolkit | Natural Language Processing library

 by   aboSamoor Python Version: Current License: GPL-3.0

 by   aboSamoor Python Version: Current License: GPL-3.0

Download this library from

kandi X-RAY | polyglot Summary

polyglot is a Python library typically used in Artificial Intelligence, Natural Language Processing applications. polyglot has no bugs, it has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has high support. You can install using 'pip install polyglot' or download it from GitHub, PyPI.
Multilingual text (NLP) processing toolkit
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • polyglot has a highly active ecosystem.
  • It has 1843 star(s) with 302 fork(s). There are 83 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 131 open issues and 64 have been closed. On average issues are closed in 39 days. There are 12 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of polyglot is current.
polyglot Support
Best in #Natural Language Processing
Average in #Natural Language Processing
polyglot Support
Best in #Natural Language Processing
Average in #Natural Language Processing

quality kandi Quality

  • polyglot has 0 bugs and 0 code smells.
polyglot Quality
Best in #Natural Language Processing
Average in #Natural Language Processing
polyglot Quality
Best in #Natural Language Processing
Average in #Natural Language Processing

securitySecurity

  • polyglot has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • polyglot code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
polyglot Security
Best in #Natural Language Processing
Average in #Natural Language Processing
polyglot Security
Best in #Natural Language Processing
Average in #Natural Language Processing

license License

  • polyglot is licensed under the GPL-3.0 License. This license is Strong Copyleft.
  • Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
polyglot License
Best in #Natural Language Processing
Average in #Natural Language Processing
polyglot License
Best in #Natural Language Processing
Average in #Natural Language Processing

buildReuse

  • polyglot releases are not available. You will need to build from source code and install.
  • Deployable package is available in PyPI.
  • Build file is available. You can build the component from source.
polyglot Reuse
Best in #Natural Language Processing
Average in #Natural Language Processing
polyglot Reuse
Best in #Natural Language Processing
Average in #Natural Language Processing
Top functions reviewed by kandi - BETA

kandi has reviewed polyglot and discovered the below as its top functions. This is intended to give you an instant insight into polyglot implemented functionality, and help decide if they suit your requirements.

  • Build an index file
    • Find all files in the root directory
    • Return a list of path components
    • Find all packages in the root directory
  • Segment a sentence
    • Print text
    • Transform a sequence
    • Extend words from iterable
  • Return a function to resolve linkcode
    • Loads the model
      • Helper method to pickle a method
        • Sanitize a list of strings
          • Returns a list of words tagged by pos_tag
            • Load the model
              • Return a list of supported tasks
                • Set the URL to the index
                  • Return True if language is supported
                    • Generate a vocabulary counter
                      • Create a CountedVocabulary from files
                        • Unpickle method
                          • Construct a CountedVocabulary from a text file
                            • Expand the vocabulary
                              • A list of entities
                                • Loads an embedding
                                  • Download packages
                                    • Check that the zip file is valid

                                      Get all kandi verified functions for this library.

                                      Get all kandi verified functions for this library.

                                      polyglot Key Features

                                      Multilingual text (NLP) processing toolkit

                                      Karate - Get CSV column value having space

                                      copy iconCopydownload iconDownload
                                      * csv data = 
                                      """
                                      Instrument ID, Instrument Name
                                      SS-01,TestData
                                      """
                                      * match data[0]['Instrument ID'] == 'SS-01'
                                      

                                      vim - How to Split single line Array literal into multiple lines?

                                      copy iconCopydownload iconDownload
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ "TypeScript",
                                       "HTML",
                                       "CSS",
                                       "SQL",
                                       "JavaScript" ]
                                      
                                      :s/\s/\r/g
                                      
                                      [
                                      "TypeScript",
                                      "HTML",
                                      "CSS",
                                      "SQL",
                                      "JavaScript"
                                      ]
                                      
                                      ='[
                                      
                                      [
                                          "TypeScript",
                                          "HTML",
                                          "CSS",
                                          "SQL",
                                          "JavaScript"
                                      ]
                                      
                                      nnoremap <key> :s/\s/\r/g<CR>='[
                                      
                                      vi[                   " visually select what's between the brackets
                                      :'<,'>s/\%V\s/\r/g    " substitute spaces contained in the visual
                                                            " selection with \r
                                      
                                      vi[
                                      :'<,'>s/\%V\s/§/g
                                      :s/§/\r/g
                                      ='[
                                      
                                      function! ExpandList()
                                          silent s/\%V\s/§/g
                                          silent s/§/\r/g
                                          silent normal ='[
                                      endfunction
                                      xnoremap <key> :<C-u>call ExpandList()<CR>
                                      
                                      function! ExpandList()
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim() })
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      function! ExpandList(type, ...)
                                          silent s/\%V.*\%V/\="\r" . submatch(0)
                                                  \ ->split(',')
                                                  \ ->map({ i, v -> v->trim()})
                                                  \ ->join(",\r") . "\r"/g
                                          silent normal ='[
                                      endfunction
                                      
                                      nnoremap <key> :set opfunc=ExpandList<CR>g@
                                      
                                      [ |"TypeScript", "HTML", "CSS", "SQL", "JavaScript" ]
                                      
                                      [ 
                                        "TypeScript", 
                                        "HTML", 
                                        "CSS", 
                                        "SQL", 
                                        "JavaScript" 
                                      ]
                                      
                                      [ |"TypeScript", "HTML", "CSS", "SQL", "JavaScript" ]
                                      
                                      [ 
                                        "TypeScript", 
                                        "HTML", 
                                        "CSS", 
                                        "SQL", 
                                        "JavaScript" 
                                      ]
                                      

                                      renv + venv + jupyterlab + IRkernel: will it blend?

                                      copy iconCopydownload iconDownload
                                      owd <- setwd(".."); source("renv/activate.R"); setwd(owd)
                                      

                                      Minimax returning illegal uci move - move generation doesn't update?

                                      copy iconCopydownload iconDownload
                                      def minimax(board, depth, is_max):
                                        if depth == 0: 
                                          return evaluate(board)
                                        elif board.fen in searched_position_evals: 
                                          # board.pop()
                                          return searched_position_evals[board.fen]
                                      ...
                                      
                                      

                                      Is there a way to use a java object as an argument for a function and return one of said objects's values in GraalJS?

                                      copy iconCopydownload iconDownload
                                      Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
                                      bindings.put("polyglot.js.allowHostAccess", true);
                                      
                                      import org.graalvm.polyglot.HostAccess;
                                      // ...
                                      @HostAccess.Export
                                      public double getSpeed() {
                                          return this.speed;
                                      }
                                      
                                      Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
                                      bindings.put("polyglot.js.allowHostAccess", true);
                                      
                                      import org.graalvm.polyglot.HostAccess;
                                      // ...
                                      @HostAccess.Export
                                      public double getSpeed() {
                                          return this.speed;
                                      }
                                      

                                      How to use pomless tycho artifacts in non-tycho project

                                      copy iconCopydownload iconDownload
                                      @echo off
                                      
                                      set MVN_HOME=C:/Tools/apache-maven-3.6.3
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      set PATH=%MVN_HOME%/bin;%PATH%
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%~nH-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -Dfile="%BUNDLES_HOME%/%%F/target/%%F-%%~nH-SNAPSHOT.jar"
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%H -DgeneratePom=true -Dpackaging=jar -Dfile="%ECLIPSE_HOME%/%%~nG.jar"
                                            )
                                          )
                                        )
                                      )
                                      
                                      org.eclipse.ocl:org.eclipse.ocl
                                      org.eclipse.ocl:org.eclipse.ocl.common
                                      org.eclipse.ocl:org.eclipse.ocl.ecore
                                      org.eclipse.ocl:org.eclipse.ocl.pivot
                                      
                                      @echo off
                                      
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      break > deps-gen.txt
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%~nH-SNAPSHOT^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%H^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        )
                                      )
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          :
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                                -Dversion=$version -DgeneratePom=true -Dpackaging=jar \
                                                -Dfile="$BUNDLES_HOME/$artifact/target/$artifact-$version.jar"
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                              -Dversion=$version -DgeneratePom=true -Dpackaging=jar -Dfile="$file"
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      : > deps-gen.txt
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          echo >> deps-gen.txt
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              echo "        <dependency>" >> deps-gen.txt
                                              echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                              echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                              echo "            <version>$version</version>" >> deps-gen.txt
                                              echo "        </dependency>" >> deps-gen.txt
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            echo "        <dependency>" >> deps-gen.txt
                                            echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                            echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                            echo "            <version>$version</version>" >> deps-gen.txt
                                            echo "        </dependency>" >> deps-gen.txt
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      @echo off
                                      
                                      set MVN_HOME=C:/Tools/apache-maven-3.6.3
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      set PATH=%MVN_HOME%/bin;%PATH%
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%~nH-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -Dfile="%BUNDLES_HOME%/%%F/target/%%F-%%~nH-SNAPSHOT.jar"
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%H -DgeneratePom=true -Dpackaging=jar -Dfile="%ECLIPSE_HOME%/%%~nG.jar"
                                            )
                                          )
                                        )
                                      )
                                      
                                      org.eclipse.ocl:org.eclipse.ocl
                                      org.eclipse.ocl:org.eclipse.ocl.common
                                      org.eclipse.ocl:org.eclipse.ocl.ecore
                                      org.eclipse.ocl:org.eclipse.ocl.pivot
                                      
                                      @echo off
                                      
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      break > deps-gen.txt
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%~nH-SNAPSHOT^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%H^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        )
                                      )
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          :
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                                -Dversion=$version -DgeneratePom=true -Dpackaging=jar \
                                                -Dfile="$BUNDLES_HOME/$artifact/target/$artifact-$version.jar"
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                              -Dversion=$version -DgeneratePom=true -Dpackaging=jar -Dfile="$file"
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      : > deps-gen.txt
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          echo >> deps-gen.txt
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              echo "        <dependency>" >> deps-gen.txt
                                              echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                              echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                              echo "            <version>$version</version>" >> deps-gen.txt
                                              echo "        </dependency>" >> deps-gen.txt
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            echo "        <dependency>" >> deps-gen.txt
                                            echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                            echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                            echo "            <version>$version</version>" >> deps-gen.txt
                                            echo "        </dependency>" >> deps-gen.txt
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      @echo off
                                      
                                      set MVN_HOME=C:/Tools/apache-maven-3.6.3
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      set PATH=%MVN_HOME%/bin;%PATH%
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%~nH-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -Dfile="%BUNDLES_HOME%/%%F/target/%%F-%%~nH-SNAPSHOT.jar"
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%H -DgeneratePom=true -Dpackaging=jar -Dfile="%ECLIPSE_HOME%/%%~nG.jar"
                                            )
                                          )
                                        )
                                      )
                                      
                                      org.eclipse.ocl:org.eclipse.ocl
                                      org.eclipse.ocl:org.eclipse.ocl.common
                                      org.eclipse.ocl:org.eclipse.ocl.ecore
                                      org.eclipse.ocl:org.eclipse.ocl.pivot
                                      
                                      @echo off
                                      
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      break > deps-gen.txt
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%~nH-SNAPSHOT^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%H^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        )
                                      )
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          :
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                                -Dversion=$version -DgeneratePom=true -Dpackaging=jar \
                                                -Dfile="$BUNDLES_HOME/$artifact/target/$artifact-$version.jar"
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                              -Dversion=$version -DgeneratePom=true -Dpackaging=jar -Dfile="$file"
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      : > deps-gen.txt
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          echo >> deps-gen.txt
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              echo "        <dependency>" >> deps-gen.txt
                                              echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                              echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                              echo "            <version>$version</version>" >> deps-gen.txt
                                              echo "        </dependency>" >> deps-gen.txt
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            echo "        <dependency>" >> deps-gen.txt
                                            echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                            echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                            echo "            <version>$version</version>" >> deps-gen.txt
                                            echo "        </dependency>" >> deps-gen.txt
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      @echo off
                                      
                                      set MVN_HOME=C:/Tools/apache-maven-3.6.3
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      set PATH=%MVN_HOME%/bin;%PATH%
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%~nH-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -Dfile="%BUNDLES_HOME%/%%F/target/%%F-%%~nH-SNAPSHOT.jar"
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%H -DgeneratePom=true -Dpackaging=jar -Dfile="%ECLIPSE_HOME%/%%~nG.jar"
                                            )
                                          )
                                        )
                                      )
                                      
                                      org.eclipse.ocl:org.eclipse.ocl
                                      org.eclipse.ocl:org.eclipse.ocl.common
                                      org.eclipse.ocl:org.eclipse.ocl.ecore
                                      org.eclipse.ocl:org.eclipse.ocl.pivot
                                      
                                      @echo off
                                      
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      break > deps-gen.txt
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%~nH-SNAPSHOT^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%H^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        )
                                      )
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          :
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                                -Dversion=$version -DgeneratePom=true -Dpackaging=jar \
                                                -Dfile="$BUNDLES_HOME/$artifact/target/$artifact-$version.jar"
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                              -Dversion=$version -DgeneratePom=true -Dpackaging=jar -Dfile="$file"
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      : > deps-gen.txt
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          echo >> deps-gen.txt
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              echo "        <dependency>" >> deps-gen.txt
                                              echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                              echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                              echo "            <version>$version</version>" >> deps-gen.txt
                                              echo "        </dependency>" >> deps-gen.txt
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            echo "        <dependency>" >> deps-gen.txt
                                            echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                            echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                            echo "            <version>$version</version>" >> deps-gen.txt
                                            echo "        </dependency>" >> deps-gen.txt
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      @echo off
                                      
                                      set MVN_HOME=C:/Tools/apache-maven-3.6.3
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      set PATH=%MVN_HOME%/bin;%PATH%
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%~nH-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -Dfile="%BUNDLES_HOME%/%%F/target/%%F-%%~nH-SNAPSHOT.jar"
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              call mvn install:install-file -DgroupId=%%E -DartifactId=%%F -Dversion=%%H -DgeneratePom=true -Dpackaging=jar -Dfile="%ECLIPSE_HOME%/%%~nG.jar"
                                            )
                                          )
                                        )
                                      )
                                      
                                      org.eclipse.ocl:org.eclipse.ocl
                                      org.eclipse.ocl:org.eclipse.ocl.common
                                      org.eclipse.ocl:org.eclipse.ocl.ecore
                                      org.eclipse.ocl:org.eclipse.ocl.pivot
                                      
                                      @echo off
                                      
                                      set BUNDLES_HOME=C:/Work/workspace-bpms-trunk/bundles
                                      set ECLIPSE_HOME=C:/Tools/eclipse/plugins
                                      
                                      break > deps-gen.txt
                                      
                                      for /f "tokens=1,2 delims=:" %%E in (deps.txt) do (
                                        if exist %BUNDLES_HOME%/%%F (
                                          for /f "tokens=1,2 delims=: " %%G in (%BUNDLES_HOME%/%%F/META-INF/MANIFEST.MF) do (
                                            if "%%G" == "Bundle-Version" (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%~nH-SNAPSHOT^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        ) else (
                                          for %%G in (%ECLIPSE_HOME%/%%F_*.jar) do (
                                            for /f "tokens=2 delims=_" %%H in ("%%~nG") do (
                                              echo        ^<dependency^>>> deps-gen.txt
                                              echo            ^<groupId^>%%E^</groupId^>>> deps-gen.txt
                                              echo            ^<artifactId^>%%F^</artifactId^>>> deps-gen.txt
                                              echo            ^<version^>%%H^</version^>>> deps-gen.txt
                                              echo        ^</dependency^>>> deps-gen.txt
                                            )
                                          )
                                        )
                                      )
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          :
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                                -Dversion=$version -DgeneratePom=true -Dpackaging=jar \
                                                -Dfile="$BUNDLES_HOME/$artifact/target/$artifact-$version.jar"
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            mvn install:install-file -DgroupId=$group -DartifactId=$artifact \
                                              -Dversion=$version -DgeneratePom=true -Dpackaging=jar -Dfile="$file"
                                          done
                                        fi
                                      done < deps.txt
                                      
                                      #!/bin/bash
                                      
                                      BUNDLES_HOME=~/workspaces/workspace-bpms-trunk/bundles
                                      ECLIPSE_PLUGINS=~/.p2/pool/plugins
                                      
                                      : > deps-gen.txt
                                      
                                      while IFS=":" read -r group artifact || [ -n "$p" ]; do
                                        artifact="${artifact//[$'\r\n']}"
                                        if [ "$artifact" = "" ]; then
                                          echo >> deps-gen.txt
                                        elif [ -d "$BUNDLES_HOME/$artifact" ]; then
                                          while IFS=":" read -r key value || [ -n "$p" ]; do
                                            if [ "$key" = "Bundle-Version" ]; then
                                              version="${value//[[:space:]]/}"
                                              version="${version/.qualifier/-SNAPSHOT}"
                                              echo "        <dependency>" >> deps-gen.txt
                                              echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                              echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                              echo "            <version>$version</version>" >> deps-gen.txt
                                              echo "        </dependency>" >> deps-gen.txt
                                            fi
                                          done < "$BUNDLES_HOME/$artifact/META-INF/MANIFEST.MF"
                                        else
                                          for file in "$ECLIPSE_PLUGINS"/${artifact}_*.jar; do
                                            version="${file%%.jar}"
                                            version="${version##*_}"
                                            echo "        <dependency>" >> deps-gen.txt
                                            echo "            <groupId>$group</groupId>" >> deps-gen.txt
                                            echo "            <artifactId>$artifact</artifactId>" >> deps-gen.txt
                                            echo "            <version>$version</version>" >> deps-gen.txt
                                            echo "        </dependency>" >> deps-gen.txt
                                          done
                                        fi
                                      done < deps.txt
                                      

                                      Karate - want to get url along with query params in a variable

                                      copy iconCopydownload iconDownload
                                      Scenario: Sample File
                                      * def ScenarioEngine = Java.type('com.intuit.karate.core.ScenarioEngine');
                                      Given url 'https://reqres.in'
                                      And path '/api/users'
                                      And param page = 2
                                      And param pages = 1
                                      When method get
                                      And print ScenarioEngine.get().getRequest().getUrl()
                                      

                                      Python chess engine. Alphabeta function exceeding depth call error

                                      copy iconCopydownload iconDownload
                                      import time
                                      
                                      import chess
                                      import chess.pgn
                                      
                                      
                                      INF = 100000
                                      MATE_SCORE = INF-100
                                      MAX_DEPTH = 16
                                      MAX_TIME_MS = 120000  # 120s or 2m
                                      
                                      
                                      # Evaluating the board
                                      pawntable = [
                                          0, 0, 0, 0, 0, 0, 0, 0,
                                          5, 10, 10, -20, -20, 10, 10, 5,
                                          5, -5, -10, 0, 0, -10, -5, 5,
                                          0, 0, 0, 20, 20, 0, 0, 0,
                                          5, 5, 10, 25, 25, 10, 5, 5,
                                          10, 10, 20, 30, 30, 20, 10, 10,
                                          50, 50, 50, 50, 50, 50, 50, 50,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      knightstable = [
                                          -50, -40, -30, -30, -30, -30, -40, -50,
                                          -40, -20, 0, 5, 5, 0, -20, -40,
                                          -30, 5, 10, 15, 15, 10, 5, -30,
                                          -30, 0, 15, 20, 20, 15, 0, -30,
                                          -30, 5, 15, 20, 20, 15, 5, -30,
                                          -30, 0, 10, 15, 15, 10, 0, -30,
                                          -40, -20, 0, 0, 0, 0, -20, -40,
                                          -50, -40, -30, -30, -30, -30, -40, -50]
                                      
                                      bishopstable = [
                                          -20, -10, -10, -10, -10, -10, -10, -20,
                                          -10, 5, 0, 0, 0, 0, 5, -10,
                                          -10, 10, 10, 10, 10, 10, 10, -10,
                                          -10, 0, 10, 10, 10, 10, 0, -10,
                                          -10, 5, 5, 10, 10, 5, 5, -10,
                                          -10, 0, 5, 10, 10, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -10, -10, -10, -10, -20]
                                      
                                      rookstable = [
                                          0, 0, 0, 5, 5, 0, 0, 0,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          5, 10, 10, 10, 10, 10, 10, 5,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      queenstable = [
                                          -20, -10, -10, -5, -5, -10, -10, -20,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -10, 5, 5, 5, 5, 5, 0, -10,
                                          0, 0, 5, 5, 5, 5, 0, -5,
                                          -5, 0, 5, 5, 5, 5, 0, -5,
                                          -10, 0, 5, 5, 5, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -5, -5, -10, -10, -20]
                                      
                                      kingstable = [
                                          20, 30, 10, 0, 0, 10, 30, 20,
                                          20, 20, 0, 0, 0, 0, 20, 20,
                                          -10, -20, -20, -20, -20, -20, -20, -10,
                                          -20, -30, -30, -40, -40, -30, -30, -20,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30]
                                      
                                      
                                      def is_time_limit_reached():
                                          global start_time
                                          global timems
                                      
                                          return 1000 * (time.perf_counter() - start_time) >= timems
                                      
                                      
                                      def evaluate_board(board):
                                          wp = len(board.pieces(chess.PAWN, chess.WHITE))
                                          bp = len(board.pieces(chess.PAWN, chess.BLACK))
                                          wn = len(board.pieces(chess.KNIGHT, chess.WHITE))
                                          bn = len(board.pieces(chess.KNIGHT, chess.BLACK))
                                          wb = len(board.pieces(chess.BISHOP, chess.WHITE))
                                          bb = len(board.pieces(chess.BISHOP, chess.BLACK))
                                          wr = len(board.pieces(chess.ROOK, chess.WHITE))
                                          br = len(board.pieces(chess.ROOK, chess.BLACK))
                                          wq = len(board.pieces(chess.QUEEN, chess.WHITE))
                                          bq = len(board.pieces(chess.QUEEN, chess.BLACK))
                                      
                                          material = 100 * (wp - bp) + 320 * (wn - bn) + 330 * (wb - bb) + 500 * (wr - br) + 900 * (wq - bq)
                                      
                                          pawnsq = sum([pawntable[i] for i in board.pieces(chess.PAWN, chess.WHITE)])
                                          pawnsq = pawnsq + sum([-pawntable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.PAWN, chess.BLACK)])
                                          knightsq = sum([knightstable[i] for i in board.pieces(chess.KNIGHT, chess.WHITE)])
                                          knightsq = knightsq + sum([-knightstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.KNIGHT, chess.BLACK)])
                                          bishopsq = sum([bishopstable[i] for i in board.pieces(chess.BISHOP, chess.WHITE)])
                                          bishopsq = bishopsq + sum([-bishopstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.BISHOP, chess.BLACK)])
                                          rooksq = sum([rookstable[i] for i in board.pieces(chess.ROOK, chess.WHITE)])
                                          rooksq = rooksq + sum([-rookstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.ROOK, chess.BLACK)])
                                          queensq = sum([queenstable[i] for i in board.pieces(chess.QUEEN, chess.WHITE)])
                                          queensq = queensq + sum([-queenstable[chess.square_mirror(i)]
                                                                   for i in board.pieces(chess.QUEEN, chess.BLACK)])
                                          kingsq = sum([kingstable[i] for i in board.pieces(chess.KING, chess.WHITE)])
                                          kingsq = kingsq + sum([-kingstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.KING, chess.BLACK)])
                                      
                                          eval = material + pawnsq + knightsq + bishopsq + rooksq + queensq + kingsq
                                      
                                          if board.turn:
                                              return eval
                                          return -eval
                                      
                                      
                                      def value_to_mate(value):
                                          if (value < -MATE_SCORE):
                                              return -(INF + value) // 2
                                          
                                          elif (value > MATE_SCORE):
                                              return (INF - value + 1) // 2
                                      
                                          return 0
                                      
                                      
                                      # Searching the best move using minimax and alphabeta algorithm with negamax implementation
                                      def alphabeta(board, alpha, beta, depth):
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          bestscore = -INF
                                      
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.can_claim_draw() or board.is_insufficient_material():
                                              return 0
                                      
                                          incheck = board.is_check()
                                          if incheck:
                                              depth += 1
                                      
                                          if (depth < 1):
                                              return quiesce(board, alpha, beta)
                                      
                                          legal = 0
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                              legal += 1
                                      
                                              score = -alphabeta(board, -beta, -alpha, depth - 1)
                                              board.pop()
                                              ply -= 1
                                      
                                              if (score >= beta):
                                                  return score
                                      
                                              if (score > bestscore):
                                                  bestscore = score
                                      
                                              if (score > alpha):
                                                  alpha = score
                                      
                                          if legal == 0:
                                              if incheck:
                                                  return -INF + ply
                                              else:
                                                  return 0
                                      
                                          return bestscore
                                      
                                      
                                      def quiesce(board, alpha, beta):
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.is_insufficient_material():
                                              return 0
                                      
                                          stand_pat = evaluate_board(board)
                                          if (stand_pat >= beta):
                                              return beta
                                          if (alpha < stand_pat):
                                              alpha = stand_pat
                                      
                                          for move in board.legal_moves:
                                              if board.is_capture(move):
                                                  board.push(move)
                                      
                                                  score = -quiesce(board, -beta, -alpha)
                                                  board.pop()
                                      
                                                  if (score >= beta):
                                                      return beta
                                      
                                                  if (score > alpha):
                                                      alpha = score
                                      
                                          return alpha
                                      
                                      
                                      def selectmove(board, depth):
                                          global ply 
                                      
                                          bestMove = chess.Move.null()
                                          bestValue = -INF
                                          alpha = -INF
                                          beta = INF
                                      
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                      
                                              boardValue = -alphabeta(board, -beta, -alpha, depth - 1)
                                              if boardValue > bestValue:
                                                  bestValue = boardValue
                                                  bestMove = move
                                      
                                              if (boardValue > alpha):
                                                  alpha = boardValue
                                      
                                              board.pop()
                                              ply -= 1
                                      
                                              if is_time_limit_reached():
                                                  break
                                      
                                          return bestMove, bestValue
                                      
                                      
                                      if __name__ == '__main__':
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          fen = chess.STARTING_FEN
                                          # fen = "1k6/7Q/1K6/8/8/8/8/8 w - - 0 1"  # mate in 1
                                          # fen = "kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1"  # mate in 2
                                          # fen = "rnbqkb1r/1p2pppp/p2p1n2/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 0 6"  # sicilian
                                          
                                          depth = MAX_DEPTH
                                          timems = MAX_TIME_MS
                                      
                                          board = chess.Board(fen)
                                      
                                          while True:
                                              userinput = input('> ')
                                              line = userinput.rstrip()
                                      
                                              if line == 'go':
                                                  bestmove, bestscore = None, None
                                                  start_time = time.perf_counter()
                                                  ply = 0
                                      
                                                  if not board.is_game_over():
                                                      for d in range(1, depth+1):
                                                          move, score = selectmove(board, d)
                                      
                                                          elapse = 1000 * (time.perf_counter() - start_time)
                                      
                                                          if elapse >= timems:
                                                              break  # Don't overwrite our bestmove from the time-interrupted search.
                                      
                                                          bestmove = move
                                                          bestscore = score
                                      
                                                          if abs(bestscore) > MATE_SCORE:
                                                              mate = value_to_mate(bestscore)
                                                              print(f'info depth {d} score mate {mate} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                                          else:
                                                              print(f'info depth {d} score {bestscore} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                      
                                                      board.push(bestmove)  # update board with the bestmove
                                                      print(f'info time {int(1000*(time.perf_counter() - start_time))}')
                                                      print(f'bestmove {bestmove}')
                                                  else:
                                                      print('Game is over!')
                                      
                                              elif line == 'new':
                                                  board = chess.Board()
                                                  depth = MAX_DEPTH
                                                  timems = MAX_TIME_MS
                                                  print(board)
                                                  print(f'max depth: {depth}, max time ms: {timems}')
                                      
                                              elif 'position fen ' in line:
                                                  fen = ' '.join(line.split()[2:7])
                                                  board = chess.Board(fen)
                                      
                                              elif line == 'board':
                                                  print(board)
                                      
                                              elif line == 'fen':
                                                  print(board.fen())
                                      
                                              elif line == 'epd':
                                                  print(board.epd())
                                      
                                              elif 'time' in line:
                                                  timems = int(line.split()[1])
                                      
                                              elif 'depth' in line:
                                                  depth = int(line.split()[1])
                                      
                                              elif line == 'game':
                                                  game = chess.pgn.Game()
                                                  print(game.from_board(board))
                                      
                                              elif line == 'quit':
                                                  break
                                      
                                              else:
                                                  # assume user has entered a move
                                                  try:
                                                      board.push(chess.Move.from_uci(line))
                                                  except ValueError:
                                                      print(f'illegal move {line}')
                                      
                                      
                                      
                                      > new
                                      r n b q k b n r
                                      p p p p p p p p
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      P P P P P P P P
                                      R N B Q K B N R
                                      max depth: 16, max time ms: 120000
                                      > time 5000
                                      > e2e4
                                      > go
                                      info depth 1 score 10 time 18 pv g8f6
                                      info depth 2 score -40 time 140 pv g8f6
                                      info depth 3 score 10 time 973 pv g8f6
                                      info time 5001
                                      bestmove g8f6
                                      > board
                                      r n b q k b . r
                                      p p p p p p p p
                                      . . . . . n . .
                                      . . . . . . . .
                                      . . . . P . . .
                                      . . . . . . . .
                                      P P P P . P P P
                                      R N B Q K B N R
                                      > b1c3
                                      > go
                                      info depth 1 score 10 time 19 pv b8c6
                                      info depth 2 score -20 time 421 pv d7d5
                                      info depth 3 score 10 time 2865 pv d7d5
                                      info time 5000
                                      bestmove d7d5
                                      > board
                                      r n b q k b . r
                                      p p p . p p p p
                                      . . . . . n . .
                                      . . . p . . . .
                                      . . . . P . . .
                                      . . N . . . . .
                                      P P P P . P P P
                                      R . B Q K B N R
                                      > game
                                      [Event "?"]
                                      [Site "?"]
                                      [Date "????.??.??"]
                                      [Round "?"]
                                      [White "?"]
                                      [Black "?"]
                                      [Result "*"]
                                      
                                      1. e4 Nf6 2. Nc3 d5 *
                                      > quit
                                      
                                      > position fen kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      . P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      R . . . . . . .
                                      > time 5000
                                      > go
                                      info depth 1 score 10 time 10 pv a1a5
                                      info depth 2 score 10 time 92 pv a1a5
                                      info depth 3 score mate 2 time 362 pv a1a6
                                      info depth 4 score mate 2 time 2151 pv a1a6
                                      info time 5001
                                      bestmove a1a6
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      R P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      > go
                                      info depth 1 score 480 time 5 pv b7a6
                                      info depth 2 score mate -1 time 32 pv b8c7
                                      info depth 3 score mate -1 time 184 pv b8c7
                                      info depth 4 score mate -1 time 1314 pv b8c7
                                      info time 5000
                                      bestmove b8c7
                                      > go
                                      info depth 1 score mate 1 time 4 pv a6a7
                                      info depth 2 score mate 1 time 37 pv a6a7
                                      info depth 3 score mate 1 time 143 pv a6a7
                                      info depth 4 score mate 1 time 878 pv a6a7
                                      info depth 5 score mate 1 time 4305 pv a6a7
                                      info time 5001
                                      bestmove a6a7
                                      > go
                                      Game is over!
                                      >
                                      
                                      import time
                                      
                                      import chess
                                      import chess.pgn
                                      
                                      
                                      INF = 100000
                                      MATE_SCORE = INF-100
                                      MAX_DEPTH = 16
                                      MAX_TIME_MS = 120000  # 120s or 2m
                                      
                                      
                                      # Evaluating the board
                                      pawntable = [
                                          0, 0, 0, 0, 0, 0, 0, 0,
                                          5, 10, 10, -20, -20, 10, 10, 5,
                                          5, -5, -10, 0, 0, -10, -5, 5,
                                          0, 0, 0, 20, 20, 0, 0, 0,
                                          5, 5, 10, 25, 25, 10, 5, 5,
                                          10, 10, 20, 30, 30, 20, 10, 10,
                                          50, 50, 50, 50, 50, 50, 50, 50,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      knightstable = [
                                          -50, -40, -30, -30, -30, -30, -40, -50,
                                          -40, -20, 0, 5, 5, 0, -20, -40,
                                          -30, 5, 10, 15, 15, 10, 5, -30,
                                          -30, 0, 15, 20, 20, 15, 0, -30,
                                          -30, 5, 15, 20, 20, 15, 5, -30,
                                          -30, 0, 10, 15, 15, 10, 0, -30,
                                          -40, -20, 0, 0, 0, 0, -20, -40,
                                          -50, -40, -30, -30, -30, -30, -40, -50]
                                      
                                      bishopstable = [
                                          -20, -10, -10, -10, -10, -10, -10, -20,
                                          -10, 5, 0, 0, 0, 0, 5, -10,
                                          -10, 10, 10, 10, 10, 10, 10, -10,
                                          -10, 0, 10, 10, 10, 10, 0, -10,
                                          -10, 5, 5, 10, 10, 5, 5, -10,
                                          -10, 0, 5, 10, 10, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -10, -10, -10, -10, -20]
                                      
                                      rookstable = [
                                          0, 0, 0, 5, 5, 0, 0, 0,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          5, 10, 10, 10, 10, 10, 10, 5,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      queenstable = [
                                          -20, -10, -10, -5, -5, -10, -10, -20,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -10, 5, 5, 5, 5, 5, 0, -10,
                                          0, 0, 5, 5, 5, 5, 0, -5,
                                          -5, 0, 5, 5, 5, 5, 0, -5,
                                          -10, 0, 5, 5, 5, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -5, -5, -10, -10, -20]
                                      
                                      kingstable = [
                                          20, 30, 10, 0, 0, 10, 30, 20,
                                          20, 20, 0, 0, 0, 0, 20, 20,
                                          -10, -20, -20, -20, -20, -20, -20, -10,
                                          -20, -30, -30, -40, -40, -30, -30, -20,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30]
                                      
                                      
                                      def is_time_limit_reached():
                                          global start_time
                                          global timems
                                      
                                          return 1000 * (time.perf_counter() - start_time) >= timems
                                      
                                      
                                      def evaluate_board(board):
                                          wp = len(board.pieces(chess.PAWN, chess.WHITE))
                                          bp = len(board.pieces(chess.PAWN, chess.BLACK))
                                          wn = len(board.pieces(chess.KNIGHT, chess.WHITE))
                                          bn = len(board.pieces(chess.KNIGHT, chess.BLACK))
                                          wb = len(board.pieces(chess.BISHOP, chess.WHITE))
                                          bb = len(board.pieces(chess.BISHOP, chess.BLACK))
                                          wr = len(board.pieces(chess.ROOK, chess.WHITE))
                                          br = len(board.pieces(chess.ROOK, chess.BLACK))
                                          wq = len(board.pieces(chess.QUEEN, chess.WHITE))
                                          bq = len(board.pieces(chess.QUEEN, chess.BLACK))
                                      
                                          material = 100 * (wp - bp) + 320 * (wn - bn) + 330 * (wb - bb) + 500 * (wr - br) + 900 * (wq - bq)
                                      
                                          pawnsq = sum([pawntable[i] for i in board.pieces(chess.PAWN, chess.WHITE)])
                                          pawnsq = pawnsq + sum([-pawntable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.PAWN, chess.BLACK)])
                                          knightsq = sum([knightstable[i] for i in board.pieces(chess.KNIGHT, chess.WHITE)])
                                          knightsq = knightsq + sum([-knightstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.KNIGHT, chess.BLACK)])
                                          bishopsq = sum([bishopstable[i] for i in board.pieces(chess.BISHOP, chess.WHITE)])
                                          bishopsq = bishopsq + sum([-bishopstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.BISHOP, chess.BLACK)])
                                          rooksq = sum([rookstable[i] for i in board.pieces(chess.ROOK, chess.WHITE)])
                                          rooksq = rooksq + sum([-rookstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.ROOK, chess.BLACK)])
                                          queensq = sum([queenstable[i] for i in board.pieces(chess.QUEEN, chess.WHITE)])
                                          queensq = queensq + sum([-queenstable[chess.square_mirror(i)]
                                                                   for i in board.pieces(chess.QUEEN, chess.BLACK)])
                                          kingsq = sum([kingstable[i] for i in board.pieces(chess.KING, chess.WHITE)])
                                          kingsq = kingsq + sum([-kingstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.KING, chess.BLACK)])
                                      
                                          eval = material + pawnsq + knightsq + bishopsq + rooksq + queensq + kingsq
                                      
                                          if board.turn:
                                              return eval
                                          return -eval
                                      
                                      
                                      def value_to_mate(value):
                                          if (value < -MATE_SCORE):
                                              return -(INF + value) // 2
                                          
                                          elif (value > MATE_SCORE):
                                              return (INF - value + 1) // 2
                                      
                                          return 0
                                      
                                      
                                      # Searching the best move using minimax and alphabeta algorithm with negamax implementation
                                      def alphabeta(board, alpha, beta, depth):
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          bestscore = -INF
                                      
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.can_claim_draw() or board.is_insufficient_material():
                                              return 0
                                      
                                          incheck = board.is_check()
                                          if incheck:
                                              depth += 1
                                      
                                          if (depth < 1):
                                              return quiesce(board, alpha, beta)
                                      
                                          legal = 0
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                              legal += 1
                                      
                                              score = -alphabeta(board, -beta, -alpha, depth - 1)
                                              board.pop()
                                              ply -= 1
                                      
                                              if (score >= beta):
                                                  return score
                                      
                                              if (score > bestscore):
                                                  bestscore = score
                                      
                                              if (score > alpha):
                                                  alpha = score
                                      
                                          if legal == 0:
                                              if incheck:
                                                  return -INF + ply
                                              else:
                                                  return 0
                                      
                                          return bestscore
                                      
                                      
                                      def quiesce(board, alpha, beta):
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.is_insufficient_material():
                                              return 0
                                      
                                          stand_pat = evaluate_board(board)
                                          if (stand_pat >= beta):
                                              return beta
                                          if (alpha < stand_pat):
                                              alpha = stand_pat
                                      
                                          for move in board.legal_moves:
                                              if board.is_capture(move):
                                                  board.push(move)
                                      
                                                  score = -quiesce(board, -beta, -alpha)
                                                  board.pop()
                                      
                                                  if (score >= beta):
                                                      return beta
                                      
                                                  if (score > alpha):
                                                      alpha = score
                                      
                                          return alpha
                                      
                                      
                                      def selectmove(board, depth):
                                          global ply 
                                      
                                          bestMove = chess.Move.null()
                                          bestValue = -INF
                                          alpha = -INF
                                          beta = INF
                                      
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                      
                                              boardValue = -alphabeta(board, -beta, -alpha, depth - 1)
                                              if boardValue > bestValue:
                                                  bestValue = boardValue
                                                  bestMove = move
                                      
                                              if (boardValue > alpha):
                                                  alpha = boardValue
                                      
                                              board.pop()
                                              ply -= 1
                                      
                                              if is_time_limit_reached():
                                                  break
                                      
                                          return bestMove, bestValue
                                      
                                      
                                      if __name__ == '__main__':
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          fen = chess.STARTING_FEN
                                          # fen = "1k6/7Q/1K6/8/8/8/8/8 w - - 0 1"  # mate in 1
                                          # fen = "kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1"  # mate in 2
                                          # fen = "rnbqkb1r/1p2pppp/p2p1n2/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 0 6"  # sicilian
                                          
                                          depth = MAX_DEPTH
                                          timems = MAX_TIME_MS
                                      
                                          board = chess.Board(fen)
                                      
                                          while True:
                                              userinput = input('> ')
                                              line = userinput.rstrip()
                                      
                                              if line == 'go':
                                                  bestmove, bestscore = None, None
                                                  start_time = time.perf_counter()
                                                  ply = 0
                                      
                                                  if not board.is_game_over():
                                                      for d in range(1, depth+1):
                                                          move, score = selectmove(board, d)
                                      
                                                          elapse = 1000 * (time.perf_counter() - start_time)
                                      
                                                          if elapse >= timems:
                                                              break  # Don't overwrite our bestmove from the time-interrupted search.
                                      
                                                          bestmove = move
                                                          bestscore = score
                                      
                                                          if abs(bestscore) > MATE_SCORE:
                                                              mate = value_to_mate(bestscore)
                                                              print(f'info depth {d} score mate {mate} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                                          else:
                                                              print(f'info depth {d} score {bestscore} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                      
                                                      board.push(bestmove)  # update board with the bestmove
                                                      print(f'info time {int(1000*(time.perf_counter() - start_time))}')
                                                      print(f'bestmove {bestmove}')
                                                  else:
                                                      print('Game is over!')
                                      
                                              elif line == 'new':
                                                  board = chess.Board()
                                                  depth = MAX_DEPTH
                                                  timems = MAX_TIME_MS
                                                  print(board)
                                                  print(f'max depth: {depth}, max time ms: {timems}')
                                      
                                              elif 'position fen ' in line:
                                                  fen = ' '.join(line.split()[2:7])
                                                  board = chess.Board(fen)
                                      
                                              elif line == 'board':
                                                  print(board)
                                      
                                              elif line == 'fen':
                                                  print(board.fen())
                                      
                                              elif line == 'epd':
                                                  print(board.epd())
                                      
                                              elif 'time' in line:
                                                  timems = int(line.split()[1])
                                      
                                              elif 'depth' in line:
                                                  depth = int(line.split()[1])
                                      
                                              elif line == 'game':
                                                  game = chess.pgn.Game()
                                                  print(game.from_board(board))
                                      
                                              elif line == 'quit':
                                                  break
                                      
                                              else:
                                                  # assume user has entered a move
                                                  try:
                                                      board.push(chess.Move.from_uci(line))
                                                  except ValueError:
                                                      print(f'illegal move {line}')
                                      
                                      
                                      
                                      > new
                                      r n b q k b n r
                                      p p p p p p p p
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      P P P P P P P P
                                      R N B Q K B N R
                                      max depth: 16, max time ms: 120000
                                      > time 5000
                                      > e2e4
                                      > go
                                      info depth 1 score 10 time 18 pv g8f6
                                      info depth 2 score -40 time 140 pv g8f6
                                      info depth 3 score 10 time 973 pv g8f6
                                      info time 5001
                                      bestmove g8f6
                                      > board
                                      r n b q k b . r
                                      p p p p p p p p
                                      . . . . . n . .
                                      . . . . . . . .
                                      . . . . P . . .
                                      . . . . . . . .
                                      P P P P . P P P
                                      R N B Q K B N R
                                      > b1c3
                                      > go
                                      info depth 1 score 10 time 19 pv b8c6
                                      info depth 2 score -20 time 421 pv d7d5
                                      info depth 3 score 10 time 2865 pv d7d5
                                      info time 5000
                                      bestmove d7d5
                                      > board
                                      r n b q k b . r
                                      p p p . p p p p
                                      . . . . . n . .
                                      . . . p . . . .
                                      . . . . P . . .
                                      . . N . . . . .
                                      P P P P . P P P
                                      R . B Q K B N R
                                      > game
                                      [Event "?"]
                                      [Site "?"]
                                      [Date "????.??.??"]
                                      [Round "?"]
                                      [White "?"]
                                      [Black "?"]
                                      [Result "*"]
                                      
                                      1. e4 Nf6 2. Nc3 d5 *
                                      > quit
                                      
                                      > position fen kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      . P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      R . . . . . . .
                                      > time 5000
                                      > go
                                      info depth 1 score 10 time 10 pv a1a5
                                      info depth 2 score 10 time 92 pv a1a5
                                      info depth 3 score mate 2 time 362 pv a1a6
                                      info depth 4 score mate 2 time 2151 pv a1a6
                                      info time 5001
                                      bestmove a1a6
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      R P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      > go
                                      info depth 1 score 480 time 5 pv b7a6
                                      info depth 2 score mate -1 time 32 pv b8c7
                                      info depth 3 score mate -1 time 184 pv b8c7
                                      info depth 4 score mate -1 time 1314 pv b8c7
                                      info time 5000
                                      bestmove b8c7
                                      > go
                                      info depth 1 score mate 1 time 4 pv a6a7
                                      info depth 2 score mate 1 time 37 pv a6a7
                                      info depth 3 score mate 1 time 143 pv a6a7
                                      info depth 4 score mate 1 time 878 pv a6a7
                                      info depth 5 score mate 1 time 4305 pv a6a7
                                      info time 5001
                                      bestmove a6a7
                                      > go
                                      Game is over!
                                      >
                                      
                                      import time
                                      
                                      import chess
                                      import chess.pgn
                                      
                                      
                                      INF = 100000
                                      MATE_SCORE = INF-100
                                      MAX_DEPTH = 16
                                      MAX_TIME_MS = 120000  # 120s or 2m
                                      
                                      
                                      # Evaluating the board
                                      pawntable = [
                                          0, 0, 0, 0, 0, 0, 0, 0,
                                          5, 10, 10, -20, -20, 10, 10, 5,
                                          5, -5, -10, 0, 0, -10, -5, 5,
                                          0, 0, 0, 20, 20, 0, 0, 0,
                                          5, 5, 10, 25, 25, 10, 5, 5,
                                          10, 10, 20, 30, 30, 20, 10, 10,
                                          50, 50, 50, 50, 50, 50, 50, 50,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      knightstable = [
                                          -50, -40, -30, -30, -30, -30, -40, -50,
                                          -40, -20, 0, 5, 5, 0, -20, -40,
                                          -30, 5, 10, 15, 15, 10, 5, -30,
                                          -30, 0, 15, 20, 20, 15, 0, -30,
                                          -30, 5, 15, 20, 20, 15, 5, -30,
                                          -30, 0, 10, 15, 15, 10, 0, -30,
                                          -40, -20, 0, 0, 0, 0, -20, -40,
                                          -50, -40, -30, -30, -30, -30, -40, -50]
                                      
                                      bishopstable = [
                                          -20, -10, -10, -10, -10, -10, -10, -20,
                                          -10, 5, 0, 0, 0, 0, 5, -10,
                                          -10, 10, 10, 10, 10, 10, 10, -10,
                                          -10, 0, 10, 10, 10, 10, 0, -10,
                                          -10, 5, 5, 10, 10, 5, 5, -10,
                                          -10, 0, 5, 10, 10, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -10, -10, -10, -10, -20]
                                      
                                      rookstable = [
                                          0, 0, 0, 5, 5, 0, 0, 0,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          -5, 0, 0, 0, 0, 0, 0, -5,
                                          5, 10, 10, 10, 10, 10, 10, 5,
                                          0, 0, 0, 0, 0, 0, 0, 0]
                                      
                                      queenstable = [
                                          -20, -10, -10, -5, -5, -10, -10, -20,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -10, 5, 5, 5, 5, 5, 0, -10,
                                          0, 0, 5, 5, 5, 5, 0, -5,
                                          -5, 0, 5, 5, 5, 5, 0, -5,
                                          -10, 0, 5, 5, 5, 5, 0, -10,
                                          -10, 0, 0, 0, 0, 0, 0, -10,
                                          -20, -10, -10, -5, -5, -10, -10, -20]
                                      
                                      kingstable = [
                                          20, 30, 10, 0, 0, 10, 30, 20,
                                          20, 20, 0, 0, 0, 0, 20, 20,
                                          -10, -20, -20, -20, -20, -20, -20, -10,
                                          -20, -30, -30, -40, -40, -30, -30, -20,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30,
                                          -30, -40, -40, -50, -50, -40, -40, -30]
                                      
                                      
                                      def is_time_limit_reached():
                                          global start_time
                                          global timems
                                      
                                          return 1000 * (time.perf_counter() - start_time) >= timems
                                      
                                      
                                      def evaluate_board(board):
                                          wp = len(board.pieces(chess.PAWN, chess.WHITE))
                                          bp = len(board.pieces(chess.PAWN, chess.BLACK))
                                          wn = len(board.pieces(chess.KNIGHT, chess.WHITE))
                                          bn = len(board.pieces(chess.KNIGHT, chess.BLACK))
                                          wb = len(board.pieces(chess.BISHOP, chess.WHITE))
                                          bb = len(board.pieces(chess.BISHOP, chess.BLACK))
                                          wr = len(board.pieces(chess.ROOK, chess.WHITE))
                                          br = len(board.pieces(chess.ROOK, chess.BLACK))
                                          wq = len(board.pieces(chess.QUEEN, chess.WHITE))
                                          bq = len(board.pieces(chess.QUEEN, chess.BLACK))
                                      
                                          material = 100 * (wp - bp) + 320 * (wn - bn) + 330 * (wb - bb) + 500 * (wr - br) + 900 * (wq - bq)
                                      
                                          pawnsq = sum([pawntable[i] for i in board.pieces(chess.PAWN, chess.WHITE)])
                                          pawnsq = pawnsq + sum([-pawntable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.PAWN, chess.BLACK)])
                                          knightsq = sum([knightstable[i] for i in board.pieces(chess.KNIGHT, chess.WHITE)])
                                          knightsq = knightsq + sum([-knightstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.KNIGHT, chess.BLACK)])
                                          bishopsq = sum([bishopstable[i] for i in board.pieces(chess.BISHOP, chess.WHITE)])
                                          bishopsq = bishopsq + sum([-bishopstable[chess.square_mirror(i)]
                                                                     for i in board.pieces(chess.BISHOP, chess.BLACK)])
                                          rooksq = sum([rookstable[i] for i in board.pieces(chess.ROOK, chess.WHITE)])
                                          rooksq = rooksq + sum([-rookstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.ROOK, chess.BLACK)])
                                          queensq = sum([queenstable[i] for i in board.pieces(chess.QUEEN, chess.WHITE)])
                                          queensq = queensq + sum([-queenstable[chess.square_mirror(i)]
                                                                   for i in board.pieces(chess.QUEEN, chess.BLACK)])
                                          kingsq = sum([kingstable[i] for i in board.pieces(chess.KING, chess.WHITE)])
                                          kingsq = kingsq + sum([-kingstable[chess.square_mirror(i)]
                                                                 for i in board.pieces(chess.KING, chess.BLACK)])
                                      
                                          eval = material + pawnsq + knightsq + bishopsq + rooksq + queensq + kingsq
                                      
                                          if board.turn:
                                              return eval
                                          return -eval
                                      
                                      
                                      def value_to_mate(value):
                                          if (value < -MATE_SCORE):
                                              return -(INF + value) // 2
                                          
                                          elif (value > MATE_SCORE):
                                              return (INF - value + 1) // 2
                                      
                                          return 0
                                      
                                      
                                      # Searching the best move using minimax and alphabeta algorithm with negamax implementation
                                      def alphabeta(board, alpha, beta, depth):
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          bestscore = -INF
                                      
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.can_claim_draw() or board.is_insufficient_material():
                                              return 0
                                      
                                          incheck = board.is_check()
                                          if incheck:
                                              depth += 1
                                      
                                          if (depth < 1):
                                              return quiesce(board, alpha, beta)
                                      
                                          legal = 0
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                              legal += 1
                                      
                                              score = -alphabeta(board, -beta, -alpha, depth - 1)
                                              board.pop()
                                              ply -= 1
                                      
                                              if (score >= beta):
                                                  return score
                                      
                                              if (score > bestscore):
                                                  bestscore = score
                                      
                                              if (score > alpha):
                                                  alpha = score
                                      
                                          if legal == 0:
                                              if incheck:
                                                  return -INF + ply
                                              else:
                                                  return 0
                                      
                                          return bestscore
                                      
                                      
                                      def quiesce(board, alpha, beta):
                                          if is_time_limit_reached():
                                              return 0
                                      
                                          if board.is_insufficient_material():
                                              return 0
                                      
                                          stand_pat = evaluate_board(board)
                                          if (stand_pat >= beta):
                                              return beta
                                          if (alpha < stand_pat):
                                              alpha = stand_pat
                                      
                                          for move in board.legal_moves:
                                              if board.is_capture(move):
                                                  board.push(move)
                                      
                                                  score = -quiesce(board, -beta, -alpha)
                                                  board.pop()
                                      
                                                  if (score >= beta):
                                                      return beta
                                      
                                                  if (score > alpha):
                                                      alpha = score
                                      
                                          return alpha
                                      
                                      
                                      def selectmove(board, depth):
                                          global ply 
                                      
                                          bestMove = chess.Move.null()
                                          bestValue = -INF
                                          alpha = -INF
                                          beta = INF
                                      
                                          for move in board.legal_moves:
                                              board.push(move)
                                              ply += 1
                                      
                                              boardValue = -alphabeta(board, -beta, -alpha, depth - 1)
                                              if boardValue > bestValue:
                                                  bestValue = boardValue
                                                  bestMove = move
                                      
                                              if (boardValue > alpha):
                                                  alpha = boardValue
                                      
                                              board.pop()
                                              ply -= 1
                                      
                                              if is_time_limit_reached():
                                                  break
                                      
                                          return bestMove, bestValue
                                      
                                      
                                      if __name__ == '__main__':
                                          global timems
                                          global start_time
                                          global ply
                                      
                                          fen = chess.STARTING_FEN
                                          # fen = "1k6/7Q/1K6/8/8/8/8/8 w - - 0 1"  # mate in 1
                                          # fen = "kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1"  # mate in 2
                                          # fen = "rnbqkb1r/1p2pppp/p2p1n2/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 0 6"  # sicilian
                                          
                                          depth = MAX_DEPTH
                                          timems = MAX_TIME_MS
                                      
                                          board = chess.Board(fen)
                                      
                                          while True:
                                              userinput = input('> ')
                                              line = userinput.rstrip()
                                      
                                              if line == 'go':
                                                  bestmove, bestscore = None, None
                                                  start_time = time.perf_counter()
                                                  ply = 0
                                      
                                                  if not board.is_game_over():
                                                      for d in range(1, depth+1):
                                                          move, score = selectmove(board, d)
                                      
                                                          elapse = 1000 * (time.perf_counter() - start_time)
                                      
                                                          if elapse >= timems:
                                                              break  # Don't overwrite our bestmove from the time-interrupted search.
                                      
                                                          bestmove = move
                                                          bestscore = score
                                      
                                                          if abs(bestscore) > MATE_SCORE:
                                                              mate = value_to_mate(bestscore)
                                                              print(f'info depth {d} score mate {mate} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                                          else:
                                                              print(f'info depth {d} score {bestscore} time {int(elapse)} pv {bestmove}')  # time is in millisec
                                      
                                                      board.push(bestmove)  # update board with the bestmove
                                                      print(f'info time {int(1000*(time.perf_counter() - start_time))}')
                                                      print(f'bestmove {bestmove}')
                                                  else:
                                                      print('Game is over!')
                                      
                                              elif line == 'new':
                                                  board = chess.Board()
                                                  depth = MAX_DEPTH
                                                  timems = MAX_TIME_MS
                                                  print(board)
                                                  print(f'max depth: {depth}, max time ms: {timems}')
                                      
                                              elif 'position fen ' in line:
                                                  fen = ' '.join(line.split()[2:7])
                                                  board = chess.Board(fen)
                                      
                                              elif line == 'board':
                                                  print(board)
                                      
                                              elif line == 'fen':
                                                  print(board.fen())
                                      
                                              elif line == 'epd':
                                                  print(board.epd())
                                      
                                              elif 'time' in line:
                                                  timems = int(line.split()[1])
                                      
                                              elif 'depth' in line:
                                                  depth = int(line.split()[1])
                                      
                                              elif line == 'game':
                                                  game = chess.pgn.Game()
                                                  print(game.from_board(board))
                                      
                                              elif line == 'quit':
                                                  break
                                      
                                              else:
                                                  # assume user has entered a move
                                                  try:
                                                      board.push(chess.Move.from_uci(line))
                                                  except ValueError:
                                                      print(f'illegal move {line}')
                                      
                                      
                                      
                                      > new
                                      r n b q k b n r
                                      p p p p p p p p
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      P P P P P P P P
                                      R N B Q K B N R
                                      max depth: 16, max time ms: 120000
                                      > time 5000
                                      > e2e4
                                      > go
                                      info depth 1 score 10 time 18 pv g8f6
                                      info depth 2 score -40 time 140 pv g8f6
                                      info depth 3 score 10 time 973 pv g8f6
                                      info time 5001
                                      bestmove g8f6
                                      > board
                                      r n b q k b . r
                                      p p p p p p p p
                                      . . . . . n . .
                                      . . . . . . . .
                                      . . . . P . . .
                                      . . . . . . . .
                                      P P P P . P P P
                                      R N B Q K B N R
                                      > b1c3
                                      > go
                                      info depth 1 score 10 time 19 pv b8c6
                                      info depth 2 score -20 time 421 pv d7d5
                                      info depth 3 score 10 time 2865 pv d7d5
                                      info time 5000
                                      bestmove d7d5
                                      > board
                                      r n b q k b . r
                                      p p p . p p p p
                                      . . . . . n . .
                                      . . . p . . . .
                                      . . . . P . . .
                                      . . N . . . . .
                                      P P P P . P P P
                                      R . B Q K B N R
                                      > game
                                      [Event "?"]
                                      [Site "?"]
                                      [Date "????.??.??"]
                                      [Round "?"]
                                      [White "?"]
                                      [Black "?"]
                                      [Result "*"]
                                      
                                      1. e4 Nf6 2. Nc3 d5 *
                                      > quit
                                      
                                      > position fen kbK5/pp6/1P6/8/8/8/8/R7 w - - 0 1
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      . P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      R . . . . . . .
                                      > time 5000
                                      > go
                                      info depth 1 score 10 time 10 pv a1a5
                                      info depth 2 score 10 time 92 pv a1a5
                                      info depth 3 score mate 2 time 362 pv a1a6
                                      info depth 4 score mate 2 time 2151 pv a1a6
                                      info time 5001
                                      bestmove a1a6
                                      > board
                                      k b K . . . . .
                                      p p . . . . . .
                                      R P . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      . . . . . . . .
                                      > go
                                      info depth 1 score 480 time 5 pv b7a6
                                      info depth 2 score mate -1 time 32 pv b8c7
                                      info depth 3 score mate -1 time 184 pv b8c7
                                      info depth 4 score mate -1 time 1314 pv b8c7
                                      info time 5000
                                      bestmove b8c7
                                      > go
                                      info depth 1 score mate 1 time 4 pv a6a7
                                      info depth 2 score mate 1 time 37 pv a6a7
                                      info depth 3 score mate 1 time 143 pv a6a7
                                      info depth 4 score mate 1 time 878 pv a6a7
                                      info depth 5 score mate 1 time 4305 pv a6a7
                                      info time 5001
                                      bestmove a6a7
                                      > go
                                      Game is over!
                                      >
                                      

                                      I have to store a particular value in response of one API into two arrays in karate where array length can be even or odd number

                                      copy iconCopydownload iconDownload
                                      * def list = [1, 2, 3, 4]
                                      * def odd1 = list.filter(x => x % 2)
                                      * match odd1 == [1, 3]
                                      * def odd2 = karate.filter(list, function(x){ return x % 2 != 0 })
                                      * match odd2 == [1, 3]
                                      * def even = list.filter((x, i) => i % 2)
                                      * match even == [2, 4]
                                      
                                      * def odd = []
                                      * def list = [1, 2, 3, 4]
                                      * list.forEach(x => {if (x % 2) odd.push(x)})
                                      * match odd == [1, 3] 
                                      
                                      * def list = [1, 2, 3, 4]
                                      * def odd1 = list.filter(x => x % 2)
                                      * match odd1 == [1, 3]
                                      * def odd2 = karate.filter(list, function(x){ return x % 2 != 0 })
                                      * match odd2 == [1, 3]
                                      * def even = list.filter((x, i) => i % 2)
                                      * match even == [2, 4]
                                      
                                      * def odd = []
                                      * def list = [1, 2, 3, 4]
                                      * list.forEach(x => {if (x % 2) odd.push(x)})
                                      * match odd == [1, 3] 
                                      

                                      How to apply if condition on the basis of response header in karate

                                      copy iconCopydownload iconDownload
                                      * if (karate.get("responseHeaders['APP-ID'][0]")) karate.call('called.feature', { id: 'foo' })
                                      

                                      Community Discussions

                                      Trending Discussions on polyglot
                                      • Karate - Get CSV column value having space
                                      • Using GraalVM (scripting) within Wildfly/JBoss
                                      • vim - How to Split single line Array literal into multiple lines?
                                      • renv + venv + jupyterlab + IRkernel: will it blend?
                                      • Defining two o more functions in karate-config.js
                                      • Does GraalVM use same thread and heap space when calling polyglot functions?
                                      • Minimax returning illegal uci move - move generation doesn't update?
                                      • Is there a way to use a java object as an argument for a function and return one of said objects's values in GraalJS?
                                      • How to use pomless tycho artifacts in non-tycho project
                                      • Karate - want to get url along with query params in a variable
                                      Trending Discussions on polyglot

                                      QUESTION

                                      Karate - Get CSV column value having space

                                      Asked 2022-Mar-25 at 12:52

                                      I want to get the 'Instrument ID' column value of the below CSV data where the CSV column header having spaces

                                      Instrument ID, Instrument Name
                                      SS-01,TestData
                                      

                                      This is my code

                                      * json csvContents = read('instument-info.csv')
                                      * print csvContents
                                      * print csvContents[0] 
                                      * print csvContents[0].Instrument ID
                                      

                                      But its throws the below error

                                      01: karate.log('[print]',csvContents[0].Instrument ID)
                                      <<<<
                                      org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:1:43 Expected , but found ID
                                      karate.log('[print]',csvContents[0].Instrument ID)
                                      

                                      ANSWER

                                      Answered 2022-Mar-25 at 12:52

                                      Use the JS "bracket" notation. For example, try this:

                                      * csv data = 
                                      """
                                      Instrument ID, Instrument Name
                                      SS-01,TestData
                                      """
                                      * match data[0]['Instrument ID'] == 'SS-01'
                                      

                                      Source https://stackoverflow.com/questions/71616479

                                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                      Vulnerabilities

                                      No vulnerabilities reported

                                      Install polyglot

                                      You can install using 'pip install polyglot' or download it from GitHub, PyPI.
                                      You can use polyglot like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

                                      Support

                                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                                      DOWNLOAD this Library from

                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                                      over 430 million Knowledge Items
                                      Find more libraries
                                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                                      Explore Kits

                                      Save this library and start creating your kit

                                      Share this Page

                                      share link
                                      Consider Popular Natural Language Processing Libraries
                                      Try Top Libraries by aboSamoor
                                      Compare Natural Language Processing Libraries with Highest Support
                                      Compare Natural Language Processing Libraries with Highest Quality
                                      Compare Natural Language Processing Libraries with Highest Security
                                      Compare Natural Language Processing Libraries with Permissive License
                                      Compare Natural Language Processing Libraries with Highest Reuse
                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                                      over 430 million Knowledge Items
                                      Find more libraries
                                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                                      Explore Kits

                                      Save this library and start creating your kit

                                      • © 2022 Open Weaver Inc.