This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import math | |
| def func(x, prec): | |
| if (x + 0.5) == round(x + 0.5): | |
| return x - 0.5 | |
| y = 0 | |
| for i in range(1, prec + 2): | |
| y += ((-1)**i * math.sin(2 * i * x * math.pi)) / i | |
| return x + (y / math.pi).real |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################################################################################################################################################################################################################################### | |
| ########################################################################################################################################################################################################################################################### | |
| ####...#####...............#####........#############....#######..###....######..##########...##########################.....######.....##############..####......................###................####.......##########...##......#########...###....### | |
| ###.....###.................###..........###########......#####...........####....####..##.....#######...###########..........###........####...#####....##......................................................########.............#######............## | |
| ###............# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################################################################################# | |
| ###############...........#######.........########......######....#########...### | |
| ##############..............#####..........#####.........####......#######.....## | |
| #############....#####.......####...........###....####...###..##...#####......## | |
| #############....#####...##.#####............##...######...##..###..###.......### | |
| #####....#####...####...#########............#...#######...##..###...#.......#### | |
| ####........###...###..#########..###...##..##...######....##...........##..##### | |
| ####.........#....###..########..#####..##..###...####....####..............##### | |
| ####...............#...########..#####..##..####...##....#####......#........#### | |
| ####.....###...........########..####..###..#####........####....#.....###....### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <curses.h> | |
| #define H 22 | |
| #define W 79 | |
| #define OFF 1 | |
| #define C_YOU '@' | |
| #define C_WALL '#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # # ### ## # # ## # # # # ### # # # ## # # | |
| # # # # # ### # #### ##### # | |
| #### ## # # # ## ### # ## # ## # | |
| # # # # # # # # # # | |
| # # # ###### # #### | |
| # # #### # | |
| # ## # ## # # | |
| # #### | |
| # ## # # | |
| ## # ### # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| use Curses;sub a{$V=$Z>100;$VV=$V;for$x(0..79){for$y(0..23){if($x==0or$y==0or$x==79or$y==23){$u[$x][$y]=0}else{$u[$x][$y]=r(2)}}}for$x(2..77){for$y(2..21){$c=$u[$x+1][$y]+$u[$x+1][$y+1]+$u[$x][$y+1]+$u[$x-1][$y]+$u[$x-1][$y-1]+$u[$x][$y-1]+$u[$x+1][$y-1]+$u[$x-1][$y+1];if($c>=5){$u[$x][$y]=1}elsif($c<=3){$u[$x][$y]=0}if($x==0or$y==0or$x==79or$y==23){$u[$x][$y]=0}}}$X=r(80);$Y=r(24);while(!$u[$X][$Y]){$X=r(80);$Y=r(24)}i($X,$Y);my$g;for my$x(0..79){for my$y(0..23){if($u[$x][$y]==3){$u[$x][$y]= $V?1:r(20)?1:5;$g++}else{$u[$x][$y]=0}}}a()if($g>3000 or$g<500);$B=r(80);$N=r(24);while(!$u[$B][$N]){$B=r(80);$N=r(24)}by_init :D}sub r{int rand shift}sub z{($x,$y)=(shift,shift);$u[$x][$y]<2and($u[$x][$y]>0or$u[$x][$y]==-1)}sub n{($x,$y)=(shift,shift);h($x,$y)<3}sub h{($x,$y)=(shift,shift);(($x-$X)**2+($y-$Y)**2)}sub i{my$x=shift;my$y=shift;return if$u[$x][$y]^1;$u[$x][$y]=3;i($x+1,$y);i($x-1,$y);i($x,$y+1);i($x,$y-1)}$U=100;$Z=0;initscr;noecho;&a;while($U>0){if($VV){$u[$B][$N]=5;$VV=0};clear;for my$x(0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5293121 function calls (5220589 primitive calls) in 70.422 CPU seconds | |
| Ordered by: cumulative time | |
| ncalls tottime percall cumtime percall filename:lineno(function) | |
| 1 0.005 0.005 70.422 70.422 {execfile} | |
| 1 0.001 0.001 70.416 70.416 main.py:20(<module>) | |
| 1 1.012 1.012 58.785 58.785 Game.py:111(mainLoop) | |
| 267 0.022 0.000 51.445 0.193 Game.py:1291(playerTurn) | |
| 301 0.002 0.000 50.176 0.167 Unicurses.py:2312(getch) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FOV >> calcFov | |
| FOV Total: 132.086039 ms on 23 calls. | |
| FOV L: 5.503178 ms CALL calcFov(<Game.Game instance at 0x80ab70c>) | |
| FOV A: 5.742871 ms | |
| FOV H: 6.980896 ms CALL calcFov(<Game.Game instance at 0x80ab70c>) | |
| FOV Trace starts at ./main.py:35 (<module>) | |
| FOV play.mainLoop() ./main.py:35 (<module>) | |
| FOV self.calcFov() /home/init/CutlassRLgit/CutlassRL/src/Game.py:430 (mainLoop) | |
| FOV HIST(bins: 10 step: 0.147772 ms) | |
| FOV 5.50318 ms 2|########## | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getLine(self, x1, y1, x2, y2): | |
| """Bresenham's line algorithm""" | |
| points = [] | |
| issteep = abs(y2 - y1) > abs(x2 - x1) | |
| if issteep: | |
| x1, y1 = y1, x1 | |
| x2, y2 = y2, x2 | |
| rev = False | |
| if x1 > x2: | |
| x1, x2 = x2, x1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def inLos(self, x1, y1, px, py): | |
| """Checks if point is in LOS""" | |
| x2 = px | |
| y2 = py | |
| if FAST_LOS: | |
| self.gamemap[x1][y1].changed = True | |
| issteep = abs(y2 - y1) > abs(x2 - x1) | |
| if issteep: | |
| x1, y1 = y1, x1 | |
| x2, y2 = y2, x2 |