litan / kojo

The Kojo Learning Environment
http://www.kogics.net/kojo
Other
69 stars 22 forks source link

Adding simple chess features #47

Closed bjornregnell closed 2 years ago

bjornregnell commented 3 years ago

Here we can discuss things to add related to the Chess project.

bjornregnell commented 3 years ago

The Swedish Turtle is here: https://github.com/litan/kojo/blob/master/src/main/scala/net/kogics/kojo/lite/i18n/svInit.scala

litan commented 3 years ago

Looking forward, Bjorn and Ida...

bjornregnell commented 3 years ago

@IdaRasmark If I remember correctly you made a list of some initial ideas of what chess-functions could be added?

IdaRasmark commented 2 years ago

Yes I have some functionalities that I want to add. Here is a list of functions:

-notation() Prints the numbers and letters around the chessboard. I think this can be made into an argument that is optional in the board()-function. Something like: board("notation") or board(1). What do you think?

The rest ones I am not so sure about whether if they should be made or not.. feels a bit like if there is functions like this, maybe other functions like moveLeft()/moveRight() can be made aswell. I dont know... Please let me know that you think!

-backwards() Moves the turtle backwards 25 pixls without moving the direction of the turtle

-diagonalUpLeft() # I dont think I like the name of this function Moves the turtle to the square that is diagonally up to the left of the turtle. Does not change the direction of the turtle.

-diagonalUpRight() -diagonalDownRight() -diaogonalDownLeft()

IdaRasmark commented 2 years ago

@litan I and Björn were talkning about where you think it's a good idea for me to put the code? Maybe it's good to do it like you have done before: That the real code is made in the english turtle, and then the swedish commands just calls the english ones. Do you think that sounds like a good idea? In what file would that be?

litan commented 2 years ago

As a first cut, how about if we use the approach that we once discussed, and that I have been using for a lot of the recent kojo extensions (like kojo-ai, kojo-arduino etc).

The approach (as it might apply to the chess stuff) is roughly the following:

Now, kids can write something like this in the script editor:

// #include /chess.kojo
// OR (as both the above and below are equivalent)
// #include /chess

board()
startingPoint(whatever)
// etc

How does that sound?

chess.kojo can include the core commands defined in English, and Swedish versions of these commands can currently be in the same file - and can call the English versions. Once we have something up and running, we can figure out how to separate these (the English and Swedish versions) out nicely and cleanly...

bulent2k2 commented 2 years ago

Can you please provide an overview of this project?

I am interested in developing a Turkish Checkers script (spin off from Othello code) and we can probably share most of the core API...

Bulent

On 2021-10-08 12:49, Bjorn Regnell wrote:

Here we can discuss things to add related to the Chess project.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2].

Links:

[1] https://github.com/litan/kojo/issues/47 [2] https://github.com/notifications/unsubscribe-auth/AATYODT3CLLEKILE7IJPZJ3UF4OJLANCNFSM5FUAM53Q

bulent2k2 commented 2 years ago

Please ignore my last comment. Some of the earlier comments I missed clarify things for me for now.

bjornregnell commented 2 years ago

OK thanks @bulent2k2 . The project is focused on very simple code snippets for young kids related to chess, e.g. drawing a chess board and making pieces move. It is connected to CHESSPLUS and a project lead by Jesper Hall. More info here:

The project to connect CHESSPLUS and Kojo is still in its early stages and has been somewhat delayed, but @IdaRasmark at the Science Center of Lund University in Sweden is working on exoeriments for kids.

IdaRasmark commented 2 years ago

Hey guys! Now, after a very long time, I have added the chess commands in the way that you described @litan. I haven't made a pull request yet, I can do that if you want me to! Otherwise you can look at what I added here: https://github.com/IdaRasmark/kojo/tree/master/src/main/resources/chess

As i was testing the code I noted that a few commands didn't work in webb-kojo:

I manage (I think) to work around that. But just FYI :)

Please come with feedback!

litan commented 2 years ago

Sounds good @IdaRasmark. I will manually pull this in tomorrow (so there is no need for a pull request).

With regard to iKojo (just FYI):

litan commented 2 years ago

I have integrated chess.kojo. Here's some sample code that uses the script:

// #include /chess.kojo
clear()
notation()
board()
startingPoint("F1")
diagonalNortheast()
forward()
backward()

This will be available in the next version of Kojo, which will be released in the next day or two. @IdaRasmark you are welcome to keep refining chess.kojo. The refinements will become available in successive Kojo releases , which happen as frequently as once a month -- depending on what new features need to go out to users.

litan commented 2 years ago

This will be available in the next version of Kojo, which will be released in the next day or two.

FYI, a new version of Kojo, which includes the chess script, has been released.

IdaRasmark commented 2 years ago

Great! I have already made some changes that will be finnished in a day or two.

setPosition(x,y) is a good command, I will remember that in the future :)

I have some questions:

This was fun!

IdaRasmark commented 2 years ago

Ah one more question!

litan commented 2 years ago

Can I just put the translation of the commands in the same file? They will just call the corresponding version in english.

Yes.

Answers to the other questions later tonight!

litan commented 2 years ago

Will/can chess.kojo be accessed in webb-kojo? Is there a lot of work that need to be done to make that work?

I will have to explore (currently iKojo has no include mechanism).

is it possible for me to change the code so that you only need to write the command (example: backward, diagonalNorthEast) without paranthesis for the commands that does not need arguments?

No change needed in chess.kojo. This should already work!

When I feel ready with my changes, I will just make a pull request right?

Yes, that sounds good.

litan commented 2 years ago

Features added via https://github.com/litan/kojo/pull/57