Untitled

mail@pastecode.io avatar
unknown
golang
2 years ago
3.2 kB
1
Indexable
Never
package main

import (
	"fmt"
	"strings"
)

func main() {
	var arr2D [2][4]string
	var ign string
	var boss string
	var ans string
	var fC uint
	var vC uint
	var t1 uint
	var pC uint

	for pC < 8 {

		fmt.Printf("Frigg %v, Valk %v, Players %v\n", fC, vC, pC)
		fmt.Println("Phantasmic Zenith Heroic: Team split")

		fmt.Printf("Enter your IGN to participate: ")
		fmt.Scan(&ign)
		fmt.Printf("Which boss do you want to fight: Frigg or Valk? ")
		fmt.Scan(&boss)
		bossL := strings.ToLower(boss)

		switch bossL {
		case "frigg":
			if fC < 4 {
				fmt.Println("You have been added to Team 1 - Frigg")
				arr2D[0][fC] = ign
				fC++
				pC++
				fmt.Println("Do you accept or want to leave team?")
				fmt.Printf("Accept / Leave: ")
				fmt.Scan(&ans)
				ans2 := strings.ToLower(ans)
				switch ans2 {
				case "accept":
					break
				case "leave":
					if fC < 4 {
						arr2D[0][fC] = ""
						fC--
						pC--
					} else {
						arr2D[0][fC] = ""
					}
				default:
					arr2D[0][fC] = ""
					fC--
					pC--
					fmt.Println("Choice not in the list. Try again!")
				}
			} else {
				fmt.Println("Team 1 is already full. You have been automatically added to Team 2 - Valk")
				arr2D[1][vC] = ign
				vC++
				pC++
				fmt.Println("Do you accept or want to leave team?")
				fmt.Printf("Accept / Leave: ")
				fmt.Scan(&ans)
				ans2 := strings.ToLower(ans)
				switch ans2 {
				case "accept":
					break
				case "leave":
					if vC < 4 {
						arr2D[0][vC] = ""
						vC--
						pC--
					} else {
						arr2D[0][vC] = ""
					}
				default:
					fmt.Println("Choice not in the list. Try again!")
				}
			}
		case "valk":
			if vC < 4 {
				fmt.Println("You have been added to Team 2 - Valk")
				arr2D[1][vC] = ign
				vC++
				pC++
				fmt.Println("Do you accept or want to leave team?")
				fmt.Printf("Accept / Leave: ")
				fmt.Scan(&ans)
				ans2 := strings.ToLower(ans)
				switch ans2 {
				case "accept":
					break
				case "leave":
					if vC < 4 {
						arr2D[0][vC] = ""
						vC--
						pC--
					} else {
						arr2D[0][vC] = ""
					}
				default:
					fmt.Println("Choice not in the list. Try again!")
				}
			} else {
				fmt.Println("Team 2 is already full. You have been automatically added to Team 1 - Frigg")
				arr2D[0][fC] = ign
				fC++
				pC++
				fmt.Println("Do you accept or want to leave team?")
				fmt.Printf("Accept / Leave: ")
				fmt.Scan(&ans)
				ans2 := strings.ToLower(ans)
				switch ans2 {
				case "accept":
					break
				case "leave":
					if fC < 4 {
						arr2D[0][fC] = ""
						fC--
						pC--
					} else {
						arr2D[0][fC] = ""
					}

				default:
					fmt.Println("Choice not in the list. Try again!")
				}
			}
		default:
			fmt.Println("Choice not in the list. Try again!")
		}

		fmt.Printf("\nTeam 1 = %v player/s", fC)
		fmt.Printf(" | Team 2 = %v player/s\n", vC)

	}

	fmt.Println("Both teams are now full!")
	fmt.Println("Team 1 Frigg:")
	for t1 < 4 {
		fmt.Printf("%v\n", arr2D[0][t1])
		t1++
	}

	t1 = 0

	fmt.Println("Team 2 Valk:")
	for t1 < 4 {
		fmt.Printf("%v\n", arr2D[1][t1])
		t1++
	}

}