Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. It's about chess...

It's about chess...

Scheduled Pinned Locked Moved The Lounge
comhelpquestion
16 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F F ES Sitecore

    Because I'm a software developer people think I can install their new RAM, set-up their printer, or rid their machine of viruses. It's a funny old world :)

    D Offline
    D Offline
    dandy72
    wrote on last edited by
    #7

    F-ES Sitecore wrote:

    Because I'm a software developer people think I can install their new RAM, set-up their printer, or rid their machine of viruses.

    Can, yes; willing, not so much.

    F 1 Reply Last reply
    0
    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

      xkcd: Magnus[^] Lot of times people think that just because I'm a software developer I'm good at chess too (I'm not that bad, but definitely not that good)... And seeing XKCD I was wondering why chess is so interesting after all these years... My guess - the (almost) endless number of variations of games...

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #8

      Ah, chess... I think about it once in a while. Remember this question from October? The Lounge - CodeProject[^] I think of it this way: 0) There are sixty-four spaces on a chess board 1) Each space may be unoccupied or occupied by one token (I'll try not to say "piece") 2) There are six types of token: King, Queen, Bishop, Knight, Rook/Castle, Pawn 3) There are two colors of token: Black, White (usually) 4) That makes twelve distinct token values, plus we can use a "null" token to represent an empty space, for a total of thirteen values I chess position can therefore be reduced to a sixty-four digit base-13 value. Windows calculator calculates 13^64 as 1.9605347643076107333065976042357e+71 . A great many such values will not represent a valid chess position. So all you need to do is enumerate from zero to 1.9605347643076107333065976042357e+71, eliminate the invalid values and determine a pair of "best next position" values (one for black, one for white), and store them. Then during a game, a simple look-up is all that is needed to select your move. It becomes boring really; hardly any challenge at all. Here's what I wrote in October; this is the hard part:

      [System.ComponentModel.DescriptionAttribute("Chess piece definition")]
      public enum Piece
      {
      [System.ComponentModel.DescriptionAttribute("No piece, empty square")]
      None = 0
      ,
      [System.ComponentModel.DescriptionAttribute("Piece has a special or limiting movement rule")]
      SpecialMask = 1
      ,
      [System.ComponentModel.DescriptionAttribute("Piece can move only in ranks or files")]
      OrthogonalMask = 2
      ,
      [System.ComponentModel.DescriptionAttribute("Piece can move diagonally")]
      DiagonalMask = 4
      ,
      [System.ComponentModel.DescriptionAttribute("Black chess piece")]
      BlackMask = 8
      ,
      [System.ComponentModel.DescriptionAttribute("Knight")]
      Knight = 1
      ,
      [System.ComponentModel.DescriptionAttribute("Rook")]
      Rook = 2
      ,
      [System.ComponentModel.DescriptionAttribute("Pawn")]
      Pawn = 3
      ,
      [System.ComponentModel.DescriptionAttribute("Bishop")]
      Bishop = 4
      ,
      [System.ComponentModel.DescriptionAttribute("Queen")]
      Queen = 6
      ,
      [System.ComponentModel.DescriptionAttribute("King")]
      King = 7
      }

      :wtf:

      Kornfeld Eliyahu PeterK H 2 Replies Last reply
      0
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        xkcd: Magnus[^] Lot of times people think that just because I'm a software developer I'm good at chess too (I'm not that bad, but definitely not that good)... And seeing XKCD I was wondering why chess is so interesting after all these years... My guess - the (almost) endless number of variations of games...

        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

        N Offline
        N Offline
        Nueman
        wrote on last edited by
        #9

        Kornfeld Eliyahu Peter wrote:

        the (almost) endless number of variations of games

        Relax and play[^]

        What we got here is a failure to communicate

        P 1 Reply Last reply
        0
        • P PIEBALDconsult

          Ah, chess... I think about it once in a while. Remember this question from October? The Lounge - CodeProject[^] I think of it this way: 0) There are sixty-four spaces on a chess board 1) Each space may be unoccupied or occupied by one token (I'll try not to say "piece") 2) There are six types of token: King, Queen, Bishop, Knight, Rook/Castle, Pawn 3) There are two colors of token: Black, White (usually) 4) That makes twelve distinct token values, plus we can use a "null" token to represent an empty space, for a total of thirteen values I chess position can therefore be reduced to a sixty-four digit base-13 value. Windows calculator calculates 13^64 as 1.9605347643076107333065976042357e+71 . A great many such values will not represent a valid chess position. So all you need to do is enumerate from zero to 1.9605347643076107333065976042357e+71, eliminate the invalid values and determine a pair of "best next position" values (one for black, one for white), and store them. Then during a game, a simple look-up is all that is needed to select your move. It becomes boring really; hardly any challenge at all. Here's what I wrote in October; this is the hard part:

          [System.ComponentModel.DescriptionAttribute("Chess piece definition")]
          public enum Piece
          {
          [System.ComponentModel.DescriptionAttribute("No piece, empty square")]
          None = 0
          ,
          [System.ComponentModel.DescriptionAttribute("Piece has a special or limiting movement rule")]
          SpecialMask = 1
          ,
          [System.ComponentModel.DescriptionAttribute("Piece can move only in ranks or files")]
          OrthogonalMask = 2
          ,
          [System.ComponentModel.DescriptionAttribute("Piece can move diagonally")]
          DiagonalMask = 4
          ,
          [System.ComponentModel.DescriptionAttribute("Black chess piece")]
          BlackMask = 8
          ,
          [System.ComponentModel.DescriptionAttribute("Knight")]
          Knight = 1
          ,
          [System.ComponentModel.DescriptionAttribute("Rook")]
          Rook = 2
          ,
          [System.ComponentModel.DescriptionAttribute("Pawn")]
          Pawn = 3
          ,
          [System.ComponentModel.DescriptionAttribute("Bishop")]
          Bishop = 4
          ,
          [System.ComponentModel.DescriptionAttribute("Queen")]
          Queen = 6
          ,
          [System.ComponentModel.DescriptionAttribute("King")]
          King = 7
          }

          :wtf:

          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu Peter
          wrote on last edited by
          #10

          Actually all chess programs are combining two things... 1. Basic knowledge of the chess rules 2. A lookup of pr-recorded strategies (for opening, play and end-play separately in most cases) The reason for that is that there is on really best-move for most parts of the game...Chess is not only about moving the pieces around but to build a defense/offense strategy that will provide you not only with small victories but winning the war too... There is a few estimates of the number of possible chess games (between 10^50 to 10^120) and they say there is more chess games than atoms in the universe (which of course has no base and only effective as a way to tell that there are unimaginably large number of games)...

          Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

          "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

          1 Reply Last reply
          0
          • D dandy72

            F-ES Sitecore wrote:

            Because I'm a software developer people think I can install their new RAM, set-up their printer, or rid their machine of viruses.

            Can, yes; willing, not so much.

            F Offline
            F Offline
            F ES Sitecore
            wrote on last edited by
            #11

            Shhhhhh....keep that to yourself ;)

            1 Reply Last reply
            0
            • P PIEBALDconsult

              Ah, chess... I think about it once in a while. Remember this question from October? The Lounge - CodeProject[^] I think of it this way: 0) There are sixty-four spaces on a chess board 1) Each space may be unoccupied or occupied by one token (I'll try not to say "piece") 2) There are six types of token: King, Queen, Bishop, Knight, Rook/Castle, Pawn 3) There are two colors of token: Black, White (usually) 4) That makes twelve distinct token values, plus we can use a "null" token to represent an empty space, for a total of thirteen values I chess position can therefore be reduced to a sixty-four digit base-13 value. Windows calculator calculates 13^64 as 1.9605347643076107333065976042357e+71 . A great many such values will not represent a valid chess position. So all you need to do is enumerate from zero to 1.9605347643076107333065976042357e+71, eliminate the invalid values and determine a pair of "best next position" values (one for black, one for white), and store them. Then during a game, a simple look-up is all that is needed to select your move. It becomes boring really; hardly any challenge at all. Here's what I wrote in October; this is the hard part:

              [System.ComponentModel.DescriptionAttribute("Chess piece definition")]
              public enum Piece
              {
              [System.ComponentModel.DescriptionAttribute("No piece, empty square")]
              None = 0
              ,
              [System.ComponentModel.DescriptionAttribute("Piece has a special or limiting movement rule")]
              SpecialMask = 1
              ,
              [System.ComponentModel.DescriptionAttribute("Piece can move only in ranks or files")]
              OrthogonalMask = 2
              ,
              [System.ComponentModel.DescriptionAttribute("Piece can move diagonally")]
              DiagonalMask = 4
              ,
              [System.ComponentModel.DescriptionAttribute("Black chess piece")]
              BlackMask = 8
              ,
              [System.ComponentModel.DescriptionAttribute("Knight")]
              Knight = 1
              ,
              [System.ComponentModel.DescriptionAttribute("Rook")]
              Rook = 2
              ,
              [System.ComponentModel.DescriptionAttribute("Pawn")]
              Pawn = 3
              ,
              [System.ComponentModel.DescriptionAttribute("Bishop")]
              Bishop = 4
              ,
              [System.ComponentModel.DescriptionAttribute("Queen")]
              Queen = 6
              ,
              [System.ComponentModel.DescriptionAttribute("King")]
              King = 7
              }

              :wtf:

              H Offline
              H Offline
              H Brydon
              wrote on last edited by
              #12

              Your analysis doesn't allow for en passant or "You can/can't castle"...

              I'm retired. There's a nap for that... - Harvey

              P 1 Reply Last reply
              0
              • H H Brydon

                Your analysis doesn't allow for en passant or "You can/can't castle"...

                I'm retired. There's a nap for that... - Harvey

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #13

                Yes it does: [System.ComponentModel.DescriptionAttribute("Piece has a special or limiting movement rule")] SpecialMask = 1 Knight, King, and Pawn all have that Flag.

                H 1 Reply Last reply
                0
                • N Nueman

                  Kornfeld Eliyahu Peter wrote:

                  the (almost) endless number of variations of games

                  Relax and play[^]

                  What we got here is a failure to communicate

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #14

                  How about a nice game of chess?

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Yes it does: [System.ComponentModel.DescriptionAttribute("Piece has a special or limiting movement rule")] SpecialMask = 1 Knight, King, and Pawn all have that Flag.

                    H Offline
                    H Offline
                    H Brydon
                    wrote on last edited by
                    #15

                    Having the flag doesn't complete the problem. The state of a board position needs to include whether an en passant move or a rook/king move has recently or already taken place. Just knowing that a move could have taken place doesn't work. [... not sure what you mean about knight. I think you meant rook.]

                    I'm retired. There's a nap for that... - Harvey

                    P 1 Reply Last reply
                    0
                    • H H Brydon

                      Having the flag doesn't complete the problem. The state of a board position needs to include whether an en passant move or a rook/king move has recently or already taken place. Just knowing that a move could have taken place doesn't work. [... not sure what you mean about knight. I think you meant rook.]

                      I'm retired. There's a nap for that... - Harvey

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #16

                      Pfft. That's details. I meant Knight. Rooks have nothing special other than being at the mercy of the King during a castling move. The goal of that exercise was merely to assign 4-bit values to the tokens in a "logical" manner. I have no ambition to implement the system as described.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups