code:
:: slave creation widgets [widget nobr]

/%
 Call as <<StartingGirlsWorkaround>>
%/
<<widget "StartingGirlsWorkaround">>
	<<display "Generate New Slave">>
	<<set $startingGirlCopied to 0>>
	<<set $activeSlave.health = 0>>
	<<set $activeSlave.devotion = 0>>
	<<set $activeSlave.trust = 0>>
	<<set $activeSlave.sexualQuirk to "none">>
	<<set $activeSlave.behavioralQuirk to "none">>
	<<set $activeSlave.fetishKnown to 1>>
	<<if $activeSlave.vagina < 0>>
	<<set $activeSlave.ovaries = 0>>
	<<elseif $activeSlave.vagina < 1>>
	<<set $activeSlave.vaginalSkill = 0>>
	<</if>>
	<<if $activeSlave.anus < 1>>
	<<set $activeSlave.analSkill = 0>>
	<</if>>

	<<set $activeSlave.actualAge to Number($activeSlave.actualAge)>>
	<<set $activeSlave.devotion = Number($activeSlave.devotion)>>
	<<set $activeSlave.trust = Number($activeSlave.trust)>>
	<<if $activeSlave.indenture >= 0>>
		<<set $activeSlave.indenture = Math.clamp($activeSlave.indenture, 26, 208)>>
	<</if>>
	<<set $activeSlave.height = Math.clamp($activeSlave.height, 85, 274)>>
	<<set $activeSlave.boobs = Math.clamp($activeSlave.boobs, 0, 10000)>>
	<<set $activeSlave.boobs = Number($activeSlave.boobs)>>
	<<set $activeSlave.boobs = Math.trunc($activeSlave.boobs/50)*50>>
<</widget>>

/%
 Call as <<StartingGirlsRefresh>>
%/
<<widget "StartingGirlsRefresh">>

	<<replace "#devotion">>
		@@color:yellow;Ambivalent.@@
	<</replace>>

	<<replace "#trust">>
		@@color:yellow;Fearful.@@
	<</replace>>

	<<replace "#legal">>
		Slave.
	<</replace>>

	<<replace "#voice">>
		<<if $activeSlave.voice == 0>>Mute.
		<<elseif $activeSlave.voice == 1>>Deep.
		<<elseif $activeSlave.voice is 2>>Normal.
		<<elseif $activeSlave.voice is 3>>High.
		<</if>>
	<</replace>>

	<<replace "#language">>
		<<if $activeSlave.accent == 0>>Unaccented.
		<<elseif $activeSlave.accent == 1>>Pretty $activeSlave.nationality accent.
		<<elseif $activeSlave.accent is 2>>Thick $activeSlave.nationality accent.
		<<else>>Not fluent.
		<</if>>
	<</replace>>

	<<replace "#age">>
		<<textbox "$activeSlave.actualAge" $activeSlave.actualAge "Starting Girls">>
	<</replace>>

	<<replace "#health">>
		@@color:yellow;Healthy.@@
	<</replace>>

	<<replace "#muscles">>
		Normal.
	<</replace>>

	<<replace "#waist">>
		Normal.
	<</replace>>

	<<if $seeExtreme == 1>>
		<<replace "#amp">>
			<<if $activeSlave.amp == 1>>Amputee.
			<<else>>Normal.
			<</if>>
		<</replace>>
	<</if>>

	<<replace "#height">>
		<<if $activeSlave.height < 150>>Petite.
		<<elseif $activeSlave.height < 160>>Short.
		<<elseif $activeSlave.height < 170>>Average.
		<<elseif $activeSlave.height < 185>>Tall.
		<<else>>Very tall.
		<</if>>
		<<textbox "$activeSlave.height" $activeSlave.height "Starting Girls">> cm
	<</replace>>

	<<replace "#weight">>
		<<if $activeSlave.weight < -95>>@@color:red;Emaciated.@@
		<<elseif $activeSlave.weight < -30>>@@color:red;Skinny.@@
		<<elseif $activeSlave.weight < -10>>Thin.
		<<elseif $activeSlave.weight <= 10>>Average.
		<<elseif $activeSlave.weight <= 30>>Plush.
		<<elseif $activeSlave.weight <= 95>>@@color:red;Chubby.@@
		<<else>>@@color:red;Fat.@@
		<</if>>
	<</replace>>

	<<if $seeRace == 1>>
		<<replace "#ethnicity">>
		<<textbox "$activeSlave.race" $activeSlave.race "Starting Girls">>
		<</replace>>
	<</if>>

	<<replace "#skin">>
		<<textbox "$activeSlave.skin" $activeSlave.skin "Starting Girls">>
	<</replace>>

	<<replace "#faceShape">>
		$activeSlave.faceShape
	<</replace>>

	<<replace "#face">>
		<<if $activeSlave.face < -2>>Very ugly.
		<<elseif $activeSlave.face is -2>>Ugly.
		<<elseif $activeSlave.face is -1>>Unattractive.
		<<elseif $activeSlave.face == 0>>Average.
		<<elseif $activeSlave.face == 1>>Attractive.
		<<elseif $activeSlave.face is 2>>Beautiful.
		<<else>>Very beautiful.
		<</if>>
	<</replace>>

	<<replace "#lips">>
		<<if $activeSlave.lips <= 10>>Thin.
		<<elseif $activeSlave.lips <= 20>>Normal.
		<<elseif $activeSlave.lips <= 40>>Plush.
		<<elseif $activeSlave.lips <= 70>>Big.
		<<elseif $activeSlave.lips <= 95>>Huge.
		<<else>>Facepussy.
		<</if>>
	<</replace>>

	<<replace "#teeth">>
		<<if $activeSlave.teeth is "crooked">>Crooked.
		<<elseif $activeSlave.teeth is "straightening braces">>Braces.
		<<else>>Straight.
		<</if>>
	<</replace>>

	<<replace "#vision">>
		<<if $seeExtreme == 1>>
			<<if $activeSlave.eyes is -2>>Blind.
			<<elseif $activeSlave.eyes is -1>>Nearsighted.
			<<else>>Normal.
			<</if>>
		<<else>>
			<<if $activeSlave.eyes is -1>>Nearsighted.
			<<else>>Normal.
			<</if>>
		<</if>>
	<</replace>>

	<<replace "#boobs">>
		<<if $activeSlave.boobs <= 200>>Flat.
		<<elseif $activeSlave.boobs <= 500>>Healthy.
		<<elseif $activeSlave.boobs <= 800>>Large.
		<<elseif $activeSlave.boobs <= 1200>>Very Large.
		<<elseif $activeSlave.boobs <= 2000>>Huge.
		<<elseif $activeSlave.boobs <= 4000>>Massive.
		<<elseif $activeSlave.boobs <= 6000>>Monstrous.
		<<else>>Science experiment.
		<</if>>
		<<textbox "$activeSlave.boobs" $activeSlave.boobs "Starting Girls">> CCs
	<</replace>>

	<<replace "#lactation">>
		<<if $activeSlave.lactation == 2>>Artificial.
		<<elseif $activeSlave.lactation == 1>>Natural.
		<<else>>None.
		<</if>>
	<</replace>>

	<<replace "#nipples">>
		$activeSlave.nipples
	<</replace>>

	<<replace "#areolae">>
		<<if $activeSlave.areolae == 1>>
		Large.
		<<elseif $activeSlave.areolae == 2>>
			Wide.
		<<elseif $activeSlave.areolae == 3>>
			Huge.
		<<else>>
			Normal.
		<</if>>
	<</replace>>

	<<replace "#shoulders">>
		<<if $activeSlave.shoulders < -1>>Very narrow.
		<<elseif $activeSlave.shoulders < 0>>Narrow.
		<<elseif $activeSlave.shoulders > 1>>Very broad.
		<<elseif $activeSlave.shoulders > 0>>Broad.
		<<else>>Feminine.
		<</if>>
	<</replace>>

	<<replace "#hips">>
		<<if $activeSlave.hips < -1>>Very narrow.
		<<elseif $activeSlave.hips < 0>>Narrow.
		<<elseif $activeSlave.hips > 1>>Very broad.
		<<elseif $activeSlave.hips > 0>>Broad.
		<<else>>Normal.
		<</if>>
	<</replace>>

	<<replace "#butt">>
		<<if $activeSlave.butt == 0>>Flat.
		<<elseif $activeSlave.butt < 2>>Small.
		<<elseif $activeSlave.butt < 3>>Plump.
		<<elseif $activeSlave.butt < 4>>Big.
		<<elseif $activeSlave.butt < 5>>Huge.
		<<elseif $activeSlave.butt < 6>>Enormous.
		<<elseif $activeSlave.butt < 7>>Gigantic.
		<<else>>Massive.
		<</if>>
	<</replace>>

	<<replace "#anus">>
		<<if $activeSlave.anus == 0>>@@color:lime;Virgin.@@
		<<elseif $activeSlave.anus == 1>>Normal.
		<<elseif $activeSlave.anus is 2>>Veteran.
		<<else>>Gaping.
		<</if>>
	<</replace>>

	<<replace "#vagina">>
		<<if $activeSlave.vagina is -1>>//No vagina.//
		<<elseif $activeSlave.vagina == 0>>@@color:lime;Virgin.@@
		<<elseif $activeSlave.vagina == 1>>Normal.
		<<elseif $activeSlave.vagina is 2>>Veteran.
		<<else>>Gaping.
		<</if>>
	<</replace>>

	<<replace "#vaginablock">>
		<<if $activeSlave.vagina > -1>>

		''Clit:''

			<<if $activeSlave.clit == 0>>Normal.
			<<elseif $activeSlave.clit == 1>>Large.
			<<else>>Huge.
			<</if>>

		<<click "Normal">>
			<<set $activeSlave.clit to 0>>
			<<replace #clit>>
				Normal.
			<</replace>>
		<</click>>
		|
		<<click "Large">>
			<<set $activeSlave.clit to 1>>
			<<replace #clit>>
				Large.
			<</replace>>
		<</click>>
		|
		<<click "Huge">>
			<<set $activeSlave.clit to 2>>
			<<replace #clit>>
				Huge.
			<</replace>>
		<</click>>
		<</if>>

		''Labia:''

			<<if $activeSlave.labia is 2>>Huge.
			<<elseif $activeSlave.labia == 1>>Large.
			<<else>>Normal.
			<</if>>

		<<click "Normal">>
			<<set $activeSlave.labia to 0>>
			<<replace #labia>>
				Normal.
			<</replace>>
		<</click>>
		|
		<<click "Large">>
			<<set $activeSlave.labia to 1>>
			<<replace #labia>>
				Large.
			<</replace>>
		<</click>>
		|
		<<click "Huge">>
			<<set $activeSlave.labia to 2>>
			<<replace #labia>>
				Huge.
			<</replace>>
		<</click>>

		''Vaginal wetness:''

		<<if $activeSlave.vaginaLube == 0>>Dry.
		<<elseif $activeSlave.vaginaLube == 1>>Normal.
		<<else>>Excessive.
		<</if>>

		<<click "Dry">><<set $activeSlave.vaginaLube = 0>><<replace "#wetness">>Dry.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Normal">><<set $activeSlave.vaginaLube = 1>><<replace "#wetness">>Normal.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Excessive">><<set $activeSlave.vaginaLube = 2>><<replace "#wetness">>Excessive.<</replace>><<StartingGirlsCost>><</click>>

		''Pregnancy:''

		<<if $activeSlave.preg > 20>>Ready to drop.
		<<elseif $activeSlave.preg > 20>>Advanced.
		<<elseif $activeSlave.preg > 5>>Early.
		<<elseif $activeSlave.preg > -2>>None.
		<<else>>Barren.
		<</if>>

		<<click "Ready to Drop">><<set $activeSlave.preg = 35,$activeSlave.pregType = 1,$activeSlave.pubertyXX = 1>><<replace "#preg">>Ready to drop.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Advanced">><<set $activeSlave.preg = 25,$activeSlave.pregType = 1,$activeSlave.pubertyXX = 1>><<replace "#preg">>Advanced.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Early">><<set $activeSlave.preg = 10,$activeSlave.pregType = 1,$activeSlave.pubertyXX = 1>><<replace "#preg">>Early.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "None">><<set $activeSlave.preg = 0,$activeSlave.pregType = 0,$activeSlave.pregSource = 0>><<replace "#preg">>None.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Barren">><<set $activeSlave.preg = -2,$activeSlave.pregType = 0,$activeSlave.pregSource = 0>><<replace "#preg">>Barren.<</replace>><<StartingGirlsCost>><</click>>

