Author Topic: AXECHESS - The First Chess made in Axe  (Read 23316 times)

0 Members and 2 Guests are viewing this topic.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #30 on: November 09, 2012, 07:26:44 pm »
Not if all 64 squares are accounted for. It would probably be a lot easier to keep track of all squares than to deal with 32 pieces - mainly because of pawn promotion.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #31 on: November 09, 2012, 07:35:44 pm »
Pawn promotion wouldn't be too difficult, if you've got an array of pieces. If a piece moves to the opposite edge, then if it's a pawn, it becomes a queen. That doesn't really change with your storage method.
« Last Edit: November 09, 2012, 07:36:12 pm by willrandship »

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #32 on: November 09, 2012, 08:07:19 pm »
Oh, I see. I was imagining that you were thinking of a separate array for each type of piece... Silly me.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: AXECHESS - The First Chess made in Axe
« Reply #33 on: November 09, 2012, 09:51:47 pm »
it needs one more attribute: Alive or dead. Way easier than having a dynamically resizing list, and you just check that first before moving.
Well I was thinking that dead pieces could be type 0 or something, so that you wouldn't need 32 more bytes (or nibbles) just for that attribute.
In-progress: Graviter (...)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #34 on: November 09, 2012, 11:41:40 pm »
That would work, especially since pieces never have to come back from the dead.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #35 on: November 10, 2012, 12:50:05 am »
I second leafy's suggestion, having specific coordinates would make checking for valid moves a cinch, and you could even show possible moves based on the piece's present location.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: AXECHESS - The First Chess made in Axe
« Reply #36 on: November 10, 2012, 05:19:27 am »
You guys no read other's posts? I accounted everything I said in the code I posted. Lol.
[sorry this is not meant rude, I'm just kind of surprised you had not seen it]
EDIT: quoting myself:
Ok I made your graphics routine slightly shorter, but your data needs to be restructured.
Code: [Select]
data structure:
-sprites:
[hexWPAWN]->Pic1PCS
[hexWBISHOP][hexWKNIGHT][hexWROOK][hexWQUEEN][hexWKING][continue here for the 6 black pieces]

-------

how the pieces are stored in L1:
{taken?(0 if still on the board),xpos,ypos,pieceno(0=pawn,1=bishop, just like the sprite arrangement, and no need for B/W pieces)}

-----
Now the big thing: drawing the stuff.

For(A,0,31)
  if {A*4+L1}=!0
    A>15->B
    pt-on(A*4+L1+1,A*4+L1+2,8*{A*4+L1+3}+Pic1PCS+48*B)     ;; the x and y positions might be a bit off. you should change this later on.
  end
end
I think that will do it :D
« Last Edit: November 10, 2012, 05:21:12 am by aeTIos »
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #37 on: November 10, 2012, 06:02:13 am »
    pt-on(A*4+L1+1,A*4+L1+2,8*{A*4+L1+3}+Pic1PCS+48*B)
But that will never work ???
A*4+L1+1 is far beyond 96, A*4+L1+2 is far beyond 64 so there is nothing drawn on screen, and 8*{A*4+L1+3}+Pic1PCS+48*B is surely not the right number, since you multiplied Pic1PCS by B.
(Your line could be optimized as pt-on(A*4+L1+1,+1,{+1}*8+Pic1PCS+48*B) but it is not important since the code is wrong)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: AXECHESS - The First Chess made in Axe
« Reply #38 on: November 10, 2012, 06:04:19 am »
erw, you are right T.T thanks for pointing that out. (I haven't programmed in a loooong time)
I made a huge mistake: the pt-on command should be this:
pt-on({A*4+L1+1},{A*4+L1+2},8*{A*4+L1+3}+Pic1PCS+(48*B))
Sorry o*.*o
« Last Edit: November 10, 2012, 06:06:33 am by aeTIos »
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #39 on: November 10, 2012, 06:19:04 am »
erw, you are right T.T thanks for pointing that out. (I haven't programmed in a loooong time)
I made a huge mistake: the pt-on command should be this:
pt-on({A*4+L1+1},{A*4+L1+2},8*{A*4+L1+3}+Pic1PCS+(48*B))
Sorry o*.*o
That is better like that ;)
But that still can be optimized as pt-on({A*4+L1+1→r1},{r1+1},B*6+{r1+2}*8+Pic1PCS) :P

Moreover, I don't get why you make an array with pieces with X,Y,type,etc, instead of just making some sort of a tilemap on the checkerboard ???
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #40 on: November 10, 2012, 12:00:22 pm »
what would the syntax be to store all this shtuff in L1? I am somewhat confused
I am Bach.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: AXECHESS - The First Chess made in Axe
« Reply #41 on: November 10, 2012, 12:38:12 pm »
so this is the way you have it stored:
{taken,x,y,piece}
taken is the 0th element in this so-called array.
To access the nth variable of the pth piece, you need to do this:
{p*4+n+L1}
p needs to be multiplied by four because each piece uses up 4 bytes of data in the array.

Hope that explains it :)

And I agree with Hayleia that a 64-byte array for representing the board would be handier. But that's your choice :)
I'm not a nerd but I pretend:

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #42 on: November 10, 2012, 12:39:24 pm »
so... to declare it, it would be {stuff}->L1?
I am Bach.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: AXECHESS - The First Chess made in Axe
« Reply #43 on: November 10, 2012, 12:41:49 pm »
No. To declare it you would use number-to-store->{p*4+n+L1}
I'm not a nerd but I pretend:

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: AXECHESS - The First Chess made in Axe
« Reply #44 on: November 10, 2012, 12:43:56 pm »
{all stuff separated by commas}->{p*4+n+L1}?
I am Bach.