Sha256: 86d1af727cbe04d9d79b5e830247dd0eb22f6c33919c7099057e3b02ec11e93f
Contents?: true
Size: 854 Bytes
Versions: 4
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true require_relative 'has_hints' # Ein Move repräsentiert eine Bewegung eines Steins auf dem Spielbrett class Move include HasHints # @!attribute [r] Koordinaten von dem der Spielstein in diesem Zug wegbewegt wird # @return [Coordinates] attr_reader :from # @!attribute [r] Koordinaten zu denen der Spielstein in diesem Zug hinbewegt wird # @return [Coordinates] attr_reader :to # Erstellt ein neuen Zug. def initialize(from, to) @from = from @to = to @hints = [] end def piece(gamestate) gamestate.board.field_at(from).piece end def piece_t(gamestate) gamestate.board.field_at(to).piece end def ==(other) from == other.from && to == other.to end # @return [String] Gibt die String-Repräsentation zurück def to_s "Move(#{from}->#{to})" end end
Version data entries
4 entries across 4 versions & 1 rubygems