''Puberty:''

		<<if $activeSlave.pubertyXX == 1>>Postpubescent.
		<<else>>Prepubescent.
		<</if>>

		<<textbox "$activeSlave.pubertyAgeXX" $activeSlave.pubertyAgeXX "Starting Girls">>
		<<click "Postpubescent">><<set $activeSlave.pubertyXX = 1>><<replace "#pub">>Postpubescent.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Prepubescent">><<set $activeSlave.pubertyXX = 0,$activeSlave.pubertyAgeXX = $fertilityAge,$activeSlave.preg = 0,$activeSlave.pregType = 0,$activeSlave.pregSource = 0>><<replace "#pub">>Prepubescent.<</replace>><<StartingGirlsCost>><</click>>
		<<if $PC.dick == 1>>

 ''Father:''

		<<if $activeSlave.pregSource == -1>>My child.
		<<else>>
		<</if>>

		<<click "My child">><<set $activeSlave.pregSource = -1>><<replace "#father">>My child.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Clear">><<set $activeSlave.pregSource = 0>><<replace "#father">><</replace>><<StartingGirlsCost>><</click>>
		<</if>>
	<</replace>>

	<<replace "#dickblock">>
		<<if $seeDicks != 0>>

		''Penis:''

		<<if $activeSlave.dick == 0>>None.
		<<elseif $activeSlave.dick == 1>>Tiny.
		<<elseif $activeSlave.dick is 2>>Small.
		<<elseif $activeSlave.dick is 3>>Normal.
		<<elseif $activeSlave.dick is 4>>Large.
		<<else>>Massive.
		<</if>>

		<<click "No penis">><<set $activeSlave.dick = 0,$activeSlave.balls = 0,$activeSlave.clit = 0,$activeSlave.pubertyXY = 0,$activeSlave.pubertyAgeXY = $potencyAge>><<replace "#dick">>None.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Tiny">><<set $activeSlave.dick = 1,$activeSlave.clit = 0>><<replace "#dick">>Tiny.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Small">><<set $activeSlave.dick = 2,$activeSlave.clit = 0>><<replace "#dick">>Small.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Normal">><<set $activeSlave.dick = 3,$activeSlave.clit = 0>><<replace "#dick">>Normal.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Large">><<set $activeSlave.dick = 4,$activeSlave.clit = 0>><<replace "#dick">>Large.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Massive">><<set $activeSlave.dick = 5,$activeSlave.clit = 0>><<replace "#dick">>Massive.<</replace>><<StartingGirlsCost>><</click>>
		<<if $activeSlave.dick > 0>>

		''Foreskin:''

		<<if $activeSlave.foreskin == 0>>None.
		<<elseif $activeSlave.foreskin == 1>>Tiny.
		<<elseif $activeSlave.foreskin is 2>>Small.
		<<elseif $activeSlave.foreskin is 3>>Normal.
		<<elseif $activeSlave.foreskin is 4>>Large.
		<<else>>Massive.<</if>>

		<<if $seeCircumcision == 1>><<click "Circumcised">><<set $activeSlave.foreskin = 0>><<replace "#foreskin">>None.<</replace>><<StartingGirlsCost>><</click>> |<</if>>
		<<click "Tiny">><<set $activeSlave.foreskin = 1>><<replace "#foreskin">>Tiny.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Small">><<set $activeSlave.foreskin = 2>><<replace "#foreskin">>Small.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Normal">><<set $activeSlave.foreskin = 3>><<replace "#foreskin">>Normal.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Large">><<set $activeSlave.foreskin = 4>><<replace "#foreskin">>Large.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Massive">><<set $activeSlave.foreskin = 5>><<replace "#foreskin">>Massive.<</replace>><<StartingGirlsCost>><</click>>

		''Testicles:''

		<<if $activeSlave.balls == 0>>None.
		<<elseif $activeSlave.balls == 1>>Vestigial.
		<<elseif $activeSlave.balls is 2>>Small.
		<<elseif $activeSlave.balls is 3>>Normal.
		<<elseif $activeSlave.balls is 4>>Large.
		<<else>>Massive.<</if>>

		<<click "No testicles">><<set $activeSlave.balls = 0,$activeSlave.pubertyXY = 0,$activeSlave.pubertyAgeXY = $potencyAge>><<replace "#balls">>None.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Vestigial">><<set $activeSlave.balls = 1>><<replace "#balls">>Vestigial.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Small">><<set $activeSlave.balls = 2>><<replace "#balls">>Small.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Normal">><<set $activeSlave.balls = 3>><<replace "#balls">>Normal.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Large">><<set $activeSlave.balls = 4>><<replace "#balls">>Large.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Massive">><<set $activeSlave.balls = 5>><<replace "#balls">>Massive.<</replace>><<StartingGirlsCost>><</click>>

		''Puberty:''<<textbox "$activeSlave.pubertyAgeXY" $activeSlave.pubertyAgeXY "Starting Girls">>
		<<if $activeSlave.balls > 0>>

		''Ballsack:''

		<<if $activeSlave.scrotum == 0>>None.
		<<elseif $activeSlave.scrotum == 1>>Tiny.
		<<elseif $activeSlave.scrotum is 2>>Small.
		<<elseif $activeSlave.scrotum is 3>>Normal.
		<<elseif $activeSlave.scrotum is 4>>Large.
		<<else>>Massive.<</if>>

		<<click "None">><<set $activeSlave.scrotum = 0>><<replace "#scrotum">>None.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Tiny">><<set $activeSlave.scrotum = 1>><<replace "#scrotum">>Tiny.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Small">><<set $activeSlave.scrotum = 2>><<replace "#scrotum">>Small.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Normal">><<set $activeSlave.scrotum = 3>><<replace "#scrotum">>Normal.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Large">><<set $activeSlave.scrotum = 4>><<replace "#scrotum">>Large.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Massive">><<set $activeSlave.scrotum = 5>><<replace "#scrotum">>Massive.<</replace>><<StartingGirlsCost>><</click>>

''Puberty:''

		<<if $activeSlave.pubertyXY == 1>>Postpubescent.
		<<else>>Prepubescent.
		<</if>>

		<<click "Postpubescent">><<set $activeSlave.pubertyXY = 1>><<replace "#Mpub">>Postpubescent.<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Prepubescent">><<set $activeSlave.pubertyXY = 0,$activeSlave.pubertyAgeXY = $potencyAge>><<replace "#Mpub">>Prepubescent.<</replace>><<StartingGirlsCost>><</click>>
		<</if>>
		<</if>>
		<</if>>
	<</replace>>

	<<replace "#analSkillsBlock">>
		<<if $activeSlave.anus == 0>>
			//Anal virgins cannot be given anal skills//
		<<else>>
			''Anal sex:''

			<<if $activeSlave.analSkill <= 10>>Unskilled.
			<<elseif $activeSlave.analSkill <= 30>>@@color:cyan;Basic.@@
			<<elseif $activeSlave.analSkill <= 60>>@@color:cyan;Skilled.@@
			<<else>>@@color:cyan;Expert.@@
			<</if>>

			<<if $activeSlave.anus < 3>><<click "Unskilled">><<set $activeSlave.analSkill = 0>><<replace "#analSkill">>Unskilled.<</replace>><<StartingGirlsCost>><</click>> |<</if>>
			<<click "Basic">><<set $activeSlave.analSkill = 15>><<replace "#analSkill">>@@color:cyan;Basic.@@<</replace>><<StartingGirlsCost>><</click>> |
			<<click "Skilled">><<set $activeSlave.analSkill = 35>><<replace "#analSkill">>@@color:cyan;Skilled.@@<</replace>><<StartingGirlsCost>><</click>> |
			<<click "Expert">><<set $activeSlave.analSkill = 65>><<replace "#analSkill">>@@color:cyan;Expert.@@<</replace>><<StartingGirlsCost>><</click>>
		<</if>>
	<</replace>>

	<<replace "#oralSkill">>
		<<if $activeSlave.oralSkill <= 10>>Unskilled.
		<<elseif $activeSlave.oralSkill <= 30>>@@color:cyan;Basic.@@
		<<elseif $activeSlave.oralSkill <= 60>>@@color:cyan;Skilled.@@
		<<else>>@@color:cyan;Expert.@@
		<</if>>
	<</replace>>

	<<replace "#vaginalSkillsBlock">>
		<<if $activeSlave.vagina == 0>>
			//Virgins cannot be given vaginal skills//
		<<elseif $activeSlave.vagina is -1>>
			//Must have a vagina to have vaginal skills//
		<<else>>
			''Vaginal sex:''

			<<if $activeSlave.vaginalSkill <= 10>>Unskilled.
			<<elseif $activeSlave.vaginalSkill <= 30>>@@color:cyan;Basic.@@
			<<elseif $activeSlave.vaginalSkill <= 60>>@@color:cyan;Skilled.@@
			<<else>>@@color:cyan;Expert.@@
			<</if>>

			<<if $activeSlave.vagina < 3>><<click "Unskilled">><<set $activeSlave.vaginalSkill = 0>><<replace "#vaginalSkill">>Unskilled.<</replace>><<StartingGirlsCost>><</click>> |<</if>>
			<<click "Basic">><<set $activeSlave.vaginalSkill = 15>><<replace "#vaginalSkill">>@@color:cyan;Basic.@@<</replace>><<StartingGirlsCost>><</click>> |
			<<click "Skilled">><<set $activeSlave.vaginalSkill = 35>><<replace "#vaginalSkill">>@@color:cyan;Skilled.@@<</replace>><<StartingGirlsCost>><</click>> |
			<<click "Expert">><<set $activeSlave.vaginalSkill = 65>><<replace "#vaginalSkill">>@@color:cyan;Expert.@@<</replace>><<StartingGirlsCost>><</click>>
		<</if>>
	<</replace>>

	<<replace "#whoreSkill">>
		<<if $activeSlave.whoreSkill <= 10>>Unskilled.
		<<elseif $activeSlave.whoreSkill <= 30>>@@color:cyan;Basic.@@
		<<elseif $activeSlave.whoreSkill <= 60>>@@color:cyan;Skilled.@@
		<<else>>@@color:cyan;Expert.@@
		<</if>>
	<</replace>>

	<<replace "#entertainSkill">>
		<<if $activeSlave.entertainSkill <= 10>>Unskilled.
		<<elseif $activeSlave.entertainSkill <= 30>>@@color:cyan;Basic.@@
		<<elseif $activeSlave.entertainSkill <= 60>>@@color:cyan;Skilled.@@
		<<else>>@@color:cyan;Expert.@@
		<</if>>
	<</replace>>

	<<replace "#combatSkill">>
		<<if $activeSlave.combatSkill == 0>>Unskilled.
		<<else>>@@color:cyan;Skilled.@@
		<</if>>
	<</replace>>

	<<replace "#intelligence">>
		<<if $activeSlave.intelligence is 3>>@@color:deepskyblue;Brilliant.@@
		<<elseif $activeSlave.intelligence is 2>>@@color:deepskyblue;Very smart.@@
		<<elseif $activeSlave.intelligence == 1>>@@color:deepskyblue;Smart.@@
		<<elseif $activeSlave.intelligence == 0>>Average.
		<<elseif $activeSlave.intelligence is -1>>@@color:orangered;Stupid.@@
		<<elseif $activeSlave.intelligence is -2>>@@color:orangered;Very stupid.@@
		<<else>>@@color:orangered;Moronic.@@
		<</if>>
	<</replace>>

	<<replace "#intelligenceImplant">>
		<<if $activeSlave.intelligenceImplant == 1>>@@color:deepskyblue;Educated.@@
		<<else>>Uneducated.
		<</if>>
	<</replace>>

	<<if $activeSlave.fetishKnown == 1>>
		<<ToggleFetish 1>>
	<<else>>
		<<ToggleFetish 0>>
	<</if>>

	<<if $activeSlave.attrKnown == 1>>
		<<ToggleSexuality 1>>
	<<else>>
		<<ToggleSexuality 0>>
	<</if>>

	<<replace "#behavioralFlaw">>
		<<if $activeSlave.behavioralFlaw is "none">>
		//$activeSlave.behavioralFlaw.//
		<<else>>
			@@color:red;$activeSlave.behavioralFlaw.@@
		<</if>>
	<</replace>>

	<<replace "#sexualFlaw">>
		<<if $activeSlave.sexualFlaw is "none">>
			//$activeSlave.sexualFlaw.//
		<<else>>
			@@color:red;$activeSlave.sexualFlaw.@@
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<StartingGirlsAnalSkill>>
%/
<<widget "StartingGirlsAnalSkill">>
	<<replace "#analSkillsBlock">>
		<<if $activeSlave.anus == 0>>
		//Anal virgins cannot be given anal skills//
		<<else>>
		''Anal sex:''

		<<if $activeSlave.analSkill <= 10>>Unskilled.
		<<elseif $activeSlave.analSkill <= 30>>@@color:cyan;Basic.@@
		<<elseif $activeSlave.analSkill <= 60>>@@color:cyan;Skilled.@@
		<<else>>@@color:cyan;Expert.@@
		<</if>>

		<<if $activeSlave.anus < 3>><<click "Unskilled">><<set $activeSlave.analSkill = 0>><<replace "#analSkill">>Unskilled.<</replace>><<StartingGirlsCost>><</click>> |<</if>>
		<<click "Basic">><<set $activeSlave.analSkill = 15>><<replace "#analSkill">>@@color:cyan;Basic.@@<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Skilled">><<set $activeSlave.analSkill = 35>><<replace "#analSkill">>@@color:cyan;Skilled.@@<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Expert">><<set $activeSlave.analSkill = 65>><<replace "#analSkill">>@@color:cyan;Expert.@@<</replace>><<StartingGirlsCost>><</click>>
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<StartingGirlsVaginalSkill>>
%/
<<widget "StartingGirlsVaginalSkill">>
	<<replace "#vaginalSkillsBlock">>
		<<if $activeSlave.vagina == 0>>
		//Virgins cannot be given vaginal skills//
		<<elseif $activeSlave.vagina is -1>>
		//Must have a vagina to have vaginal skills//
		<<else>>
		''Vaginal sex:''

		<<if $activeSlave.vaginalSkill <= 10>>Unskilled.
		<<elseif $activeSlave.vaginalSkill <= 30>>@@color:cyan;Basic.@@
		<<elseif $activeSlave.vaginalSkill <= 60>>@@color:cyan;Skilled.@@
		<<else>>@@color:cyan;Expert.@@
		<</if>>

		<<if $activeSlave.anus < 3>><<click "Unskilled">><<set $activeSlave.vaginalSkill = 0>><<replace "#vaginalSkill">>Unskilled.<</replace>><<StartingGirlsCost>><</click>> |<</if>>
		<<click "Basic">><<set $activeSlave.vaginalSkill = 15>><<replace "#vaginalSkill">>@@color:cyan;Basic.@@<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Skilled">><<set $activeSlave.vaginalSkill = 35>><<replace "#vaginalSkill">>@@color:cyan;Skilled.@@<</replace>><<StartingGirlsCost>><</click>> |
		<<click "Expert">><<set $activeSlave.vaginalSkill = 65>><<replace "#vaginalSkill">>@@color:cyan;Expert.@@<</replace>><<StartingGirlsCost>><</click>>
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<SaleDescription>>
%/
<<widget "SaleDescription">>
	<<replace #slaveinfo>>
		<<set $saleDescription = 1>>
		<<display "Long Slave Description">>
		<<set $saleDescription = 0>>
	<</replace>>
<</widget>>

/%
 Call as <<StartingGirlsCost>>
%/
<<widget "StartingGirlsCost">>

<<replace "#cost">>
	<<slaveCost $activeSlave>>
	¤<<print $slaveCost>>.
<</replace>>
<<replace "#finalize">>
<<if $cash >= $slaveCost>>
	<<if $PC.career != "engineer">>

		<<click "Add this slave">>
			<<set $returnTo = "Commit Starting Girl", $createRelatedSlave = 0, $applyCareerBonus = 1, $careerBonusApplied = 0>>
			<<set $activeSlave.actualAge to Number($activeSlave.actualAge)>>
			<<set $activeSlave.devotion = Number($activeSlave.devotion)>>
			<<set $activeSlave.trust = Number($activeSlave.trust)>>
			<<if $activeSlave.indenture >= 0>>
				<<set $activeSlave.indenture = Math.clamp($activeSlave.indenture, 26, 208)>>
			<</if>>
			<<set $activeSlave.height = Math.clamp($activeSlave.height, 85, 274)>>
			<<set $activeSlave.boobs = Math.clamp($activeSlave.boobs, 0, 10000)>>
			<<set $activeSlave.boobs = Number($activeSlave.boobs)>>
			<<set $activeSlave.boobs = Math.trunc($activeSlave.boobs/50)*50>>
			<<set $slaveWithoutBonuses = $activeSlave>>
			<<goto "RG AS Dump">>
		<</click>>
		//This will apply your @@color:springgreen;career bonus@@ to her:
		<<if $PC.career is "capitalist">>
			one free level of @@color:cyan;prostitution skill.@@
		<<elseif $PC.career is "mercenary">>
			@@color:mediumaquamarine;+2 trust.@@
		<<elseif $PC.career is "slaver">>
			@@color:hotpink;+2 devotion.@@
		<<elseif $PC.career is "medicine">>
			free @@color:lime;basic implants.@@
		<<elseif $PC.career is "celebrity">>
			one free level of @@color:cyan;entertainment skill.@@
		<<elseif $PC.career is "gang">>
			@@color:green;+5 health@@ and a free level of @@color:cyan;combat skill@@
		<<elseif $PC.career is "escort">>
			two free levels of @@color:cyan;sex skills@@, one free level of @@color:cyan;prostitution skill@@, and one free level of @@color:cyan;entertainment skill.@@
		<<elseif $PC.career is "servant">>
			@@color:mediumaquamarine;+1 trust@@ and @@color:hotpink;+1 devotion.@@
		<<else>>
			two free levels of @@color:cyan;sex skills.@@
		<</if>>//

		<<click "Add slave without career bonus">>
			<<set $returnTo = "Commit Starting Girl", $createRelatedSlave = 0, $applyCareerBonus = 0, $careerBonusApplied = 0>>
			<<set $activeSlave.actualAge to Number($activeSlave.actualAge)>>
			<<set $activeSlave.devotion = Number($activeSlave.devotion)>>
			<<set $activeSlave.trust = Number($activeSlave.trust)>>
			<<if $activeSlave.indenture >= 0>>
				<<set $activeSlave.indenture = Math.clamp($activeSlave.indenture, 26, 208)>>
			<</if>>
			<<set $activeSlave.height = Math.clamp($activeSlave.height, 85, 274)>>
			<<set $activeSlave.boobs = Math.clamp($activeSlave.boobs, 0, 10000)>>
			<<set $activeSlave.boobs = Number($activeSlave.boobs)>>
			<<set $activeSlave.boobs = Math.trunc($activeSlave.boobs/50)*50>>
			<<set $slaveWithoutBonuses = $activeSlave>>
			<<goto "RG AS Dump">>
		<</click>>
	<<else>>

		<<click "Add slave">>
			<<set $returnTo = "Commit Starting Girl", $createRelatedSlave = 0, $applyCareerBonus = 0, $careerBonusApplied = 0>>
			<<set $activeSlave.actualAge to Number($activeSlave.actualAge)>>
			<<set $activeSlave.devotion = Number($activeSlave.devotion)>>
			<<set $activeSlave.trust = Number($activeSlave.trust)>>
			<<if $activeSlave.indenture >= 0>>
				<<set $activeSlave.indenture = Math.clamp($activeSlave.indenture, 26, 208)>>
			<</if>>
			<<set $activeSlave.height = Math.clamp($activeSlave.height, 85, 274)>>
			<<set $activeSlave.boobs = Math.clamp($activeSlave.boobs, 0, 10000)>>
			<<set $activeSlave.boobs = Number($activeSlave.boobs)>>
			<<set $activeSlave.boobs = Math.trunc($activeSlave.boobs/50)*50>>
			<<set $slaveWithoutBonuses = $activeSlave>>
			<<goto "RG AS Dump">>
		<</click>>

	<</if>>
