GithubHelp home page GithubHelp logo

rchess's Introduction

rchess A chess package for R

travis-status version downloads

The rchess package is a chess move, generation/validation, piece placement/movement, and check/checkmate/stalemate detection.

This Packages is a wrapper for the chess.js javascript library and integrates htmlwidget for plot chessboard using chessboardjs library.

For installation you use:

install.packages("rchess")
# Or
devtools::install_github("jbkunst/rchess")

rchess's People

Contributors

jbkunst avatar oganm avatar retowyss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rchess's Issues

simultaneous castling and check

Founded by José Miguel González Aguilera:

Problem to record the towers movements when in a game it produces castling and check in the same move (probably same with castling + checkmate)

Unclear why this is an invalid move

Restarting R session...

> library(rchess)

> chss <- Chess$new()
> chss$move("g4")
> chss$move("e5")
> chss$move("f3")
> chss$move("Qh4")
Error: move is not a posible move

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rchess_0.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.6      V8_1.1           digest_0.6.9     dplyr_0.5.0      assertthat_0.1   grid_3.3.0       R6_2.1.2         plyr_1.8.4       jsonlite_1.0    
[10] gtable_0.2.0     DBI_0.4-1        magrittr_1.5     scales_0.4.0     ggplot2_2.1.0    stringi_1.1.1    curl_1.1         tools_3.3.0      stringr_1.0.0   
[19] htmlwidgets_0.6  munsell_0.4.3    colorspace_1.2-6 htmltools_0.3.5  tibble_1.1      
> 

ps typo "posible"

wrong pgn in the chessopenings dataset

Hi, found a list of wrong pgns in CRAN version:

  • in row 40, A40
  • in row 180, B69
  • in row 191, B78
  • in row 402, D49
  • in row 422, D68
  • in row 423, D69
  • in row 445, D89

Then I checked your github version and I see that you fixed all of them except the first one, that is still

1...e5 (Englund Gambit), 1...b5 (Polish Defence), 1...Nc6 (Nimzowitsch Defence), 1...g6 (Modern Defence without 2. e4), 1...e6 (French Indian Defence).

Input moves via shiny?

Hi! I love that you've made and kept up this package. I'm trying to build a shiny app and I'm having a hell of a time getting user-input moves to register via your example code, e.g. chss$move("f4") .
The typical error I'm getting is : Error:attempt to apply non-function because it's treating the chss environment as, well, an environment and so calling chss$mov() isn't a function that can be embedded within a reactive wrapper. Does that make sense?

I'm trying to implement this code:

ui = shinyUI(
  fluidPage(
      # chessboardjsOutput('board', width = 300), 
      textInput("mv", "Input Your Move", placeholder = "Move"),
      actionButton("make_move", label = "Move", icon = icon("chess")),
      tags$p("Available Moves"),
      textOutput(outputId = "avail"), 
      tags$p("Move History"),
      tableOutput(outputId = "hist"),
      tags$p("Turn:", textOutput(outputId = "turn_is"))
      )
    )
  

server = function(input, output, session) {
  
  chss <- Chess$new()
  chss<-observeEvent(input$make_move, {
    chss$move(quote(mv)) 
  }, 
  ignoreNULL = T)
  # output$board <- renderChessboardjs({
  #   chessboardjs()
  # })
  output$avail<-reactive({
    chss$moves()
  })
  output$turn_is<-reactive({
    chss$turn()
  })
  output$hist<-reactive({
    chss$history(verbose=T)
  })
   

  
}

shinyApp(ui = ui, server = server)

Bug in history_detail

@kurtgodden said:

library("rchess")
library("dplyr") # for fitler and join

pgn <- "1. e4 e5"

chss <- Chess$new()
chss$load_pgn(pgn)
plot(chss)

history <- chss$history_detail()

Error in eval(expr, envir, enclos) :
  object 'number_move_capture' not found

I found that chss$history() is ok, but chss$history_detail() gives the error.

Is that a bug?

plot problem on google colab

environment
google colab

plot not show anything

%%R
chess5 <- Chess$new("k7/8/n7/8/8/8/8/7K b - - 0 1")
plot(chess5)

plot type ggplot cant load chess pieces

%%R
chess5 <- Chess$new("k7/8/n7/8/8/8/8/7K b - - 0 1")
plot(chess5, type = "ggplot")

image

Can't load pgn!

When trying to load a pgn, I'm getting this following error. Any idea what's going wrong?

devtools::install_github("jbkunst/rchess")
library("rchess")
pgn <- system.file("~/Desktop/Awesome_Scripts/ChessAnalysis/lichess_ansjovis86_2015-11-21.pgn", package = "rchess")

file("") only supports open = "w+" and open = "w+b": using the former

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.