-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83f1a2a
commit f535326
Showing
2 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package character | ||
|
||
import "fmt" | ||
|
||
type Character struct { | ||
Name string | ||
Intellect int | ||
Psyche int | ||
Physique int | ||
Motorics int | ||
} | ||
|
||
func (c *Character) SetName(name string) { | ||
c.Name = name | ||
} | ||
|
||
func (c *Character) GetOverallPoints() int { | ||
return c.Intellect + c.Psyche + c.Physique + c.Motorics | ||
} | ||
|
||
func (c *Character) PrintDetails() { | ||
fmt.Printf("Name: %s\nIntellect: %d\nPsyche: %d\nPhysique: %d\nMotorics: %d\n", c.Name, c.Intellect, c.Psyche, c.Physique, c.Motorics) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
package main | ||
import ( | ||
"fmt" | ||
"isuct.ru/informatics2022/internal" | ||
) | ||
func main() { | ||
fmt.Println("Кувшинов Владислав") | ||
fmt.Println(internal.CalculateFunctionInRanges(0.26, 0.66, 0.08)) | ||
fmt.Println(internal.CalculateFunctionWithXValues([]float64{0.1, 0.35, 0.4, 0.55, 0.6})) | ||
} | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"isuct.ru/informatics2022/character" | ||
"isuct.ru/informatics2022/internal" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Кувшинов Владислав") | ||
fmt.Println(internal.CalculateFunctionInRanges(0.26, 0.66, 0.08)) | ||
fmt.Println(internal.CalculateFunctionWithXValues([]float64{0.1, 0.35, 0.4, 0.55, 0.6})) | ||
|
||
player := character.Character{Name: "Гарри Дюбуа", Intellect: 8, Psyche: 7, Physique: 6, Motorics: 5} | ||
|
||
player.PrintDetails() | ||
|
||
// Изменение имени персонажа | ||
player.SetName("Диджей Миша") | ||
fmt.Println("Имя персонажа после изменения:", player.Name) | ||
|
||
// Вывод общей силы персонажа | ||
power := player.GetOverallPoints() | ||
fmt.Println("Общая сила персонажа:", power) | ||
} |