From 6bab40fa5aa6ce131d0c67e1cc24217b7b22c3aa Mon Sep 17 00:00:00 2001 From: Seraina Date: Sat, 19 Mar 2022 16:44:57 +0100 Subject: [PATCH] Added Idea how to distribute Positions of Passengers --- Meilenstein II/Spiellogik Pseudocode | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Meilenstein II/Spiellogik Pseudocode b/Meilenstein II/Spiellogik Pseudocode index d60cca7..9ef54d7 100644 --- a/Meilenstein II/Spiellogik Pseudocode +++ b/Meilenstein II/Spiellogik Pseudocode @@ -3,23 +3,24 @@ int spielerzahl = 6; //Default setting Fill train -> Randomize - String[] fillTrain(int spielerzahl, String... usernames) //... arbitrary amount of usernames, gives Array I think^^ - if spielerzahl < #usernames +/** +Creats an array of random numbers 1 - spielerzahl +**/ + int[] fillTrain(int spielerzahl) //... arbitrary amount of users, gives Array I think^^ + if spielerzahl < #users throw some sort of exception - String[] userTrain = new Strin[spielerzahl]; - for (int i = 0; i < spielerzahl; i++) - Randomliy choose one username - ->Maybe: Random nr. 0-spielerzahl + int[] userTrain = new int[spielerzahl]; + for (int i = 0; i < spielerzahl; i++) // + Random nr. 1-6 if randomnr hasnt been used before - userTrain[i] = usernames[randomnr] + userTrain[i] = randomnr. + else ? //find a way either increase number or whatever to handle this case return userTrain - - - - +Create Passengers -> use fillTrain array to position one after another + Start with clients till we run out, then create npc' Gostyfy