Welcome, Guest

Author Topic: Coding  (Read 261922 times)

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #420 on: July 20, 2014, 10:40:15 AM »
but wait now it tracks mouse presses also

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #421 on: July 25, 2014, 01:35:18 AM »
fixed version of tlog

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #422 on: July 25, 2014, 01:37:12 AM »
so once upon a time i wanted to make a minecraft banner in the shape of a sickle. of course, i automated this process

goal.png is the goal state
done.png is the current state
all the other images are the patterns.

there are two functions in permutator.py
one of the tries to brute force patterns and find a matching banner
the other one also brute forces but adaptively changes the weights so certain patterns are used more.
in practice, they both run about the same.

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #423 on: July 25, 2014, 05:34:50 AM »
11.25kB and its a rar 0.0

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #424 on: August 08, 2014, 11:07:49 PM »
brownian tree fractal





and lyapunov fractals




Jorster

  • ****
  • Posts: 37
  • karma chameleon
Re: Coding
« Reply #425 on: August 09, 2014, 09:22:19 PM »
Here's the code for the Jister bot on IRC, if anyone cares.
Code: [Select]
import socket
import random
import time
       
server = "irc.freenode.net" # Server
channel = "##universesandbox" # Channel
botnick = "Jister" # Your bots nick
with open("kol.txt", "rt") as in_file:
koltimes = in_file.readline()
koltimes = int(koltimes)
with open("mfw.txt", "rt") as in_file:
mfwtimes = in_file.readline()
mfwtimes = int(mfwtimes)
shitlist = [" :kol\n", " :jkok\n", " :peacock\n", " :trollface.png\n", " :jackie_chan.png\n", " :misc_jackie_chan.png\n", " :home phone\n", " :mpw\n", " :mfw\n", " :what the christ\n", " :what the pony\n", " :allahu ackbar\n", " :ackbar\n", " :con\n", " :kolok\n", " :hpw\n", " :hfw\n", " :u wot m8\n", " :hue\n", " :peasant\n", " :what_the_christ.png\n", " :dar_on_his_sides.png\n", " :music.avi\n", " :sugg\n", " :inb4\n", " :peacock\n", " :plot twist\n", " :gorchul\n", " :my homeschooling when\n", " :pants.bigger\n", " :what the inafter christ\n", " :kolmunism\n", " :kolkommunism\n", " :sell your cars\n", " :donate your cars\n", " :kol\n", " :kolkon\n", " :inb4\n", " :hue\n", " :what the jkok\n", " :blotz is literally of jkok\n", " :bangkok\n"]

def ping(): # Respond to server pings
  ircsock.send("PONG :pingis\n") 

def joinchan(chan): # Join a channel
  ircsock.send("JOIN "+ chan +"\n")

def randShitSpeak(): # Randomly selects a shitspeak phrase
ircsock.send("PRIVMSG " + channel + random.choice(shitlist))

ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ircsock.connect((server, 6667)) # Here we connect to the server using the port 6667
ircsock.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :Jister - A bot made by Jorster on USF\n") # user authentication
ircsock.send("NICK "+ botnick +"\n") # here we actually assign the nick to the bot

joinchan(channel) # Join the channel using the functions we previously defined

while 1: # Be careful with these! it might send you to an infinite loop
ircmsg = ircsock.recv(2048) # receive data from the server
ircmsg = ircmsg.strip('\n\r') # removing any unnecessary linebreaks.
ircmsg = ircmsg.lower() # Converting to lowercase for easier finding of kol
ircmsg = ircmsg.replace('osmotikol', 'dsfjak')
ircmsg = ircmsg.replace('!kol', 'dsfjal')
ircmsg = ircmsg.replace('!mfw', 'whatthejkok.avi')
print(ircmsg) # Here we print what's coming from the server
if ircmsg.find("ping :") != -1: # If the server pings us then we've got to respond!
ping()
if ircmsg.find("##universesandbox") != -1: # Make sure we're getting a message from the irc channel
if ircmsg.find("kol") != -1: # If someone says kol
koltimes += 1 # Add one to the koltimes variable
if koltimes == 3000:
ircsock.send("PRIVMSG " + channel + " :Congratulations!\n")
ircsock.send("PRIVMSG " + channel + " :UniverseSandbox has reached 3000 kols!\n")
with open("kol.txt", "wt") as out_file: # Open the kol.txt file
out_file.write(str(koltimes)) # Populate the file with the kol number
if ircmsg.find("mfw") != -1:
mfwtimes += 1
with open("mfw.txt", "wt") as out_file:
out_file.write(str(mfwtimes))
if ircmsg.find("whatthejkok.avi") != -1:
ircsock.send("PRIVMSG " + channel + " :mfw has been said " + str(mfwtimes) + " times!\n")
if ircmsg.find("soul") != -1: # If someone says soul
randShitSpeak() # Respond with shitspeak
if ircmsg.find("!jister") != -1: # If someone says !Jister
ircsock.send("PRIVMSG "+ channel + " :Jister v1.8 - A bot by Jorster. Counts the number of Kol's and Mfw's said in IRC, retrieve them via !kol and !mfw, respectively.\n") # Gives bot info
if ircmsg.find("dsfjal") != -1: # If someone says !kol
ircsock.send("PRIVMSG "+ channel + " :kol has been said " + str(koltimes) + " times!\n") # Respond with the number of times kol has been said
if ircmsg.find("thomas") != -1: # if someone says thomas
ircsock.send("PRIVMSG "+ channel + " :thamis*\n") #correct them to thamis
if ircmsg.find("BlaBla44") != -1:
if (random.randint(1,100)) == 1:
ircsock.send("PRIVMSG "+ channel + randShitSpeak())

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #426 on: August 10, 2014, 05:38:09 AM »
Code: [Select]
if ircmsg.find("BlaBla44") != -1:
if (random.randint(1,100)) == 1:
ircsock.send("PRIVMSG "+ channel + randShitSpeak())

omg im' dying

Jorster

  • ****
  • Posts: 37
  • karma chameleon
Re: Coding
« Reply #427 on: August 10, 2014, 09:33:08 AM »
Shhh soopir sekrit feature

PrimeMinisterTom

  • ****
  • Posts: 53
  • GANDALF IS WATCHING YOU! New Alpha Tester.
Re: Coding
« Reply #428 on: August 12, 2014, 02:45:18 AM »
Post python code, python stuff, maybe even a python.

esidgbsdgclesgdkzugy. Python.

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #429 on: September 01, 2014, 10:23:38 AM »
a pure montecarlo algorithm that solves the puzzle from this app
https://itunes.apple.com/us/app/magical-water/id409979686?mt=8

although this link to a very similar game explains the puzzle better
http://android.m.brothersoft.com/dropspuzzle-157758.html

given a few seconds of thinking time, it performs better than the average human

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #430 on: September 01, 2014, 10:43:52 PM »
you'll have to open the file and make minor adjustments to use this.

basically, it count the number of files/subdirs on your desktop (or any directory) once per minute, and writes it to file.

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #431 on: September 06, 2014, 10:03:14 PM »
req tkinter and matplotlib

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #432 on: October 05, 2014, 09:51:55 AM »
this plots the brightness of a 24-hour digital LED clock assuming it displays leading zeroes

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #433 on: October 05, 2014, 09:53:43 AM »
a flashcard tool which takes into account the weighing of each card and a forgetting curve.

run fcardtest

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #434 on: October 05, 2014, 09:54:45 AM »
this attempts to put n points in a plane so that they are 1 unit away from every other point. obviously this is impossible, but that doesn't stop me

Stevodoran

  • *****
  • Posts: 77