<<else>>
	//You lack the necessary funds to add this slave.//
<</if>>

    [[Discard this slave and continue to the arcology|Acquisition]]
<</replace>>
<</widget>>

/%
 Call as <<ToggleFetish 1>>
 $arg[0] is whether unknown or known.
%/
<<widget "ToggleFetish">>

<<if ($args[0] == 0)>>
	<<set $activeSlave.fetish = either("none", "none", "none", "none", "none", "none", "none", "none", "none", "none", "submissive", "cumslut", "humiliation", "buttslut", "boobs", "pregnancy", "dom", "sadist", "masochist"), $activeSlave.fetishKnown = 0>>
	<<replace "#fetishblock">>
		//Not known.//
		<<click "Known">>
			<<ToggleFetish 1>>
		<</click>>
	<</replace>>
<<else>>
	<<set $activeSlave.fetishKnown = 1>>
		<<replace "#fetishblock">>

		<<if $activeSlave.fetishKnown == 1>>
			<<if $activeSlave.fetish is "none">>
				@@color:pink;$activeSlave.fetish.@@
			<<else>>
				@@color:lightcoral;$activeSlave.fetish.@@
			<</if>>
		<<else>>
			//Not known.//
			<<click "Known">>
				<<ToggleFetish 1>>
			<</click>>
		<</if>>

		<<if $activeSlave.fetishKnown == 1>>
			<<click "Unknown">>
				<<ToggleFetish 0>>
			<<StartingGirlsCost>>
		<</click>> |
		<<click "None">>
			<<set $activeSlave.fetish = "none", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Sub">>
			<<set $activeSlave.fetish = "submissive", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Dom">>
			<<set $activeSlave.fetish = "dom", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Cumslut">>
			<<set $activeSlave.fetish = "cumslut", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Humiliation">>
			<<set $activeSlave.fetish = "humiliation", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Buttslut">>
			<<set $activeSlave.fetish = "buttslut", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Breasts">>
			<<set $activeSlave.fetish = "boobs", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Pregnancy">>
			<<set $activeSlave.fetish = "pregnancy", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Sadism">>
			<<set $activeSlave.fetish = "sadist", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>> |
		<<click "Masochism">>
			<<set $activeSlave.fetish = "masochist", $activeSlave.fetishKnown = 1>>
			<<ToggleFetish 1>>
		<</click>>

		<<if $activeSlave.fetish != "none">>

			''Fetish strength:''
			<<if $activeSlave.fetishStrength > 95>>
				@@color:lightcoral;High.@@
			<<elseif $activeSlave.fetishStrength <= 60>>
				@@color:pink;Low.@@
			<<else>>
				@@color:hotpink;Normal.@@
			<</if>>
			<<if $activeSlave.fetishStrength > 60>>
				<<click "Decrease">>
					<<ChangeFetishStrength 0>>
				<</click>>
			<</if>>
			<<if ($activeSlave.fetishStrength > 60)>>|<</if>>
			<<if $activeSlave.fetishStrength <= 95>>
				<<click "Increase">>
					<<ChangeFetishStrength 1>>
				<</click>>
			<</if>>

	<</if>>

	<</if>>
	<</replace>>
<</if>>

<</widget>>

/%
 Call as <<ChangeFetishStrength 1>>
 $arg[0] is whether increase or decreas
%/
<<widget "ChangeFetishStrength">>

<<if ($args[0] == 0)>>
	<<set $activeSlave.fetishStrength -= 5, $activeSlave.fetishKnown = 1>>
	<<replace "#fetishStrength">>
		''Fetish strength:''
		<<if $activeSlave.fetishStrength > 95>>
			@@color:lightcoral;High.@@
		<<elseif $activeSlave.fetishStrength <= 60>>
			@@color:pink;Low.@@
		<<else>>
			@@color:hotpink;Normal.@@
		<</if>>

		<<if $activeSlave.fetishStrength > 60>>
			<<click "Decrease">>
				<<ChangeFetishStrength 0>>
			<</click>>
		<</if>>
		<<if ($activeSlave.fetishStrength > 60)>>|<</if>>
		<<if $activeSlave.fetishStrength <= 95>>
			<<click "Increase">>
				<<ChangeFetishStrength 1>>
			<</click>>
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>

<<else>>
	<<set $activeSlave.fetishStrength += 5, $activeSlave.fetishKnown = 1>>
	<<replace "#fetishStrength">>
		''Fetish strength:''
		<<if $activeSlave.fetishStrength > 95>>
			@@color:lightcoral;High.@@
		<<elseif $activeSlave.fetishStrength <= 60>>
			@@color:pink;Low.@@
		<<else>>
			@@color:hotpink;Normal.@@
		<</if>>

		<<if $activeSlave.fetishStrength > 60>>
			<<click "Decrease">>
				<<ChangeFetishStrength 0>>
			<</click>>
		<</if>>
		<<if ($activeSlave.fetishStrength > 60)>>|<</if>>
		<<if $activeSlave.fetishStrength <= 95>>
			<<click "Increase">>
				<<ChangeFetishStrength 1>>
			<</click>>
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>

<</if>>

<</widget>>

/%
 Call as <<ToggleSexuality 1>>
 $arg[0] is whether unknown or known.
%/
<<widget "ToggleSexuality">>

<<if ($args[0] == 0)>>

	<<set $activeSlave.attrXX = random(0,100), $activeSlave.attrXY = random(0,100), $activeSlave.energy = random(1,90), $activeSlave.attrKnown = 0>>
	<<StartingGirlsCost>>
	<<replace "#sexuality">>
		//Not known.//

	<<click "Known">>
		<<ToggleSexuality 1>>
	<</click>>
	<</replace>>
<<else>>
	<<set $activeSlave.attrKnown = 1>>
	<<replace "#sexuality">>

	<<if $activeSlave.attrKnown == 1>>
		<<if $activeSlave.attrXY <= 5>>
			@@color:red;Disgusted by men,@@
		<<elseif $activeSlave.attrXY <= 15>>
			@@color:red;Turned off by men,@@
		<<elseif $activeSlave.attrXY <= 35>>
			@@color:red;Not attracted to men,@@
		<<elseif $activeSlave.attrXY <= 65>>
			Indifferent to men,
		<<elseif $activeSlave.attrXY <= 85>>
			@@color:green;Attracted to men,@@
		<<elseif $activeSlave.attrXY <= 95>>
			@@color:green;Aroused by men,@@
		<<else>>
			@@color:green;Passionate about men,@@
		<</if>>
	<<else>>
		//Not known.//
	<</if>>

	<<if $activeSlave.attrKnown == 1>>
		<<if $activeSlave.attrXX <= 5>>
			@@color:red;disgusted by women.@@
		<<elseif $activeSlave.attrXX <= 15>>
			@@color:red;turned off by women.@@
		<<elseif $activeSlave.attrXX <= 35>>
			@@color:red;not attracted to women.@@
		<<elseif $activeSlave.attrXX <= 65>>
			indifferent to women.
		<<elseif $activeSlave.attrXX <= 85>>
			@@color:green;attracted to women.@@
		<<elseif $activeSlave.attrXX <= 95>>
			@@color:green;aroused by women.@@
		<<else>>
			@@color:green;passionate about women.@@
		<</if>>
	<</if>>

	<<if $activeSlave.attrKnown == 1>>
	<<click "Unknown">>
		<<ToggleSexuality 0>>
	<</click>>

	XY attraction:

		<<click "Decrease">>
		<<ChangeAttr 1 0>>
		<</click>>

	|
		<<click "Increase">>
		<<ChangeAttr 1 1>>
		<</click>>

	XX attraction:

		<<click "Decrease">>
		<<ChangeAttr 0 0>>
		<</click>>

	|
		<<click "Increase">>
		<<ChangeAttr 0 1>>
		<</click>>

	''Sex drive:''

		<<if $activeSlave.energy == 100>>@@color:green;Nympho!@@
		<<elseif $activeSlave.energy > 80>>@@color:green;Sex addict.@@
		<<elseif $activeSlave.energy > 60>>@@color:green;Powerful.@@
		<<elseif $activeSlave.energy > 40>>@@color:yellow;Average.@@
		<<elseif $activeSlave.energy > 20>>@@color:red;Poor.@@
		<<else>>@@color:red;Frigid.@@<</if>>

	<<click "Nympho">>
		<<set $activeSlave.energy = 100, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:green;Nympho!@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	| <<click "Sex addict">>
		<<set $activeSlave.energy = 85, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:green;Sex addict.@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	| <<click "Powerful">>
		<<set $activeSlave.energy = 65, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:green;Powerful.@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	| <<click "Average">>
		<<set $activeSlave.energy = 45, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:yellow;Average.@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	| <<click "Poor">>
		<<set $activeSlave.energy = 25, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:red;Poor.@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	| <<click "Frigid">>
		<<set $activeSlave.energy = 5, $activeSlave.attrKnown = 1>>
		<<replace "#energy">>
			@@color:red;Frigid.@@
		<</replace>>
		<<StartingGirlsCost>>
	<</click>>
	<<else>>
		<<click "Known">>
			<<ToggleSexuality 1>>
		</click>>
	<</if>>
	<</replace>>
	<<StartingGirlsCost>>
<</if>>
<</widget>>

/%
 Call as <<ChangeAttr 1 1>>
 $arg[0] is whether XX or XY.
 $arg[1] is whether increase or decrease.
%/
<<widget "ChangeAttr">>

<<if ($args[0] == 0) && ($args[1] == 0)>>
	<<if $activeSlave.attrXX-10 >= 0>>
		<<set $activeSlave.attrXX -= 10>>
	<<else>>
		<<set $activeSlave.attrXX = 0>>
	<</if>>
	<<set $activeSlave.attrXX == Math.clamp($activeSlave.attrXX, 0, 100)>>
	<<set $activeSlave.attrKnown = 1>>
	<<replace "#attrXX">>
		<<if $activeSlave.attrXX <= 5>>
			@@color:red;disgusted by women.@@
		<<elseif $activeSlave.attrXX <= 15>>
			@@color:red;turned off by women.@@
		<<elseif $activeSlave.attrXX <= 35>>
			@@color:red;not attracted to women.@@
		<<elseif $activeSlave.attrXX <= 65>>
			indifferent to women.
		<<elseif $activeSlave.attrXX <= 85>>
			@@color:green;attracted to women.@@
		<<elseif $activeSlave.attrXX <= 95>>
			@@color:green;aroused by women.@@
		<<else>>
			@@color:green;passionate about women.@@
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>
	<<if $activeSlave.attrXX == 100>>
		<<replace "#increaseXX">>
		<</replace>>
		<<replace "#decreaseXX">>
			<<click "Decrease">>
			<<ChangeAttr 0 0>>
			<</click>>
		<</replace>>
	<<elseif $activeSlave.attrXX == 0>>
		<<replace "#decreaseXX">>

		<</replace>>
		<<replace "#increaseXX">>
			<<click "Increase">>
			<<ChangeAttr 0 1>>
			<</click>>
		<</replace>>
	<<else>>
		<<replace "#decreaseXX">>
			<<click "Decrease">>
			<<ChangeAttr 0 0>>
			<</click>>
		<</replace>>
		<<replace "#increaseXX">>
		|
			<<click "Increase">>
			<<ChangeAttr 0 1>>
			<</click>>
		<</replace>>
	<</if>>
<<elseif ($args[0] == 0) && ($args[1] == 1)>>
	<<if $activeSlave.attrXX+10 <= 100>>
		<<set $activeSlave.attrXX += 10>>
	<<else>>
		<<set $activeSlave.attrXX = 100>>
	<</if>>
	<<set $activeSlave.attrXX == Math.clamp(0, 100)>>
	<<set $activeSlave.attrKnown = 1>>
	<<replace "#attrXX">>
		<<if $activeSlave.attrXX <= 5>>
			@@color:red;disgusted by women.@@
		<<elseif $activeSlave.attrXX <= 15>>
			@@color:red;turned off by women.@@
		<<elseif $activeSlave.attrXX <= 35>>
			@@color:red;not attracted to women.@@
		<<elseif $activeSlave.attrXX <= 65>>
			indifferent to women.
		<<elseif $activeSlave.attrXX <= 85>>
			@@color:green;attracted to women.@@
		<<elseif $activeSlave.attrXX <= 95>>
			@@color:green;aroused by women.@@
		<<else>>
			@@color:green;passionate about women.@@
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>
<<if $activeSlave.attrXX == 100>>
	<<replace "#increaseXX">>
	<</replace>>
	<<replace "#decreaseXX">>
		<<click "Decrease">>
		<<ChangeAttr 0 0>>
		<</click>>
	<</replace>>
<<elseif $activeSlave.attrXX == 0>>
	<<replace "#decreaseXX">>

	<</replace>>
	<<replace "#increaseXX">>
		<<click "Increase">>
		<<ChangeAttr 0 1>>
		<</click>>
	<</replace>>
<<else>>
	<<replace "#decreaseXX">>
		<<click "Decrease">>
		<<ChangeAttr 0 0>>
		<</click>>
	<</replace>>
	<<replace "#increaseXX">>
	|
		<<click "Increase">>
		<<ChangeAttr 0 1>>
		<</click>>
	<</replace>>
<</if>>
<<elseif ($args[0] == 1) && ($args[1] == 0)>>
	<<if $activeSlave.attrXY-10 >= 0>>
		<<set $activeSlave.attrXY -= 10>>
	<<else>>
		<<set $activeSlave.attrXY = 0>>
	<</if>>

	<<set $activeSlave.attrXY == Math.clamp(0, 100)>>
	<<set $activeSlave.attrKnown = 1>>
	<<replace "#attrXY">>
		<<if $activeSlave.attrXY <= 5>>
			@@color:red;Disgusted by men,@@
		<<elseif $activeSlave.attrXY <= 15>>
			@@color:red;Turned off by men,@@
		<<elseif $activeSlave.attrXY <= 35>>
			@@color:red;Not attracted to men,@@
		<<elseif $activeSlave.attrXY <= 65>>
			Indifferent to men,
		<<elseif $activeSlave.attrXY <= 85>>
			@@color:green;Attracted to men,@@
		<<elseif $activeSlave.attrXY <= 95>>
			@@color:green;Aroused by men,@@
		<<else>>
			@@color:green;Passionate about men,@@
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>
	<<if $activeSlave.attrXY == 100>>
		<<replace "#increaseXY">>

		<</replace>>
		<<replace "#decreaseXY">>
			<<click "Decrease">>
				<<ChangeAttr 1 0>>
			<</click>>
		<</replace>>
	<<elseif $activeSlave.attrXY == 0>>
		<<replace "#decreaseXY">>

		<</replace>>
		<<replace "#increaseXY">>
			<<click "Increase">>
				<<ChangeAttr 1 1>>
			<</click>>
		<</replace>>
	<<else>>
		<<replace "#decreaseXY">>
			<<click "Decrease">>
				<<ChangeAttr 1 0>>
			<</click>>
		<</replace>>
		<<replace "#increaseXY">>
		|
			<<click "Increase">>
				<<ChangeAttr 1 1>>
			<</click>>
		<</replace>>
	<</if>>
<<elseif ($args[0] == 1) && ($args[1] == 1)>>
	<<if $activeSlave.attrXY+10 <= 100>>
		<<set $activeSlave.attrXY += 10>>
	<<else>>
		<<set $activeSlave.attrXY = 100>>
	<</if>>
	<<set $activeSlave.attrXY == Math.clamp(0, 100)>>
	<<set $activeSlave.attrKnown = 1>>
	<<replace "#attrXY">>
		<<if $activeSlave.attrXY <= 5>>
			@@color:red;Disgusted by men,@@
		<<elseif $activeSlave.attrXY <= 15>>
			@@color:red;Turned off by men,@@
		<<elseif $activeSlave.attrXY <= 35>>
			@@color:red;Not attracted to men,@@
		<<elseif $activeSlave.attrXY <= 65>>
			Indifferent to men,
		<<elseif $activeSlave.attrXY <= 85>>
			@@color:green;Attracted to men,@@
		<<elseif $activeSlave.attrXY <= 95>>
			@@color:green;Aroused by men,@@
		<<else>>
			@@color:green;Passionate about men,@@
		<</if>>
	<</replace>>
	<<StartingGirlsCost>>

	<<if $activeSlave.attrXY == 100>>
		<<replace "#increaseXY">>

		<</replace>>
		<<replace "#decreaseXY">>
			<<click "Decrease">>
			<<ChangeAttr 1 0>>
			<</click>>
		<</replace>>
	<<elseif $activeSlave.attrXY == 0>>
		<<replace "#decreaseXY">>

		<</replace>>
		<<replace "#increaseXY">>
			<<click "Increase">>
			<<ChangeAttr 1 1>>
			<</click>>
		<</replace>>
	<<else>>
		<<replace "#decreaseXY">>
			<<click "Decrease">>
			<<ChangeAttr 1 0>>
			<</click>>
		<</replace>>
		<<replace "#increaseXY">>
		|
			<<click "Increase">>
			<<ChangeAttr 1 1>>
			<</click>>
		<</replace>>
	<</if>>
<</if>>
<</widget>>

/%
 Call as <<RandomizeAttraction>>
%/
<<widget "RandomizeAttraction">>

<<set _attraction = Math.clamp($activeSlave.energy*2, 60, 180), _sexuality = random(0,100)>>
<<if $activeSlave.balls > 0>>
	<<if _sexuality > 90>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction, 0, 100)>>
		<<set _attraction -= $activeSlave.attrXY>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction, 0, 100)>>
	<<elseif _sexuality > 70>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction+random(-5,5), 0, 100)>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction+random(-5,5), 0, 100)>>
	<<else>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction, 0, 100)>>
		<<set _attraction -= $activeSlave.attrXX>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction, 0, 100)>>
	<</if>>
<<else>>
	<<if _sexuality > 90>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction, 0, 100)>>
		<<set _attraction -= $activeSlave.attrXX>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction, 0, 100)>>
	<<elseif _sexuality > 60>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction+random(-5,5), 0, 100)>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction+random(-5,5), 0, 100)>>
	<<else>>
		<<set $activeSlave.attrXY = Math.clamp(_attraction, 0, 100)>>
		<<set _attraction -= $activeSlave.attrXY>>
		<<set $activeSlave.attrXX = Math.clamp(_attraction, 0, 100)>>
	<</if>>
<</if>>
<<set $activeSlave.attrXX = Math.clamp($activeSlave.attrXX+random(-5,5), 0, 100), $activeSlave.attrXY = Math.clamp($activeSlave.attrXY+random(-5,5), 0, 100)>>

<</widget>>

/%
 Call as <<CustomSlaveAge>>
%/
<<widget "CustomSlaveAge">>
	<<replace #age>>
		<<if $customSlave.actualAge < 5>>3-4 years old.
		<<elseif $customSlave.actualAge < 7>>5-6 years old.
		<<elseif $customSlave.actualAge < 10>>7-9 years old.
		<<elseif $customSlave.actualAge < 13>>10-12 years old.
		<<elseif $customSlave.actualAge < 15>>13-14 years old.
		<<elseif $customSlave.actualAge < 18>>15-17 years old.
		<<elseif $customSlave.actualAge < 20>>18-19 years old.
		<<elseif $customSlave.actualAge < 30>>20-29 years old.
		<<elseif $customSlave.actualAge < 40>>30-39 years old.
		<<else>>40+ years old.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveHealth>>
