public override Player Clone() { AINeuralPlayer clone = new AINeuralPlayer(); clone._whereToGoDecider = _whereToGoDecider.Clone(); clone._getUsedHumansDecider = _getUsedHumansDecider.Clone(); clone._charityDecider = _charityDecider.Clone(); clone._instrumentsDecider = _instrumentsDecider.Clone(); clone._hungryDecider = _hungryDecider.Clone(); return(clone); }
private int GetDecisionInd(DecisionType type, Game game, PlayerModel player, List <int> randoms, int points, Resource receivedRecource, WhereToGo whereToGo) { List <int> optionInds = AINeuralPlayer.GetOptionInds(type, game, _model, randoms, points, receivedRecource, whereToGo); int[] inputs = AINeuralPlayer.GetInputs(type, game, _model, receivedRecource, whereToGo); double[] inputsDouble = new double[inputs.Length]; for (int i = 0; i < inputs.Length; i++) { inputsDouble [i] = inputs [i]; } NeuralDecisionNetwork chooser = GetChooserDecider(type); int decisionInd = chooser.Think(inputs, optionInds); return(decisionInd); }
public override void GetUsedInstrumentSlotInd(Game game, Resource receivedRecource, int points, OnInstrumentsToUseSelected onComplete) { List <int> options = AINeuralPlayer.GetInstrumentsOptionInds(game, _model, null, points, receivedRecource); int decision = options [options.Count - 1]; int availableSlot1Instruments = _model.InstrumentsSlot1Used ? 0 : _model.InstrumentsCountSlot1; int availableSlot2Instruments = _model.InstrumentsSlot2Used ? 0 : _model.InstrumentsCountSlot2; int availableSlot3Instruments = _model.InstrumentsSlot3Used ? 0 : _model.InstrumentsCountSlot3; int availableTop4Instruments = (_model.Top4Instruments != null && !_model.Top4Instruments.Card.TopUsed) ? 4 : 0; int availableTop3Instruments = (_model.Top3Instruments != null && !_model.Top3Instruments.Card.TopUsed) ? 3 : 0; int availableTop2Instruments = (_model.Top2Instruments != null && !_model.Top2Instruments.Card.TopUsed) ? 2 : 0; bool useSlot1 = availableSlot1Instruments > 0; bool useSlot2 = availableSlot2Instruments > 0; bool useSlot3 = availableSlot3Instruments > 0; bool useOnceSlot4 = availableTop4Instruments > 0; bool useOnceSlot3 = availableTop3Instruments > 0; bool useOnceSlot2 = availableTop2Instruments > 0; int cost = Game.GetResourceCost(receivedRecource); int receivedFromDices = points / cost; int notUsedPoints = points - receivedFromDices * cost; int maxInstrumentsPoints = availableSlot1Instruments + availableSlot2Instruments + availableSlot3Instruments + availableTop4Instruments + availableTop3Instruments + availableTop2Instruments; int pointsForDecision; switch (decision) { default: case 0: pointsForDecision = 0; break; case 1: pointsForDecision = cost - notUsedPoints; break; case 2: pointsForDecision = 2 * cost - notUsedPoints; break; case 3: pointsForDecision = 3 * cost - notUsedPoints; break; } int currPoints = maxInstrumentsPoints; if (availableTop4Instruments > 0 && pointsForDecision <= currPoints - availableTop4Instruments) { currPoints -= availableTop4Instruments; useOnceSlot4 = false; } if (availableTop3Instruments > 0 && pointsForDecision <= currPoints - availableTop3Instruments) { currPoints -= availableTop3Instruments; useOnceSlot3 = false; } if (availableTop2Instruments > 0 && pointsForDecision <= currPoints - availableTop2Instruments) { currPoints -= availableTop2Instruments; useOnceSlot2 = false; } if (availableSlot1Instruments > 0 && pointsForDecision <= currPoints - availableSlot1Instruments) { currPoints -= availableSlot1Instruments; useSlot1 = false; } if (availableSlot2Instruments > 0 && pointsForDecision <= currPoints - availableSlot2Instruments) { currPoints -= availableSlot2Instruments; useSlot2 = false; } if (availableSlot3Instruments > 0 && pointsForDecision <= currPoints - availableSlot3Instruments) { currPoints -= availableSlot3Instruments; useSlot3 = false; } onComplete(useSlot1, useSlot2, useSlot3, useOnceSlot4, useOnceSlot3, useOnceSlot2); }