Re: Coding
« Reply #435 on: October 16, 2014, 10:51:21 AM »
This is my first bit of code done in c#. What do yous think? Its very basic I know but for my first time I think its alright.

Is the structure alright?

Code: [Select]
/*
 *Author: Stephen Doran
 * Date: 16/10/2014
 */



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Q4
{
    class Program
    {
        static void Main(string[] args)
        {
                // declare variables
            int apples;
            int oranges;
            int total;

                // assign value to variables
            Console.Write("How many apples do you have? ");
            apples = Convert.ToInt32 (Console.ReadLine());
            Console.Write("How many oranges do you have? ");
            oranges = Convert.ToInt32 (Console.ReadLine());

                // process
            total = apples + oranges;

                // output value
            Console.WriteLine("You have {0} apples and {1} oranges", apples, oranges );
            Console.WriteLine("You have a total of {0} pieces of fruit", total);

        }
    }
}

Lord DC

  • *****
  • Posts: 318
  • Omnitae - Leader of Omnipotencia
    • Steam profile
Re: Coding
« Reply #436 on: October 30, 2014, 12:41:34 PM »
vewy nice.

now its my turn

Code: [Select]
import net.minecraft.block.Block;
import net.minecraftforge.common.ForgeHooks;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
//import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid="BagaliumMod", name="Bagalium", version="0.1.0")

public class BagaliumMain {
@Instance(value = "BagliumMod")
    public static BagaliumMain instance;
public final static Block bagaliumOre = new BagaliumOre(Material.rock);
    @SidedProxy(clientSide="bagalium.eclipse.cp.ClientProxy", serverSide="forge.eclipse.bagalium.CommonProxy")
    public static CommonProxy proxy;
public static Item bagaliumIngot;
   
    public void preInit(FMLPreInitializationEvent event) {
    bagaliumIngot = new BagaliumIngot()
        .setMaxStackSize(64)
        .setUnlocalizedName("bagaliumIngot");
    }
   
    public void load(FMLInitializationEvent event) {
            proxy.registerRenderers();
            ItemStack diamondStack = new ItemStack(Items.diamond);
            ItemStack dirtStack = new ItemStack(Blocks.dirt);
            GameRegistry.addShapelessRecipe(diamondStack, dirtStack);
            MinecraftForge.setBlockHarvestLevel(bagaliumOre, "pickaxe", 3);
            GameRegistry.registerBlock(bagaliumOre, "bagaliumOre");
    }
   
    public void postInit(FMLPostInitializationEvent event) {
       
    }

Jorster

  • ****
  • Posts: 37
  • karma chameleon
Re: Coding
« Reply #437 on: October 30, 2014, 03:12:48 PM »
As a heads up, I highly recommend commenting your code so if you ever go back you know what you were trying to accomplish

atomic7732

  • Global Moderator
  • *****
  • Posts: 3848
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #438 on: October 30, 2014, 03:18:01 PM »
As a heads up, I highly recommend commenting your code so if you ever go back you know what you were trying to accomplish

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #439 on: October 30, 2014, 04:01:49 PM »
As a heads up, I highly recommend commenting your code so if you ever go back you know what you were trying to accomplish

Lord DC

  • *****
  • Posts: 318
  • Omnitae - Leader of Omnipotencia
    • Steam profile
Re: Coding
« Reply #440 on: October 31, 2014, 05:56:48 AM »
Alrighty Then!

SpyCreepers

  • *****
  • Posts: 185
  • Confederation Helvetia
Re: Coding
« Reply #441 on: October 31, 2014, 06:35:39 AM »
vewy nice.

now its my turn

Code: [Select]
import net.minecraft.block.Block;
import net.minecraftforge.common.ForgeHooks;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
//import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid="BagaliumMod", name="Bagalium", version="0.1.0")

public class BagaliumMain {
@Instance(value = "BagliumMod")
    public static BagaliumMain instance;
public final static Block bagaliumOre = new BagaliumOre(Material.rock);
    @SidedProxy(clientSide="bagalium.eclipse.cp.ClientProxy", serverSide="forge.eclipse.bagalium.CommonProxy")
    public static CommonProxy proxy;
public static Item bagaliumIngot;
   
