RE: Programming Game 05-09-2014, 01:45 PM
#11
Almost two days without anyone posting what my code does?
![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)
| Programming Game filter_list | |
![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)
(05-07-2014, 08:46 PM).Shebang Wrote:looks like a (bad) parser. Assigns some data into some variables based on some HTML it read. Need more info to say exactly what it's parsingCode:For Each M As Match In Matches L = New ListViewItem L.Text = SymbolCleaner(M.Value.Split(New String() {"</a> by <b>"}, StringSplitOptions.None)(1).Split(New String() {"</b>"}, StringSplitOptions.None)(0)) L.SubItems.Add(SymbolCleaner(M.Value.Split(New String() {".html"">"}, StringSplitOptions.None)(1).Split(New String() {"</a>"}, StringSplitOptions.None)(0))) L.Tag = SymbolCleaner(M.Value.Split(New String() {"<a href="""}, StringSplitOptions.None)(1).Split(""""c)(0)) Invoke(New MethodInvoker(Sub() ListView1.Items.Add(L))) Next
Some random code from one of my projects.

<?php
echo "<html><head><title>thing</title><style>body{line-height:0;font-size:1px;}</style></head><body>";
$unsafe_raw_input = $_GET["imagelocation"];
$img = imagecreatefromstring(file_get_contents($unsafe_raw_input));
$width = imagesx($img);
$height = imagesy($img);
for($h=0;$h<$height;$h++){for($w=0;$w<=$width;$w++){$rgb = imagecolorat($img, $w, $h);$a = ($rgb >> 24) & 0xFF; $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF;$b = $rgb & 0xFF; $a = abs(($a / 127) - 1);if($w == $width){ echo '<br>'; }else{ echo '<span style="color:rgba('.$r.','.$g.','.$b.','.$a.');">#</span>';}}}?></body></html>
(05-09-2014, 02:20 PM)Reiko Wrote: looks like a (bad) parser. Assigns some data into some variables based on some HTML it read. Need more info to say exactly what it's parsing
-snip-

(05-09-2014, 03:17 PM)xornull Wrote: please stop flooding this thread with your annoying interpreted programming languages
uint[] octet = { 8, 8, 4, 4 };
uint final = 0;
for (int i = 0; i < 4; i++)
{
final += octet[i] << (8 * i);
}
Console.WriteLine(final);
Console.Read();![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)
(05-09-2014, 08:30 PM).Shebang Wrote:Code:uint[] octet = { 8, 8, 4, 4 }; uint final = 0; for (int i = 0; i < 4; i++) { final += octet[i] << (8 * i); } Console.WriteLine(final); Console.Read();

private static Map.Tile[,] tiles = new Map.Tile[15, 40];
internal void Load(string MapName) {
string[] rows = File.ReadAllLines("maps/" + MapName + "/tiles.map");
for (int i = 0; i < 15; i++) {
string[] tInfo = rows[i].Split(' ');
for (int j = 0; j < 40; j++) {
Map.AddTile(i, j, Convert.ToInt16(tInfo[j]));
}
}
}(05-10-2014, 01:08 AM)tortilla Wrote: My English really sucks, so this will be pain in the ass.
1st line declares array of your numbers, 2nd is result.
Now, in cycle, for each item in array you will add number to result.
For first passage, it adds 0 (8 << 0 = 8 * 0), for second 4096 (8 << 8 = 8 * 512), for third 1048576 (4 << 16 = 4 * 262144) and for fourth 536870912 (4 << 24 = 4 * 134217728).
All together, result should be 537923584.
I am doing this by head, so result can be incorrect, but I'm trying my best.
Now, my code. It's pretty late here, so I'm just posting part of my old project.
Code:private static Map.Tile[,] tiles = new Map.Tile[15, 40]; internal void Load(string MapName) { string[] rows = File.ReadAllLines("maps/" + MapName + "/tiles.map"); for (int i = 0; i < 15; i++) { string[] tInfo = rows[i].Split(' '); for (int j = 0; j < 40; j++) { Map.AddTile(i, j, Convert.ToInt16(tInfo[j])); } } }
Remember that a bit shift left works like so:
![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)
#!/usr/bin/perl
use warnings;
use strict;
my $regx = ( "0x0000000000400410
0x0000000000400416
0x000000000040041b"
);
print "Enter shit you want: ";
my $stream = <STDIN>;
chomp($stream);
if ($regx =~ /$stream/) {
print "Yes that exists\n";
} else {
print "That doesn't though\n";
}