%/
<<widget "CustomSlaveHealth">>
	<<replace #health>>
		<<if $customSlave.health == 0>>Healthy.
		<<else>>Extremely healthy.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveMuscles>>
%/
<<widget "CustomSlaveMuscles">>
	<<replace #muscles>>
		<<if $customSlave.muscles <= 5>>Normal musculature.
		<<elseif $customSlave.muscles <= 30>>Toned.
		<<else>>Ripped.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveLips>>
%/
<<widget "CustomSlaveLips">>
	<<replace #lips>>
		<<if $customSlave.lips <= 10>>Thin lips.
		<<elseif $customSlave.lips <= 20>>Normal lips.
		<<elseif $customSlave.lips <= 40>>Plush lips.
		<<elseif $customSlave.lips <= 70>>Big lips.
		<<elseif $customSlave.lips <= 95>>Huge lips.
		<<else>>Facepussy.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveHeight>>
%/
<<widget "CustomSlaveHeight">>
	<<replace #height>>
		<<if $customSlave.height < 130>>Tiny.
		<<elseif $customSlave.height < 150>>Petite.
		<<elseif $customSlave.height < 160>>Short.
		<<elseif $customSlave.height < 170>>Average height.
		<<elseif $customSlave.height < 185>>Tall.
		<<else>>Very tall.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveFace>>
%/
<<widget "CustomSlaveFace">>
	<<replace #face>>
		<<if $customSlave.face < -1>>Very unattractive face.
		<<elseif $customSlave.face is -1>>Unattractive face.
		<<elseif $customSlave.face == 0>>Average face.
		<<elseif $customSlave.face == 1>>Attractive face.
		<<elseif $customSlave.face > 1>>Very attractive face.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveRace>>
%/
<<widget "CustomSlaveRace">>
	<<replace #ethnicity>>
		<<textbox "$customSlave.race" $customSlave.race "Custom Slave">>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveSkin>>
%/
<<widget "CustomSlaveSkin">>
	<<replace #skin>>
		<<textbox "$customSlave.skin" $customSlave.skin "Custom Slave">>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveBoobs>>
%/
<<widget "CustomSlaveBoobs">>
	<<replace #boobs>>
		<<if $customSlave.boobs is 200>>Flat chest.
		<<elseif $customSlave.boobs <= 500>>Healthy breasts.
		<<else>>Big breasts.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveButt>>
%/
<<widget "CustomSlaveButt">>
	<<replace #butt>>
		<<if $customSlave.butt == 1>>Flat buttocks.
		<<elseif $customSlave.butt < 4>>Healthy buttocks.
		<<else>>Huge buttocks.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveVagina>>
%/
<<widget "CustomSlaveVagina">>
	<<replace #vagina>>
		<<if $customSlave.vagina is -1>>No vagina.
		<<elseif $customSlave.vagina == 0>>Vaginal virgin.
		<<else>>Normal vagina.
		<</if>>
		<<if $customSlave.dick > 0>>
		<<click "No vagina">>
			<<set $customSlave.vagina to -1, $customSlave.preg to -2, $customSlave.ovaries to 0>>
			<<CustomSlaveVagina>>
		<</click>>
		<<else>>//No vagina//
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveDick>>
%/
<<widget "CustomSlaveDick">>
	<<replace #dick>>
		<<if $customSlave.dick == 0>>No penis.
		<<elseif $customSlave.dick is 2>>Small penis.
		<<else>>Large penis.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveClitBalls>>
%/
<<widget "CustomSlaveClitBalls">>
	<<replace #clitballs>>
	<<if $customSlave.dick > 0>>
	<<if $customSlave.balls == 0>>No testicles.<<elseif $customSlave.balls is 3>>Small testicles.<<else>>Large testicles.<</if>>
	<<click "No testicles">>
		<<set $customSlave.balls to 0,$customSlave.clit to 0>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Small testicles">>
		<<set $customSlave.balls to 2,$customSlave.clit to 0>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Large testicles">>
		<<set $customSlave.balls to 4,$customSlave.clit to 0>>
		<<CustomSlaveClitBalls>>
	<</click>>
	<<else>>
	<<if $customSlave.clit == 0>>Normal clitoris.<<elseif $customSlave.clit == 0>>Big clitoris.<<else>>Enormous clitoris.<</if>>
	<<click "Normal clitoris">>
		<<set $customSlave.clit to 0>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Big clitoris">>
		<<set $customSlave.clit to 1>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Enormous clitoris">>
		<<set $customSlave.clit to 2>>
		<<CustomSlaveClitBalls>>
	<</click>>

	<<if $customSlave.labia == 0>>Minimal labia.<<elseif $customSlave.labia == 1>>Normal labia.<<elseif $customSlave.labia is 2>>Huge labia.<<else>>Enormous labia.<</if>>
	<<click "Minimal labia">>
		<<set $customSlave.labia to 0>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Normal labia">>
		<<set $customSlave.labia to 1>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Huge labia">>
		<<set $customSlave.labia to 2>>
		<<CustomSlaveClitBalls>>
	<</click>>
	|
	<<click "Enormous labia">>
		<<set $customSlave.labia to 3>>
		<<CustomSlaveClitBalls>>
	<</click>>
	<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveAnus>>
%/
<<widget "CustomSlaveAnus">>
	<<replace #anus>>
		<<if $customSlave.anus == 0>>Anal virgin.
		<<else>>Normal anus.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveSkills>>
%/
<<widget "CustomSlaveSkills">>
	<<replace #skills>>
		<<if $customSlave.analSkill <= 10>>Sexually unskilled.
		<<elseif $customSlave.analSkill <= 30>>Basic skills..
		<<elseif $customSlave.analSkill <= 60>>Sexually skilled.
		<<else>>Sexual expert.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveWhoreSkills>>
%/
<<widget "CustomSlaveWhoreSkills">>
	<<replace #whoreskills>>
		<<if $customSlave.whoreSkill <= 10>>Unskilled at prostitution and entertainment.
		<<elseif $customSlave.whoreSkill <= 30>>Basic prostitution and entertainment skills.
		<<elseif $customSlave.whoreSkill <= 60>>Skilled at prostitution and entertainment.
		<<else>>Prostitution and entertainment expert.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveCombatSkills>>
%/
<<widget "CustomSlaveCombatSkills">>
	<<replace #combatskills>>
		<<if $customSlave.combatSkill == 0>>Unskilled at combat.
		<<else>>Skilled at combat.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveIntelligence>>
%/
<<widget "CustomSlaveIntelligence">>
	<<replace #intelligence>>
		<<if $customSlave.intelligence >= 3>>Brilliant.
		<<elseif $customSlave.intelligence is 2>>Very smart..
		<<elseif $customSlave.intelligence == 1>>Smart.
		<<elseif $customSlave.intelligence == 0>>Average intelligence.
		<<elseif $customSlave.intelligence is -1>>Stupid.
		<<elseif $customSlave.intelligence is -2>>Very stupid.
		<<else>>Moronic.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveEducation>>
%/
<<widget "CustomSlaveEducation">>
	<<replace #education>>
		<<if $customSlave.intelligenceImplant == 1>>Educated.
		<<else>>Uneducated.
		<</if>>
	<</replace>>
<</widget>>

/%
 Call as <<CustomSlaveNationality>>
%/
<<widget "CustomSlaveNationality">>
	<<replace #nationality>>
		Nationality: $customSlave.nationality.
	<</replace>>
<</widget>>

repo_name: shoku/fc


code:
# Storm Network Roadmap

## Getting started

To make it easy for you to get started with GitLab, here's a list of recommended next steps.

Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!

## Add your files

- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:

```
cd existing_repo
git remote add origin https://gitgud.io/nikolay/storm-network-roadmap.git
git branch -M master
git push -uf origin master
```

## Integrate with your tools

- [ ] [Set up project integrations](https://gitgud.io/nikolay/storm-network-roadmap/-/settings/integrations)

## Collaborate with your team

- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)

## Test and Deploy

Use the built-in continuous integration in GitLab.

- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)

***

# Editing this README

When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.

## Suggestions for a good README

Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.

## Name
Choose a self-explaining name for your project.

## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.

## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.

## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.

## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.

## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.

## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.

## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.

## Contributing
State if you are open to contributions and what your requirements are for accepting them.

For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.

You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.

## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.

## License
For open source projects, say how it is licensed.

## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

repo_name: nikolay/storm

license: unknown


code:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2

## Intermediate documents:
*.dvi
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf

## Generated if empty string is given at "Please type another file name for output:"
.pdf

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.brf
*.run.xml

## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync

## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa

# achemso
acs-*.bib

# amsthm
*.thm

# beamer
*.nav
*.snm
*.vrb

# cprotect
*.cpt

# fixme
*.lox

#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R

# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs

# gnuplottex
*-gnuplottex-*

# gregoriotex
*.gaux
*.gtex

# hyperref
*.brf

# knitr
*-concordance.tex
# TODO Comment the next line if you want to keep your tikz graphics files
*.tikz
*-tikzDictionary

# listings
*.lol

# makeidx
*.idx
*.ilg
*.ind
*.ist

# minitoc
*.maf
*.mlf
*.mlt
*.mtc
*.mtc[0-9]
*.mtc[1-9][0-9]

# minted
_minted*
*.pyg

# morewrites
*.mw

# mylatexformat
*.fmt

# nomencl
*.nlo

# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd

# scrwfile
*.wrt

# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/

# pdfcomment
*.upa
*.upb

# pythontex
*.pytxcode
pythontex-files-*/

# thmtools
*.loe

# TikZ & PGF
*.dpth
*.md5
*.auxlock

# todonotes
*.tdo

# easy-todo
*.lod

# xindy
*.xdy

# xypic precompiled matrices
*.xyc

# endfloat
*.ttt
*.fff

# Latexian
TSWLatexianTemp*

## Editors:
# WinEdt
*.bak
*.sav

# Texpad
.texpadtmp

# Kile
*.backup

# KBibTeX
*~[0-9]*

# auto folder when using emacs and auctex
/auto/*

*.pdf

repo_name: dtluna/modelling

path: .gitignore

license: mit


code:
[MASTER]

# Specify a configuration file.
#rcfile=

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=

# Pickle collected data for later comparisons.
persistent=yes

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=

# Use multiple processes to speed up Pylint.
jobs=1

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=

# Allow optimization of some AST trees. This will activate a peephole AST
# optimizer, which will apply various small optimizations. For instance, it can
# be used to obtain the result of joining multiple strings with the addition
# operator. Joining a lot of strings can lead to a maximum recursion error in
# Pylint and this flag can prevent that. It has one side effect, the resulting
# AST will be different than the one from reality. This option is deprecated
# and it will be removed in Pylint 2.0.
optimize-ast=no

[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
#enable=

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=invalid-name,missing-docstring,parameter-unpacking,oct-method,range-builtin-not-iterating,unicode-builtin,xrange-builtin,filter-builtin-not-iterating,reduce-builtin,coerce-method,unpacking-in-except,using-cmp-argument,intern-builtin,coerce-builtin,raising-string,old-raise-syntax,unichr-builtin,metaclass-assignment,dict-iter-method,zip-builtin-not-iterating,standarderror-builtin,print-statement,old-ne-operator,long-suffix,basestring-builtin,backtick,dict-view-method,suppressed-message,round-builtin,cmp-method,old-octal-literal,execfile-builtin,buffer-builtin,map-builtin-not-iterating,hex-method,raw_input-builtin,useless-suppression,file-builtin,next-method-called,reload-builtin,long-builtin,old-division,indexing-exception,getslice-method,no-absolute-import,setslice-method,import-star-module-level,input-builtin,delslice-method,nonzero-method,cmp-builtin,apply-builtin,too-few-public-methods

[REPORTS]

# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html. You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]". This option is deprecated
# and it will be removed in Pylint 2.0.
files-output=no

# Tells whether to display a full report or only the messages
reports=yes

# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=

[LOGGING]

# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging

[TYPECHECK]

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=

# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=

# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager

[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO

[SPELLING]

# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=

# List of comma separated words that should not be checked.
spelling-ignore-words=

# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=

# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no

[BASIC]

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=

# Include a hint for the correct naming format with invalid-name
include-naming-hint=no

# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct method names
method-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for method names
method-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for attribute names
attr-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct function names
function-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for function names
function-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct argument names
argument-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for argument names
argument-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$

# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

# Regular expression matching correct variable names
variable-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for variable names
variable-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1

[ELIF]

# Maximum number of nested blocks for function / method body
max-nested-blocks=5

[VARIABLES]

# Tells whether we should check for unused import in __init__ files.
init-import=no

# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy

# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=

# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins

[SIMILARITIES]

# Minimum lines number of a similarity.
min-similarity-lines=4

# Ignore comments when computing similarities.
ignore-comments=yes

# Ignore docstrings when computing similarities.
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=no

[FORMAT]

# Maximum number of characters on a single line.
max-line-length=100

# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$

# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

# String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
# tab).
indent-string='    '

# Number of spaces of indent required inside a hanging  or continued line.
indent-after-paren=4

# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=

[IMPORTS]

# Deprecated modules which should not be used, separated by a comma
deprecated-modules=optparse

# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=

# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=

# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=

# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=

# Force import order to recognize a module as part of a third party library.
known-third-party=enchant

# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no

[CLASSES]

# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp

# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls

# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs

# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make

[DESIGN]

# Maximum number of arguments for function / method
max-args=5

# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*

# Maximum number of locals for function / method body
max-locals=15

# Maximum number of return / yield for function / method body
max-returns=6

# Maximum number of branch for function / method body
max-branches=12

# Maximum number of statements in function / method body
max-statements=50

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Minimum number of public methods for a class (see R0903).
min-public-methods=2

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of boolean expressions in a if statement
max-bool-expr=5

[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception

path: .pylintrc


code:
#!/usr/bin/env python3
from typing import Tuple, Sequence
from argparse import ArgumentParser
from math import sqrt, isclose
from array import array
from numpy import histogram as hs
from matplotlib.pyplot import bar, show, text
from matplotlib import rc

rc('font', **{'family': 'Aref', 'size': '20'})
rc('text', usetex=True)
rc('text.latex', unicode=True)
rc('text.latex', preamble='\\usepackage[utf8]{inputenc}')
rc('text.latex', preamble='\\usepackage[russian]{babel}')

parser = ArgumentParser()
parser.add_argument('-a', type=int, default=23)
parser.add_argument('-m', type=int, default=100)
parser.add_argument('-r', type=float, default=0.6)
parser.add_argument('-N', type=int, default=1000000)

rel_tol = 10**(-5.5)
params_height = -0.005
results_height = 0.065
results_height2 = 0.063

def f(r: float, a: int, m: int) -> Tuple[float, float]:
    rn = (a * r) % m
    return (rn / m, rn)

def sequence(r: float, n: int, a: int, m: int) -> array:
    res = array('d')
    for _ in range(n-1):
        x, r = f(r, a, m)
        res.append(x)
    return res

def expected_value(l: Sequence) -> float:
    """Должно быть 0.5"""
    return sum(l) / len(l)

def criterion(l: Sequence) -> int:
    k = 0
    for i in range(len(l)//2):
        if l[2*i]**2 + l[2*i+1]**2 < 1:
            k += 1
    return k

def normalize(hist: Sequence, n: int) -> tuple:
    return tuple(map(lambda x: x/n, hist))

def period(xs: Sequence) -> int:
    i1 = None
    i2 = None
    xv = xs[-1]
    for i, x in enumerate(xs):
        if isclose(x, xv, rel_tol=rel_tol) and i1 is None:
            i1 = i
        elif isclose(x, xv, rel_tol=rel_tol) and i1 is not None:
            i2 = i
            return i2 - i1

def aperiodic_length(xs: Sequence, p: int) -> int:
    for i, v in enumerate(xs):
        if isclose(v, xs[i+p], rel_tol=rel_tol):
            return i+p

def main() -> None:
    args = parser.parse_args()
    r0 = args.r
    a = args.a
    m = args.m
    N = args.N
    D = ((2**N + 1) / (2**N - 1)) / 12
    seq = sequence(r0, N, a, m)
    p = period(seq)

    hist, bins = hs(seq, 20)
    width = 0.7 * (bins[1] - bins[0])
    center = (bins[:-1] + bins[1:]) / 2
    hist = normalize(hist, N)
    bar(center, hist, align='center', width=width)
    text(0, params_height, 'N: %d' % N)
    text(bins[6], params_height, 'a: %d' % a)
    text(bins[12], params_height, 'm: %d' % m)
    text(bins[18], params_height, 'R0: %f' % r0)
    text(0, results_height, 'Мат ожидание: %f' % expected_value(seq))
    text(bins[6], results_height, 'Дисперсия: %f' % D)
    text(bins[12], results_height,
         'Среднеквадратичное отклонение: %f' % sqrt(D))
    text(0, results_height2, '2K/N: %f' % (2 * criterion(seq) / N))
    text(bins[6], results_height2, 'Длина периода: %d' % p)
    text(bins[12], results_height2,
         'Длина участка апериодичности: %d' % aperiodic_length(seq, p))
    show()

if __name__ == '__main__':
    main()


code:
#!/usr/bin/env python3
from math import log
from random import random
from main import display, parser

parser.add_argument('-l', required=True, type=float)

def exp(l: float) -> float:
    return -1*log(random())/l

def main():
    args = parser.parse_args()
    s = [exp(args.l) for _ in range(args.N)]
    display(s, title=('Экспоненциальное распределение \\lambda: %f' % args.l),
            m=1/args.l, D=1/(args.l**2))

if __name__ == '__main__':
    main()


code:
#!/usr/bin/env python3
from random import random
from math import log
from main import display, parser

parser.add_argument('-l', required=True, type=float)
parser.add_argument('-n', required=True, type=int)

def gamma(l: float, n: int) -> float:
    r = 1
    for _ in range(n):
        r *= random()
    return -1*log(r)/l

def main():
    args = parser.parse_args()
    s = [gamma(args.l, args.n) for _ in range(args.N)]
    display(s, title=('Гамма-распределение \\lambda: %f \\eta: %d' %
                      (args.l, args.n)),
            m=args.n/args.l,
            D=args.n/(args.l**2))

if __name__ == '__main__':
    main()


code:
#!/usr/bin/env python3
from math import sqrt
from random import random
from main import display, parser

parser.add_argument('-m', required=True, type=float)
parser.add_argument('-s', required=True, type=float)

def gauss(m: float, s: float) -> float:
    r = 0
    for _ in range(6):
        r += random()
    return m + s*sqrt(2)*(r-3)

def main():
    args = parser.parse_args()
    seq = [gauss(args.m, args.s) for _ in range(args.N)]
    display(seq,
            title='Гауссовское распределение',
            m=args.m,
            D=args.s**2)

if __name__ == '__main__':
    main()


code:
from typing import Sequence
from math import sqrt
from argparse import ArgumentParser
from numpy import histogram
from matplotlib.pyplot import bar, show
from matplotlib.pyplot import title as set_title
from matplotlib import rc

rc('font', **{'family': 'Aref', 'size': '20'})
rc('text', usetex=True)
rc('text.latex', unicode=True)
rc('text.latex', preamble='\\usepackage[utf8]{inputenc}')
rc('text.latex', preamble='\\usepackage[russian]{babel}')

params_height = -0.01

parser = ArgumentParser()
parser.add_argument('-N', type=int, default=1000000)

def normalize(hist: Sequence, n: int) -> tuple:
    return tuple(map(lambda x: x/n, hist))

def display(seq: Sequence, title: str, m: float, D: float) -> None:
    title_t = """%s
Мат. ожидание: %f Дисперсия: %f Среднеквадратичное отклонение: %f"""
    set_title(title_t % (title, m, D, sqrt(D)))

    hist, bins = histogram(seq, 20)
    width = 0.7 * (bins[1] - bins[0])
    center = (bins[:-1] + bins[1:]) / 2
    hist = normalize(hist, len(seq))
    bar(center, hist, align='center', width=width)
    show()


code:
#!/usr/bin/env python3
from random import uniform as u
from uniform import dispersion, expected_value, display, parser

def simpson(a: float, b: float) -> float:
    return u(a/2, b/2) + u(a/2, b/2)

def main():
    args = parser.parse_args()
    a, b = args.a, args.b
    s = [simpson(a, b) for _ in range(args.N)]
    display(s,
            title=('Распределение Симпсона a: %f b: %f' % (a, b)),
            m=expected_value(s),
            D=dispersion(a, b))

if __name__ == '__main__':
    main()


code:
from random import random
from main import display
from uniform import dispersion, expected_value, parser

def tri1(a: float, b: float) -> float:
    return a + (b - a)*max(random(), random())

def tri2(a: float, b: float) -> float:
    return a + (b - a)*min(random(), random())

def main(func):
    args = parser.parse_args()
    s = [func(args.a, args.b) for _ in range(args.N)]
    display(s,
            title=('Треугольное распределение a: %f b: %f' % (args.a, args.b)),
            m=expected_value(s),
            D=dispersion(args.a, args.b))


code:
#!/usr/bin/env python3
from tri import main, tri2

if __name__ == '__main__':
    main(tri2)


code:
#!/usr/bin/env python3
from tri import main, tri1

if __name__ == '__main__':
    main(tri1)


code:
#!/usr/bin/env python3
from typing import Sequence
from random import random
from main import display, parser

parser.add_argument('-a', required=True, type=float)
parser.add_argument('-b', required=True, type=float)

def uniform(a: float, b: float) -> float:
    return a + (b - a)*random()

def expected_value(l: Sequence) -> float:
    """Должно быть 0.5"""
    return sum(l) / len(l)

def dispersion(a: float, b: float) -> float:
    return ((b - a)**2) / 12

def main():
    args = parser.parse_args()
    N = args.N
    a = args.a
    b = args.b
    D = dispersion(a, b)
    seq = [uniform(a, b) for _ in range(N)]
    display(seq,
            ('Равномерное распределение a: %f b: %f' % (a, b)),
            m=expected_value(seq),
            D=D)

if __name__ == '__main__':
    main()


code:
LATEX=pdflatex --shell-escape
SOURCES=report.tex
TITLE=title.pdf
RESOURCES=schema.png results.png imit.py $(TITLE)
PDFS=$(SOURCES:.tex=.pdf)
TARGET=print-$(PDFS)

all: $(SOURCES) $(RESOURCES) $(TARGET)

$(PDFS): $(SOURCES) $(RESOURCES)
	$(LATEX) $< -o $@

$(TARGET): $(PDFS)
	pdfunite $(TITLE) $< $@

clean-build: $(SOURCES) $(RESOURCES)
	rm *.aux *.log

clean: $(SOURCES) $(RESOURCES) clean-build
	rm $(PDFS) $(TARGET)

remake: $(SOURCES) $(RESOURCES)
	make clean
	make all


code:
#!/usr/bin/env python3
import random
from collections import Counter

class Ticket:
    def __init__(self, ticket_id):
        self.ticket_id = ticket_id
        self.ticks_in_queue = 0
        self.active = True

    def deactivate(self):
        self.active = False

tickets = []
ticks_num = 100000
p = 0.5
pi1 = 0.4
pi2 = 0.4
completed_tickets_num = 0
counter = Counter()

ch2_full = False
ch2_ticket = None
ch1_full = False
ch1_ticket = None
q1_full = False
q1_ticket = None
q2_full = False
q2_ticket = None
gen_ticket = None

for _ in range(ticks_num):
    if ch2_full:
        if random.random() > pi2:
            completed_tickets_num += 1
            ch2_ticket.deactivate()
            ch2_ticket = None
            ch2_full = False

    if ch1_full:
        if random.random() > pi1:
            if not ch2_full:
                ch2_full = True
                ch2_ticket = ch1_ticket
                ch1_ticket = None
                ch1_full = False
            else:
                ch1_full = False
                ch1_ticket.deactivate()
                ch1_ticket = None

    if q1_full:
        if not ch1_full:
            ch1_full = True
            ch1_ticket = q1_ticket
            q1_full = False
            q1_ticket = None

    if q2_full:
        if not q1_full:
            q1_full = True
            q1_ticket = q2_ticket
            q2_full = False
            q2_ticket = None

    if random.random() > p:
        ticket = Ticket(tickets)
        tickets.append(ticket)
        if ch1_full is False:
            ch1_full = True
            ch1_ticket = ticket
        elif q1_full is False:
            q1_full = True
            q1_ticket = ticket
        elif q2_full is False:
            q2_ticket = ticket
            q2_full = True
        else:
            ticket.deactivate()

    if q1_full:
        q1_ticket.ticks_in_queue += 1

    if q2_full:
        q2_ticket.ticks_in_queue += 1

    queue_size = 0

    if q1_full and q2_full:
        queue_size = 2
    elif not q1_full and not q2_full:
        queue_size = 0
    else:
        queue_size = 1

    counter.update(['%d%d%d' % (queue_size, ch1_full, ch2_full)])

for state, state_count in sorted(counter.items()):
    print('P%s =' % state, state_count/ticks_num)
print('A =', completed_tickets_num/ticks_num)
print('Q =', completed_tickets_num/len(tickets))

time_in_queue = 0  # общее время нахождения всех заявок в очереди

for ticket in tickets:
    time_in_queue += ticket.ticks_in_queue
med_time_in_queue = time_in_queue/len(tickets)

print('Wq =', med_time_in_queue)


code:
\documentclass[a4paper,11pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[russian,english]{babel}
\usepackage{float}
\usepackage{minted}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{mathtools}
\usepackage{amsmath}

\begin{document}

Вариант 12

Схема:
\linebreak
\includegraphics[scale=0.5]{schema}

Кодировка: \\
j = \{0, 1, 2\} – кол-во заявок в очереди;\\
t1 = \{0, 1\} – кол-во заявок в канале №1;\\
t2 = \{0, 1\} – кол-во заявок в канале №2;\\
Общий вид кодировки состояния системы:
\{j, t1, t2\}\\

\begin{center}
  \begin{longtabu}{| c | c | c | c |}
    \hline
    Исходное состояние & Состояния, в которые переходит система & Вероятность перехода \\ \hline
    P1 000
         & 000 & $\rho$\\ \cline{2-3}
         & 010 & $1-\rho$\\ \hline

    P2 001
         & 001 & $\rho\pi2$\\ \cline{2-3}
         & 000 & $\rho(1-\pi2)$\\ \cline{2-3}
         & 011 & $(1-\rho)\pi2$\\ \cline{2-3}
         & 010 & $(1-\rho)(1-\pi2)$\\ \hline

    P3 010
         & 010 & $\rho\pi1$\\ \cline{2-3}
         & 001 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 110 & $(1-\rho)\pi1$\\ \cline{2-3}
         & 011 & $(1-\rho)(1-\pi1)$\\ \hline

    P4 011
         & 011 & $\rho\pi1\pi2 + (1-\rho)(1-\pi1)$\\ \cline{2-3}
         & 010 & $\rho\pi1(1-\pi2)$\\ \cline{2-3}
         & 001 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 111 & $(1-\rho)\pi1\pi2$\\ \cline{2-3}
         & 110 & $(1-\rho)\pi1(1-\pi2)$\\ \hline

    P5 110
         & 110 & $\rho\pi1$\\ \cline{2-3}
         & 011 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 210 & $(1-\rho)\pi1$\\ \cline{2-3}
         & 111 & $(1-\rho)(1-\pi1)$\\ \hline
    P6 111
         & 111 & $\rho\pi1\pi2 + (1-\rho)(1-\pi1)$\\ \cline{2-3}
         & 110 & $\rho\pi1(1-\pi2)$\\ \cline{2-3}
         & 011 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 211 & $(1-\rho)\pi1\pi2$\\ \cline{2-3}
         & 210 & $(1-\rho)\pi1(1-\pi2)$\\ \hline
    \pagebreak
    \hline
    P7 210
         & 210 & $\pi1$\\ \cline{2-3}
         & 111 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 211 & $(1-\rho)(1-\pi1)$\\ \hline

    P8 211
         & 111 & $\rho(1-\pi1)$\\ \cline{2-3}
         & 210 & $\pi1(1-\pi2)$\\ \cline{2-3}
         & 211 & $\pi1\pi2+(1-\rho)(1-\pi1)$\\ \hline
  \end{longtabu}
\end{center}

Система уравнений:
\begin{enumerate}
  \item $P1 = \rho{}P1 + \rho(1-\pi2)P2$
  \item $P2 = \rho\pi2P2 + \rho(1-\pi1)P3 + \rho(1-\pi1)P4$
  \item $P3 = (1-\rho)P1 + (1-\rho)(1-\pi2)P2 + \rho\pi1P3 + \rho\pi1(1-\pi2)P4$
  \item $P4 = (1-\rho)\pi2P2 + (1-\rho)(1-\pi1)P3 + (\rho\pi1\pi2 + (1-\rho)(1-\pi1))P4 +\\+ \rho(1-\pi1)P5 + \rho(1-\pi1)P6$
  \item $P5 = (1-\rho)\pi1P3 + (1-\rho)\pi1(1-\pi2)P4 + \rho\pi1P5 + \rho\pi1(1-\pi2)P6$
  \item $P6 = (1-\rho)\pi1\pi2P4 + (1-\rho)(1-\pi1)P5 + (\rho\pi1\pi2 + (1-\rho)(1-\pi1))P6 +\\+ \rho(1-\pi1)P7 + \rho(1-\pi1)P8$
  \item $P7 = (1-\rho)\pi1P5 + (1-\rho)\pi1(1-\pi2)P6 + \pi1P7 + \pi1(1-\pi2)P8$
  \item $P8 = (1-\rho)\pi1\pi2P6 + (1-\rho)(1-\pi1)P7 + (\pi1\pi2 + (1-\rho)(1-\pi1))P8$
  \item $\displaystyle\sum_{i=1}^{8} P_i = 1$
\end{enumerate}

Решения:\\
$P1 = 0.0829918032787$\\
$P2 = 0.138319672131$\\
$P3 = 0.138319672131$\\
$P4 = 0.230532786885$\\
$P5 = 0.0922131147541$\\
$P6 = 0.15368852459$\\
$P7 = 0.0907494145199$\\
$P8 = 0.0731850117096$\\

Исходя из полученных данных рассчитаем следующие параметры системы:
\begin{enumerate}
  \item относительная пропускная способность $Q$;
  \item среднее время пребывания заявки в очереди $W_{q}$;
  \item абсолютная пропускная способность $A$.
\end{enumerate}
Для расчета $W_{q}$ предварительно была рассчитана средняя длина очереди $L_{q}$ и интенсивность входного потока $\lambda$.

\begin{align*}
A &= (P2 + P4 + P6 + P8)(1 - \pi2) = 0.35743559719\\
\lambda &= 1 - \rho = 0.5\\
Q &= \dfrac{A}{\lambda} = 0.714871194379\\
L_{q} &= 1(P5 + P6) + 2(P7 + P8) = 0.573770491803\\
W_{q} &= \dfrac{L_{q}}{\lambda} = 1.14754098361\\
\end{align*}

Результаты работы:\\
\includegraphics[scale=0.5]{results}

\pagebreak
Листинг расчётного модуля программы:\\
\inputminted[linenos]{python}{imit.py}
\end{document}