    public void preInit(FMLPreInitializationEvent event) {
    bagaliumIngot = new BagaliumIngot()
        .setMaxStackSize(64)
        .setUnlocalizedName("bagaliumIngot");
    }
   
    public void load(FMLInitializationEvent event) {
            proxy.registerRenderers();
            ItemStack diamondStack = new ItemStack(Items.diamond);
            ItemStack dirtStack = new ItemStack(Blocks.dirt);
            GameRegistry.addShapelessRecipe(diamondStack, dirtStack);
            MinecraftForge.setBlockHarvestLevel(bagaliumOre, "pickaxe", 3);
            GameRegistry.registerBlock(bagaliumOre, "bagaliumOre");
    }
   
    public void postInit(FMLPostInitializationEvent event) {
       
    }
Minecraft Forge Mod eh?

Lord DC

  • *****
  • Posts: 318
  • Omnitae - Leader of Omnipotencia
    • Steam profile
Re: Coding
« Reply #442 on: October 31, 2014, 06:36:11 AM »
yep  ;D

Hellpotatoe

  • *****
  • Posts: 230
  • JooJ
Re: Coding
« Reply #443 on: November 01, 2014, 12:21:52 PM »
As a heads up, I highly recommend commenting your code so if you ever go back you know what you were trying to accomplish

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #444 on: November 01, 2014, 03:25:24 PM »
i recommend never commenting your code so if you ever go back you can practice how to decipher uncommented code

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #445 on: November 15, 2014, 11:16:08 PM »
smalltalk is the most confusing thing in the world


atomic7732

  • Global Moderator
  • *****
  • Posts: 3848
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #446 on: December 07, 2014, 02:08:11 AM »
Weather model chronicles:

i don't have time to write a whole chronicle so just have the output graphic results from tonight:

first try, i forgot the else statements, so anything with a value too low ends up compounding on the bottom as black

all of these graphics are of humidity percentage, darker green is more humidity
timestep for each run was 1 hour, each frame shown is 6 hours
model is a 256x128 equirectangular grid



then i figured that out and ran the model 72 hours at what i thought was "atmospheres" of pressure and uh well it does this odd thing at about 45N and 45S that spreads out... i have no idea why



then i tried hPa (cause I know pascals are just death)



no that's obviously broken

so here's something in the middle



you can see some things move and advect properly, but no time to see things speed up enough because the "corruption" takes everything over

something is obviously wrong, with the smaller pressures, not enough happens, with the higher pressures, it breaks the advection formula and stuff tries to move too fast (thereby moving too much and leaving cells empty)

fortunately, it appears that the cells that border each other actually do so according to the model, you can sometimes see things move between them and the corruption spreads out logically

unfortunately, i have no idea why the corruption occurs on every OTHER row, and only in that area originally?

in other news, we get to add to the collection of modern art :)

here's a plan: i'm going to run a day-long simulation at a minute timestep using pascals overnight, output every hour, and see how it comes out
« Last Edit: December 07, 2014, 02:15:43 AM by atomic7732 »

Gordon Freeman

  • *****
  • Posts: 480
Re: Coding
« Reply #447 on: December 07, 2014, 03:30:14 AM »
Help me understand this mess

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #448 on: December 07, 2014, 06:45:49 AM »
i don't think that will help. the very dark and very light areas in 'the corruption', suggest some sort of feedback event that creates large values. i suggest trying to figure out why that happens

switch on and off coriolis to see if that's causing anything

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #449 on: December 07, 2014, 07:47:48 AM »
so this is from a multivariable calculus course...
use the enemy's strength against him