Pushing all changes

This commit is contained in:
2025-12-19 09:16:48 -07:00
parent b8f54b44a3
commit 4737531805
7 changed files with 105 additions and 13 deletions
+12 -1
View File
@@ -3,12 +3,23 @@
# Class for the player. For now does not do much.
class Player
attr_reader :name
attr_reader :name, :resources
# initializes with just the player name.
#
# @param name [String] The name of the player
def initialize(name)
@name = name
@resources = {:ships => 10, :metal => 100}
end
def add_resources(resources)
resources.keys.each do |resource_key|
if @resources[resource_key].nil?
@resources[resource_key] = resources[resource_key]
else
@resources[resource_key] += resources[resource_key]
end
end
end
end