Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cameleon2 # ���� �������� 2
- def initialize #����������� ��������� ������
- @size = 35; #������
- @color2 = "yellow"; #����
- @weight = 11; #���
- end
- def feed #����� ��������� ��������� �������� �� +2 � +1 ������� ����
- @size += 2;
- @color2 = "Green";
- @weight += 3;
- end
- def walk #����� �������� �������� ��������
- @size -= 3;
- @color2 = "white"
- @weight -= 1;
- end
- #������ ��� ���������� ������������ ����������
- def death
- case death2
- when @size <= 0
- puts "�� ���� ��� ����("
- when @size >= 100
- puts "�� ������, �� ������ ��������"
- when @weight <= 0
- puts "�� ���� �� ������"
- else @weight >= 100
- puts "�� ������"
- end
- end
- def life
- puts " ������ ������� #{@size}, ���� ������� #{@color2},��� ������� #{@weight}"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment