Skip to content

Pure attack functions (Attack Layer) #55

@Hardcode3

Description

@Hardcode3

🎯 Goal

Extract a pure attack layer, fully independent from legality, colors, kings, or move objects.

🧠 Key Idea

An *_attacks() function:

  • returns a Bitboard
  • depends only on (Square from, Bitboard occupied)
  • never creates a Move

🛠️ Tasks

Implement sliders (occupancy dependent attacks):

  • bishop_attacks(from, occupied)
  • rook_attacks(from, occupied)
  • queen_attacks = bishop | rook

Implement non sliders (occupancy independent attacks):

  • knight_attacks[from]

  • king_attacks[from]

  • pawn_attacks(color, from)

  • Rename ambiguous functions (generate_* -> *_attacks)

  • Ensure no board or color logic leaks into this layer

✅ Acceptance Criteria

  • Attacks match the old pseudo-legal generators
  • No legality filtering
  • No move creation

Metadata

Metadata

Assignees

Labels

move-generationChess moves generation (legal, pseudo-legal).refactoringRefactoring pieces of code of any kind.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions