tic tac toe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 1051109210
    New Member
    • Mar 2007
    • 29

    tic tac toe

    im been googling around on how to programme the ai part for this game and alot mentioned about rotating the board... how do i rotate this board.
    thnks
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you mean like rotating 90/180/270 degrees?
    180° invert the col and row numbers
    90°/270° switch col/row numbers and invert col numbers

    Comment

    • 1051109210
      New Member
      • Mar 2007
      • 29

      #3
      oh yea switchin the values....meani n?


      0 1 2
      a
      b
      c

      a b c
      0
      1
      2
      then ? if rotate again 012 will be at bottom same as beginin

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        let's assume your IDs are like in the thread: b00, b01, b02, b10, ...
        Code:
        00 01 02           20 10 00
        10 11 12  becomes  21 11 01
        20 21 22           22 12 02

        Comment

        • 1051109210
          New Member
          • Mar 2007
          • 29

          #5
          so after tht the other two will be
          Code:
          20 21 22
          10 11 12
          00 01 02
          
          
          
          00 10 20
          01 11 21
          02 12 22
          right?

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            very close, but both can not be reached by rotation alone.

            Comment

            • 1051109210
              New Member
              • Mar 2007
              • 29

              #7
              huh wht do you mean?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                make a sheet of paper, write down the IDs and turn it by 90°. you'll see, how the numbers will change places correctly.

                background: symmetry operations
                a plain square belongs to the Point Group D(4h) (which essentially tells you, what symmetry operations are possible). from that you can conclude, that there are 8 possibilities to switch the fields without losing the relative positioning (in the end you have a 4fold axis (rotation by 90°) making 4 positionings and the mirror images of these making a total of 8)

                Comment

                • 1051109210
                  New Member
                  • Mar 2007
                  • 29

                  #9
                  hmhm i think i got it....will think abt it tmr (kinda late from where i'm at)
                  thanks alot! and for bein patience with my ques !! :D

                  Comment

                  Working...