jbkunst / rchess Goto Github PK
View Code? Open in Web Editor NEW♛ Chess package for R
Home Page: http://jkunst.com/rchess
License: Other
♛ Chess package for R
Home Page: http://jkunst.com/rchess
License: Other
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"
Hi jb
any idea why the build failed?
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)
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
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)
[email protected] saids:
I noticed that in chess class, headers can't be returned, but in original chess.js this is done using header function without parameters.
Hi, found a list of wrong pgns in CRAN version:
A40
B69
B78
D49
D68
D69
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).
game <- head(chesswc,1)
Would it then be possible to have a function with parameters game,move, player
so I could then plot board after e.g. whites 11th move
Inspired in https://dev.windows.com/en-us/microsoft-edge/testdrive/demos/chess/ it will be fun if we can implement a chess engine like:
For example any of the chesswc games
This would entail creating a plot for every move and combining them - using ?animation package
@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?
Adding https://github.com/jbkunst/chessboardjs-themes to the rchess package
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.