Skip to content

Instantly share code, notes, and snippets.

View starfys's full-sized avatar
🤖
foo

Starfys starfys

🤖
foo
View GitHub Profile
@starfys
starfys / bf2c.py
Created May 16, 2016 04:12
Brainfuck to C compiler, Takes Brainfuck at stdin, prints c to stdout
#!/usr/bin/env python3
import sys
print("//This converts brainfuck in stdin to c on stdout")
brainfuck_program = sys.stdin.read().rstrip()
#Print the starting code
print("#include <stdio.h>")
print("int main(){")
@starfys
starfys / many_dimensions.c
Created April 27, 2016 20:06
A test of C's dimensional skills
#include <stdio.h>
int main()
{
int a[1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1];
a[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0] = 88889999;
printf("%d\n",a[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]);
return 0;
using UnityEngine;
using UnityEngine.Networking;
public class TankMovement : NetworkBehaviour
{
public int m_PlayerNumber = 1; // Used to identify which tank belongs to which player. This is set by this tank's manager.
public int m_LocalID = 1;
public float m_Speed = 12f; // How fast the tank moves forward and back.
public float m_TurnSpeed = 180f; // How fast the tank turns in degrees per second.
public float m_PitchRange = 0.2f; // The amount by which the pitch of the engine noises can vary.
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
public class TankHealth : NetworkBehaviour
{
public float m_StartingHealth = 100f; // The amount of health each tank starts with.
public Slider m_Slider; // The slider to represent how much health the tank currently has.
public Image m_FillImage; // The image component of the slider.
public Color m_FullHealthColor = Color.green; // The color the health bar will be when on full health.
using UnityEngine;
using System.Collections;
public class HealthBar : MonoBehaviour
{
GUIStyle healthStyle;
GUIStyle backStyle;
Combat combat;
void Awake()