Coder Social home page Coder Social logo

tearth / bitboard-viewer Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 4.0 39 KB

Bitboard viewer for chess developers.

Home Page: https://tearth.dev/bitboard-viewer/

License: GNU Affero General Public License v3.0

CSS 6.58% HTML 38.96% JavaScript 54.46%
chess chess-programming chess-engine bitboard

bitboard-viewer's Introduction

bitboard-viewer's People

Contributors

eliaskramer avatar paulderaadt avatar tearth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bitboard-viewer's Issues

Add vertical/rank-first layouts?

Would it be possible to add the 4 layouts that start counting bits vertically first, instead of horizontally?

Specifically I'm taking about these ones:

07 15 .. .. .. .. .. ..    00 08 .. .. .. .. .. ..    .. .. .. .. .. .. 15 07    .. .. .. .. .. .. 08 00
06 14 .. .. .. .. .. ..    01 09 .. .. .. .. .. ..    .. .. .. .. .. .. 14 06    .. .. .. .. .. .. 09 01
05 13 .. .. .. .. .. ..    02 10 .. .. .. .. .. ..    .. .. .. .. .. .. 13 05    .. .. .. .. .. .. 10 02
04 12 .. .. .. .. .. ..    03 11 .. .. .. .. .. ..    .. .. .. .. .. .. 12 04    .. .. .. .. .. .. 11 03
03 11 .. .. .. .. .. ..    04 12 .. .. .. .. .. ..    .. .. .. .. .. .. 11 03    .. .. .. .. .. .. 12 04
02 10 .. .. .. .. .. ..    05 13 .. .. .. .. .. ..    .. .. .. .. .. .. 10 02    .. .. .. .. .. .. 13 05
01 09 .. .. .. .. .. ..    06 14 .. .. .. .. .. ..    .. .. .. .. .. .. 09 01    .. .. .. .. .. .. 14 06
00 08 .. .. .. .. .. ..    07 15 .. .. .. .. .. ..    .. .. .. .. .. .. 08 00    .. .. .. .. .. .. 15 07

I'm not sure how to best put these into a UI though, since 8 possible layouts is starting to get crowded.

Bug with shift left when bit is at max index

First of all, thanks a lot for making this tool, it has been extremely helpful this far

I found a small bug:
When the current value has the bit as the most significant index set (e.g. 0x8000000000000000) and you click on the Shift Left button, the values will actually not be reset to zero, but it's as if that bit is kept (e.g. shifting 0x8000000000000000 left by one results in 0x10000000000000000, which is more than a 64-bit unsigned value can hold).

Further pressing "shift left" will continue increasing the number. It is only reset once the "1" bit would re-enter the range of the first 64 bits.

Note: I feel like this could simply be fixed by checking if the value becomes larger or equal to 2^64, and if so, reset all values to zero. Not sure but worth a try

the indexes of the squares should start with 1 so the last square is 64 for quick easy math

the indexes of the squares should start with 1 so the last square is 64 for quick easy math

since the board is 8x8... having the squares start with 1 instead of 0 will be very helpful because dividing by 8 is very useful for calculating moves and since your squares don't line up very well with that number the math is tough because you need to add 1 to every calculation to accommodate the math so the calculations are quick and easy

i hope that helps

email me if i was confusing. i assure you this is very helpful information if you want to use bitboards to solve chess

one Important thing to take note of is how the operating systems handle 64 bit integers... some systems seem to use the last bit of a long integer (64 bit) for assigning negative values to the numbers...

if the systems are doing this.. then 1 square is likely useless unless there is something i'm missing...
as of now i'm calling this the 'the 64 bit signed long integer problem'

the value of a bitboard with all 1's in every bit location should be this number: "18 446 462 598 732 906 495"
but some system seem to have a max long int of 9,223,372,036,854,775,807... this is because the last bit is used for negative numbers.... which is very very bad for chess computers because they can't calculate one of the squares on the board (the last square (h8) usually i think?

luckily something does seem to accommodate this.. there might be an unsigned long integer variable type you can use?

i found this wiki article about languages that use unsigned integers... you might have to use smaller datatypes and combine them to get the 64 bit equivalent

you can search for the word 'unsigned' by hitting ctrl+f if you don't know how.. that will help you find the part of the document you need

https://en.wikipedia.org/wiki/Comparison_of_programming_languages_(basic_instructions)

i also found this article.. one reply might be helpful.. things can be confusing... check out the post where the guy says 'unsigned integers aren't useful' he might have accidentally been helpful without knowing it

https://stackoverflow.com/questions/40884030/how-to-declare-an-unsigned-int-variable-in-javascript

i'm going to copy the code and take a look at it myself and i might try to do stuff with it later

oh one more note... logic operators are likely confusing to you because they are kinda named backwards... take a closer look you'll see...

i have these possibly helpful notes on logical/bitwise operators that i hope are helpful to you:
*i tried to rename them for myself so i could think about them more easily because whoever made them seemed to do it backwards somehow.. possibly for security.. long story.. anyway.. i hope you can get your old bitboard stuff working..looks fun.. later

original OR gate = 1 or 1 = 1
*AND/OR gate = 1 and/or 1 = 1
xor = 1 only or 1 only = 1 = new OR gate

and for real.. email me and i'll help.. my eyeballs and etc won't let me code anything that works... would be nice to help you code with a shared screen on the discord app or something... never got a chance to do this stuff like i always wanted to so i'm workin on it now a bit

[email protected]

Adding row/column buttons

Hi Tearth,

I've forked a version where I added a button to each row and column that fills the respective col/row when clicked. Makes it easy to get the magic numbers for file and rank masks.

Is this something you would be interested in adding to your project? My CSS skills are nonexistent so I don't really know how to align the buttons with the checkboxes in a neat way.

afbeelding

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.