master > master: code go - methode -> private, da nur intern im package run gebraucht

This commit is contained in:
RD 2021-11-04 11:38:43 +01:00
parent a96d1bb6c9
commit 1934c3475a
2 changed files with 22 additions and 22 deletions

View File

@ -22,13 +22,13 @@ import (
* ---------------------------------------------------------------- */ * ---------------------------------------------------------------- */
func actionAlgorithmSearchBinary() (bool, error) { func actionAlgorithmSearchBinary() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{ input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{
"muss aufsteigend sortiert sein", "muss aufsteigend sortiert sein",
}) })
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_x, cancel, err := PromptInputInteger("x", "Suchwert", []string{}) input_x, cancel, err := promptInputInteger("x", "Suchwert", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
@ -42,14 +42,14 @@ func actionAlgorithmSearchBinary() (bool, error) {
} }
func actionAlgorithmSearchInterpolation() (bool, error) { func actionAlgorithmSearchInterpolation() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{ input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{
"muss aufsteigend sortiert sein", "muss aufsteigend sortiert sein",
"sollte (idealerweise) nicht uniform verteilt sein", "sollte (idealerweise) nicht uniform verteilt sein",
}) })
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_x, cancel, err := PromptInputInteger("x", "Suchwert", []string{}) input_x, cancel, err := promptInputInteger("x", "Suchwert", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
@ -63,11 +63,11 @@ func actionAlgorithmSearchInterpolation() (bool, error) {
} }
func actionAlgorithmSearchIthElement() (bool, error) { func actionAlgorithmSearchIthElement() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{}) input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_i, cancel, err := PromptInputInteger("i", "Suchindex in sortierter Liste", []string{ input_i, cancel, err := promptInputInteger("i", "Suchindex in sortierter Liste", []string{
"sollte zw. 1 und len(L) liegen", "sollte zw. 1 und len(L) liegen",
}) })
if cancel || err != nil { if cancel || err != nil {
@ -83,11 +83,11 @@ func actionAlgorithmSearchIthElement() (bool, error) {
} }
func actionAlgorithmSearchIthElementDc() (bool, error) { func actionAlgorithmSearchIthElementDc() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{}) input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_i, cancel, err := PromptInputInteger("i", "Suchindex in sortierter Liste", []string{ input_i, cancel, err := promptInputInteger("i", "Suchindex in sortierter Liste", []string{
"sollte zw. 1 und len(L) liegen", "sollte zw. 1 und len(L) liegen",
}) })
if cancel || err != nil { if cancel || err != nil {
@ -103,7 +103,7 @@ func actionAlgorithmSearchIthElementDc() (bool, error) {
} }
func actionAlgorithmSearchJump() (bool, error) { func actionAlgorithmSearchJump() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{ input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{
"muss aufsteigend sortiert sein", "muss aufsteigend sortiert sein",
"sollte (idealerweise) nicht uniform verteilt sein", "sollte (idealerweise) nicht uniform verteilt sein",
"sollte (idealerweise) keine Duplikate enthalten", "sollte (idealerweise) keine Duplikate enthalten",
@ -111,11 +111,11 @@ func actionAlgorithmSearchJump() (bool, error) {
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_x, cancel, err := PromptInputInteger("x", "Suchwert", []string{}) input_x, cancel, err := promptInputInteger("x", "Suchwert", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_m, cancel, err := PromptInputInteger("m", "Sprunggröße", []string{ input_m, cancel, err := promptInputInteger("m", "Sprunggröße", []string{
"sollte >= 2 sein", "sollte >= 2 sein",
}) })
if cancel || err != nil { if cancel || err != nil {
@ -131,7 +131,7 @@ func actionAlgorithmSearchJump() (bool, error) {
} }
func actionAlgorithmSearchJumpExp() (bool, error) { func actionAlgorithmSearchJumpExp() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{ input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{
"muss aufsteigend sortiert sein", "muss aufsteigend sortiert sein",
"sollte (idealerweise) nicht uniform verteilt sein", "sollte (idealerweise) nicht uniform verteilt sein",
"sollte (idealerweise) keine Duplikate enthalten", "sollte (idealerweise) keine Duplikate enthalten",
@ -139,7 +139,7 @@ func actionAlgorithmSearchJumpExp() (bool, error) {
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_x, cancel, err := PromptInputInteger("x", "Suchwert", []string{}) input_x, cancel, err := promptInputInteger("x", "Suchwert", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
@ -153,7 +153,7 @@ func actionAlgorithmSearchJumpExp() (bool, error) {
} }
func actionAlgorithmSearchPoison() (bool, error) { func actionAlgorithmSearchPoison() (bool, error) {
input_L, cancel, err := PromptInputListOfZeroOnes("L", "Liste von Werten", []string{ input_L, cancel, err := promptInputListOfZeroOnes("L", "Liste von Werten", []string{
"muss genau eine 1 enthalten", "muss genau eine 1 enthalten",
}) })
if cancel || err != nil { if cancel || err != nil {
@ -169,7 +169,7 @@ func actionAlgorithmSearchPoison() (bool, error) {
} }
func actionAlgorithmSearchPoisonFast() (bool, error) { func actionAlgorithmSearchPoisonFast() (bool, error) {
input_L, cancel, err := PromptInputListOfZeroOnes("L", "Liste von Getränken", []string{ input_L, cancel, err := promptInputListOfZeroOnes("L", "Liste von Getränken", []string{
"muss genau eine 1 enthalten", "muss genau eine 1 enthalten",
}) })
if cancel || err != nil { if cancel || err != nil {
@ -185,11 +185,11 @@ func actionAlgorithmSearchPoisonFast() (bool, error) {
} }
func actionAlgorithmSearchSequential() (bool, error) { func actionAlgorithmSearchSequential() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{}) input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
input_x, cancel, err := PromptInputInteger("x", "Suchwert", []string{}) input_x, cancel, err := promptInputInteger("x", "Suchwert", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
@ -203,7 +203,7 @@ func actionAlgorithmSearchSequential() (bool, error) {
} }
func actionAlgorithmSumMaxsub() (bool, error) { func actionAlgorithmSumMaxsub() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{}) input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }
@ -217,7 +217,7 @@ func actionAlgorithmSumMaxsub() (bool, error) {
} }
func actionAlgorithmSumMaxsubDc() (bool, error) { func actionAlgorithmSumMaxsubDc() (bool, error) {
input_L, cancel, err := PromptInputListOfInt("L", "Liste von Werten", []string{}) input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
if cancel || err != nil { if cancel || err != nil {
return cancel, err return cancel, err
} }

View File

@ -12,7 +12,7 @@ import (
* CUSTOM PROMPTS für besondere Inputs * CUSTOM PROMPTS für besondere Inputs
* ---------------------------------------------------------------- */ * ---------------------------------------------------------------- */
func PromptInputInteger(name string, descr string, requirements []string) (int, bool, error) { func promptInputInteger(name string, descr string, requirements []string) (int, bool, error) {
type responseType struct { type responseType struct {
Response int `yaml:"response"` Response int `yaml:"response"`
} }
@ -28,7 +28,7 @@ func PromptInputInteger(name string, descr string, requirements []string) (int,
return response.Response, cancel, err return response.Response, cancel, err
} }
func PromptInputListOfInt(name string, descr string, requirements []string) ([]int, bool, error) { func promptInputListOfInt(name string, descr string, requirements []string) ([]int, bool, error) {
type responseType struct { type responseType struct {
Response []int `yaml:"response"` Response []int `yaml:"response"`
} }
@ -48,7 +48,7 @@ func PromptInputListOfInt(name string, descr string, requirements []string) ([]i
return response.Response, cancel, err return response.Response, cancel, err
} }
func PromptInputListOfZeroOnes(name string, descr string, requirements []string) ([]int, bool, error) { func promptInputListOfZeroOnes(name string, descr string, requirements []string) ([]int, bool, error) {
var values = []int{} var values = []int{}
type responseType struct { type responseType struct {
Response []uint8 `yaml:"response"` Response []uint8 `yaml:"response"`