Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions golang/character/character.go
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)
}
36 changes: 23 additions & 13 deletions golang/main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
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)
}