Skip to content

Instantly share code, notes, and snippets.

View AlexMorgan3817's full-sized avatar
🖥️
Working from home

AlexMorgan3817 AlexMorgan3817

🖥️
Working from home
View GitHub Profile
@AlexMorgan3817
AlexMorgan3817 / _SavingCore.dm
Last active November 21, 2021 15:07
Saving of objects between rounds, just include, simply include _SavingCore.dm and saving.dm to your project and as example use saving_implementation for setting saving for your build. 我的朋友生日礼物. My not executed promise from past.
//#define LOADING_SAVES_TYPE_WORLD_INIT 1
//#define SAVING_SAVES_TYPE_MASTER_CONTROLLER_DEATH 1
#ifndef GLOBAL_LIST_EMPTY
#define GLOBAL_LIST_EMPTY(n) var/static/list/##n = list()
#endif
#ifndef GLOBAL_VAR_INIT
#define GLOBAL_VAR_INIT(n, value) var/static/##n = value
#endif
GLOBAL_LIST_EMPTY(SavingCache)
@AlexMorgan3817
AlexMorgan3817 / Persistent.py
Created October 24, 2021 06:04
Write a function, persistence, that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit.
def multiplyList(l):
dot = 1
for i in l:
dot *= i
return dot
def persistence(n, depth = 0):
nstr = str(n)
if len(nstr) == 1:
return depth
dot = multiplyList([int(i) for i in list(nstr)])
@AlexMorgan3817
AlexMorgan3817 / DegreeToList.py
Created September 11, 2021 15:41
Converts real degrees to list of decimal degrees, minutes, seconds
def DegreeToList(degree):
dot = []
seconds = degree * 3600
hours = seconds // 3600
seconds -= hours*3600
minutes = seconds // 60
seconds -= minutes * 60
seconds = round(seconds)
minutes = round(minutes)
using System;
using System.Collections.Generic;
public class RomanDecode
{
private static readonly Dictionary<char, int> RomanToNum = new Dictionary<char, int>
{
['I'] = 1,
['V'] = 5,
['X'] = 10,
@AlexMorgan3817
AlexMorgan3817 / _time_of_Year.py
Created April 22, 2021 14:34
Num2TimeOfYear. Uses my dice difficult module.
from difficult_module import Difficult2Str as num2toy, Difficult as time_of_year
Difficults = [
time_of_year("Winter", range(0, 3)),
time_of_year("Spring", range(3, 6)),
time_of_year("Summer", range(6, 9)),
time_of_year("Autumn", range(9, 12))
]
def Num2TimeOfYear(Month):
@AlexMorgan3817
AlexMorgan3817 / Sampler.py
Last active January 28, 2021 12:45
This Script use .yml to create multiply samples of same file, but with changed parts
import sys
from os import system as sh
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
class ErrorCode:
@AlexMorgan3817
AlexMorgan3817 / dice_difficult.py
Last active January 27, 2021 12:02
Dice Difficult to string
class Difficult:
Name = "None"
Range = range(1)
def __init__(self, _name, _range):
self.Name = _name
self.Range = _range
def __str__(self):
return f"[{self.Name}, {self.Range}"
Difficults = [
using System;
using System.Collections.Generic;
using System.Linq;
public class Deck
{
private Random rand;
public string[] DefaultDeck = new string[]
{
"The Magician",
"The High Priestess",