Monday, 17 August 2009
at
21:00
Posted by
Matte
Labels:
Garry's Mod
Since I took the task of making gates equivalent of E2 functions, a lot of gates have been made. And more will be made. If you have suggestions for gates, either send me PM or post a comment on this post. So far the list of gates include:
Angle: Addition Compose Decompose Direction (forward, left, up) Division Equal Identity Inequal Multiplication Negate Normalize Round Shift Components Left Shift Components Right Subtraction To String
Entity: AimDirection AimEntity AimPosition Angles Angular Velocity Apply Angular Force Apply Force Apply Offset Force Class Color Direction (forward, right, up) Entity ID Equal Health Inequal Inertia Is In Vehicle Is NPC Is On Fire Is On Ground Is Player Is Player Holding Is Under Water Is Valid Is Vehicle Is Weapon Is World Local to World Mass Mass Center Mass Center (local) Material Model Name Owner Position Radius Set Color Set Mass SteamID Time Connected Velocity Velocity (local) World to Local (angle) World to Local (vector)
Ranger: Distance Entity Hit Hit Normal Hit Position Hit World Trace
String: Equal Index Inequal Length Lowercase Substring Substring from Left Substring from Right Uppercase
Vector: Addition Angles(degree) Angles(radian) Component Derivative Component Integral Compose Cross Product D-Latch Decompose Demultiplexer Division Dot Product Equal Greater Than Greater Than or Equal To Identity Inequal Is In World Largest Latch Less Than Less Than or Equal To Magnitude Multiplexer Multiplication Negate Normalize Positive Random Round Shift Components Left Shift Components Right Smallest Subtraction To String
In two days, the school starts in Norway. I do actually look forward to it. I've gotten quite lazy this holiday. But this will also mean that I will probably not be as active on the forums the following weeks. I hope I can get myself to concentrate in the math/english classes. Even though everything we 'learn' is too easy. I do look forward to seeing my friends again, too. Even though they are not the same 'type' as me, we do have very much fun together. This brings me on, there is actually only two guys in my entire school that I know have been programming. Both of them are my friends... Anyhow, wish me luck :)
Sunday, 16 August 2009
at
23:25
Posted by
Matte
Labels:
Garry's Mod
I saw the thread about Tetris on wiremod.com a couple of days ago, and I though "why not make several old hits using wiremod?". So here you are, my attempt to make Snake, enjoy the videos.
Video #1
Video #2
And some images:
Expression 2 source code:
@name Snake
@inputs Act Sc:wirelink Ws A S D Hp Hm Reset Sp Sm St Button
@outputs CL CD Nu NDir Mode In M V N Spd H W Size Stage Pos Dir Posn:array I EatenFood CurFPos LastPos GameO
@trigger all
interval(N)
if(first()|duped())
{
Dir = 1
GameO = 0
N = 500
Size = Sc:readCell(1048572)
H = Sc:readCell(1048572)
W = Sc:readCell(1048572)
Stage = 0
CurFPos = randint(1,H*W)
Pos=H*W/2
}
if(Reset)
{
Stage = 0
reset()
}
if(!Stage)
{
Size += Hp-Hm
N = 700
Sc:writeCell(1048572,32)
Sc:writeCell(1048573,32)
In += (Sm-Sp)*50
In = clamp(In,250,1000)
Spd = (In*-1+1050)
Posn = array()
EatenFood = 0
Mode = !Button
M = 1
Pos = 0
if(!first()&!duped()&!changed(Stage)){
if(St|changed(Act)&Act){Stage = 1 }
}
V = 14
if(changed(Stage)|first()|duped()){
Sc:writeCell(1048574,1)
Sc:writeCell(2+32*V,9000)
Sc:writeCell(3+32*V,9000)
Sc:writeCell(6+32*V,990000)
Sc:writeCell(10+32*V,990000)
Sc:writeCell(15+32*V,900000)
Sc:writeCell(20+32*V,752000)
Sc:writeCell(23+32*V,752000)
Sc:writeCell(26+32*V,9000)
Sc:writeCell(27+32*V,9000)
Sc:writeCell(28+32*V,9000)
Sc:writeCell(29+32*V,9000)
Sc:writeCell(1+32+32*V,9000)
Sc:writeCell(6+32+32*V,990000)
Sc:writeCell(7+32+32*V,990000)
Sc:writeCell(10+32+32*V,990000)
Sc:writeCell(14+32+32*V,900000)
Sc:writeCell(16+32+32*V,900000)
Sc:writeCell(20+32+32*V,752000)
Sc:writeCell(22+32+32*V,752000)
Sc:writeCell(26+32+32*V,9000)
Sc:writeCell(2+64+32*V,9000)
Sc:writeCell(6+64+32*V,990000)
Sc:writeCell(8+64+32*V,990000)
Sc:writeCell(10+64+32*V,990000)
Sc:writeCell(14+64+32*V,900000)
Sc:writeCell(15+64+32*V,900000)
Sc:writeCell(16+64+32*V,900000)
Sc:writeCell(20+64+32*V,752000)
Sc:writeCell(21+64+32*V,752000)
Sc:writeCell(26+64+32*V,9000)
Sc:writeCell(27+64+32*V,9000)
Sc:writeCell(3+96+32*V,9000)
Sc:writeCell(6+96+32*V,990000)
Sc:writeCell(9+96+32*V,990000)
Sc:writeCell(10+96+32*V,990000)
Sc:writeCell(13+96+32*V,900000)
Sc:writeCell(17+96+32*V,900000)
Sc:writeCell(20+96+32*V,752000)
Sc:writeCell(22+96+32*V,752000)
Sc:writeCell(26+96+32*V,9000)
Sc:writeCell(1+128+32*V,9000)
Sc:writeCell(2+128+32*V,9000)
Sc:writeCell(6+128+32*V,990000)
Sc:writeCell(10+128+32*V,990000)
Sc:writeCell(13+128+32*V,900000)
Sc:writeCell(17+128+32*V,900000)
Sc:writeCell(20+128+32*V,752000)
Sc:writeCell(23+128+32*V,752000)
Sc:writeCell(26+128+32*V,9000)
Sc:writeCell(27+128+32*V,9000)
Sc:writeCell(28+128+32*V,9000)
Sc:writeCell(29+128+32*V,9000)
}
}
if(Stage==1){
if(Ws & Dir != H & Dir != -H)
{
Dir = -H
}
elseif(S & Dir != -H & Dir != H)
{
Dir = H
}
elseif(A & Dir != 1 & Dir != -1)
{
Dir = -1
}
elseif(D & Dir != -1 & Dir != 1)
{
Dir = 1
}
if(changed(Stage)){
Sc:writeCell(1048572,Size)
Sc:writeCell(1048573,Size)
H = Sc:readCell(1048572)
W = Sc:readCell(1048572)
CurFPos = randint(1,H*W)
N = In
}
if(clk()){
if(Sc:readCell(Pos+Dir) == 200)
{
Stage = 2
}
Sc:writeCell(1048574,1)
if(!Mode){
if(!(Pos%H) & Dir == -1)
{
Pos+=H
}
if(!((Pos+1)%H) & Dir == 1)
{
Pos -= H
}
Pos += Dir
if(Pos>H*W)
{
Pos -= H*W
}
elseif(Pos < 0)
{
Pos += H*W
}
}
else
{
if(!(Pos%H) & Dir == -1)
{
Stage = 2
}
if(!((Pos+1)%H) & Dir == 1)
{
Stage = 2
}
Pos += Dir
if(Pos>H*W)
{
Stage = 2
}
elseif(Pos < 0)
{
Stage = 2
}
}
if(Pos == CurFPos)
{
EatenFood++
Posn:pushNumber(LastPos)
CurFPos = randint(1,H*W)
}
else
{
I have usually written all my programs in C++. Now, however, I decided to try out C#. I've heard a lot of great stuff about it. The first thing I tried out, was a windows forms expression calculator. The calculator first uses the Shunting-Yard algorithm to parse the inputted expression into Reverse Polish Notation, then use several stack methods to to calculate the final result. A snippet of the source code: