227 Commits

Author SHA1 Message Date
trianta c8f5ed5c49 contact: fix incorrect userID for Matrix 2026-02-26 10:37:56 -06:00
trianta 83e7fc7684 core: fixup completed page 2026-02-24 09:40:41 -06:00
trianta e16f882db2 html: remove old ul styles 2026-02-24 08:45:24 -06:00
trianta 4efb3a9ade html: cleanup formatting 2026-02-24 08:40:05 -06:00
trianta de3c5f9c7b html: fixup sitemap 2026-02-24 08:30:48 -06:00
trianta 3f4c82be14 html: update quick text 2026-02-24 08:27:30 -06:00
trianta d8605ca7c3 html: add sitemap and improve contact section 2026-02-24 08:25:30 -06:00
trianta 656e850595 html: make links more apparent 2026-02-24 07:46:10 -06:00
trianta 692a5fd775 css: adjust colors again 2026-02-24 07:38:01 -06:00
trianta afb6fec687 html: remove navigation from the side 2026-02-24 07:30:58 -06:00
trianta 2000f8ceef Merge pull request 'recolor website' (#23) from recolor into main
Reviewed-on: #23
2026-02-24 07:08:48 -06:00
trianta 41c01fcf55 css: unify colors and swap bg/fg 2026-02-24 07:07:20 -06:00
trianta ea61606f68 css: visited buttons should stay same color 2026-02-24 07:02:05 -06:00
trianta e350bba979 css: match colors on buttons 2026-02-24 06:56:52 -06:00
trianta 6dc13a5c1e css: fix error in fetching font 2026-02-24 06:51:36 -06:00
trianta a20db4d400 assets: remove folder 2026-02-24 06:49:43 -06:00
trianta de6b32b21e css: source the font from nerfonts.com 2026-02-24 06:48:11 -06:00
trianta f3725f605d html: fixup icons 2026-02-24 06:36:53 -06:00
trianta 7c7cc7130e css: syntax fix 2026-02-24 06:25:09 -06:00
trianta e57719d4f6 css: how had this ever worked? 2026-02-24 06:23:46 -06:00
trianta ff6f212c83 css: potentially fixup url 2026-02-24 06:18:01 -06:00
trianta 122e341c89 css: fix font url 2026-02-24 06:14:39 -06:00
trianta 39b848b126 css: attempt to add custom font 2026-02-24 06:06:40 -06:00
trianta 0b367bba27 css: fix css syntax 2026-02-24 05:21:50 -06:00
trianta f02b11b418 css: recolor website 2026-02-24 05:20:39 -06:00
trianta d23375e28b jenkins: finally fix pipeline 2026-02-24 05:05:53 -06:00
trianta dcf2cfb35d jenkins: try with just main again 2026-02-24 04:38:15 -06:00
trianta dd0b5f63fe jenkins: theres no way this works 2026-02-24 04:35:21 -06:00
trianta eb0b249d6a jenkins: more regex attempting 2026-02-24 04:29:55 -06:00
trianta 8cbaef9afe jenkins: try regex 2026-02-24 03:58:48 -06:00
trianta 995eb69937 jenkins: try direct variable 2026-02-24 03:55:58 -06:00
trianta 193dcb2b2b jenkins: try alternative 2026-02-24 03:54:15 -06:00
trianta d42c59c317 jenkins: zzz 2026-02-24 03:46:24 -06:00
trianta 2b5b791399 jenkins: wtf 2026-02-24 03:45:05 -06:00
trianta f99105c222 jenkins: manual conditional override 2026-02-24 03:44:01 -06:00
trianta ca716de215 jenkins: losing my mind 2026-02-24 03:39:54 -06:00
trianta 7f93e1c58a jenkins: finally fix pipeline? 2026-02-24 03:35:50 -06:00
trianta 0f12fd3742 jenkins: debug prints 2026-02-24 03:33:18 -06:00
trianta 91cefa9033 jenkins: try to fix expressions 2026-02-24 03:27:16 -06:00
trianta 2f86d84e19 jenkins: change to using expressions 2026-02-24 03:25:22 -06:00
trianta dc461f6af0 jenkins: fix Jenkinsfile typo 2026-02-24 03:11:11 -06:00
trianta 8b2d332d8b jenkins: attempt to fix Jenkinsfile again 2026-02-24 03:08:29 -06:00
trianta 00804e0a30 jenkins: fixup pipeline into multibranch structure 2026-02-24 02:08:15 -06:00
trianta 4b8cac97ad jenkins: setup different pipelines for specific servers 2026-02-24 00:57:19 -06:00
trianta 8af19f442c contact: add matrix 2026-02-13 23:51:26 -06:00
trianta 62212f1c7c npm: update packages 2026-02-12 12:10:01 -06:00
trianta 8751d5aa86 css: move to new colorscheme 2026-02-02 04:20:06 -06:00
trianta 5edb887eec Merge pull request 'core: new split layout for page' (#12) from redesign into main
Reviewed-on: Trianta/trianta.dev#12
2024-12-30 00:03:44 -06:00
Trianta dea09e2f50 core: match other pages to format 2024-12-29 22:23:00 -06:00
Trianta 785266d0e4 core: decrease trianta and move content text left 2024-12-29 22:18:56 -06:00
Trianta 4d01c794c0 core: make main area flex and add changes to contact 2024-12-29 22:09:20 -06:00
Trianta 262246e8f0 core: make nav bar actually a nav bar and side by side with content 2024-12-29 21:47:33 -06:00
trianta d3f77572e9 Merge pull request 'core: redesign website' (#11) from redesign into main
Reviewed-on: Trianta/trianta.dev#11
2024-12-10 03:16:36 -06:00
Trianta 8ca2fa1dc0 core: all systems accounted for, shipping 2024-12-10 03:14:56 -06:00
Trianta 56ea11654b core: remove 80 percent because mobile 2024-12-10 03:11:25 -06:00
Trianta a732bc46d9 core: go back to row navigation 2024-12-10 03:06:04 -06:00
Trianta e9b0b6131c core: remove border radius from h2 2024-12-10 02:52:45 -06:00
Trianta edf95f7873 core: go back to reserving a max 2024-12-10 02:48:19 -06:00
Trianta 84947a2ff0 core: fix name lookin weird 2024-12-10 02:47:08 -06:00
Trianta be6e110335 core: final cleaning 2024-12-10 02:42:25 -06:00
Trianta 4c21ed0fdf core: cleanup old canvas test 2024-12-10 02:39:36 -06:00
Trianta 6b50321421 core: absolute position the navigation 2024-12-10 02:37:54 -06:00
Trianta 27f090907b core: i'm not sorry 2024-12-10 02:27:38 -06:00
Trianta 87c2b8addd core: hack heading to relative center 2024-12-10 02:18:38 -06:00
Trianta e281a8fb53 completed: force stats to keep on same line 2024-12-10 02:16:46 -06:00
Trianta c6ade68281 core: fix completed JS sourcing 2024-12-10 02:05:19 -06:00
Trianta 6057267dfa core: match navigation on all pages, and improve look 2024-12-10 02:03:57 -06:00
Trianta 9640c4089d core: override conflicts 2024-12-10 01:54:08 -06:00
Trianta f84d79db22 core: its a class, not id 2024-12-10 01:52:48 -06:00
Trianta 0b0d8e4d8d core: keep TRIANTA blue and unbordered 2024-12-10 01:51:51 -06:00
Trianta 4bcfe43827 core: redirect name to root page 2024-12-10 01:47:06 -06:00
Trianta e22751a9a1 core: only reserve large space on cards with JS canvas stuff 2024-12-10 01:45:00 -06:00
Trianta c4cd3ce557 core: add links and fix css on subpages 2024-12-10 01:37:37 -06:00
Trianta 944e698126 core: move site into split pages 2024-12-10 01:31:36 -06:00
Trianta e90c952f44 core: make card min-height 2024-12-10 01:18:36 -06:00
Trianta 476cd8fdb8 core: revert mobile responsive 2024-12-10 01:16:48 -06:00
Trianta dcb21f5125 core: enable mobile responsive 2024-12-10 01:15:18 -06:00
Trianta 14b599ce10 core: use percent instead for introLeft 2024-12-10 01:14:06 -06:00
Trianta 0cf7fc9f18 core: add borders to h2 2024-12-10 01:11:40 -06:00
Trianta 7da8c9dc67 core: remove defunct max height 2024-12-10 01:09:32 -06:00
Trianta 96e19e9cef core: further condense css 2024-12-10 01:08:55 -06:00
Trianta a33166ca0e core: condense html a bit 2024-12-10 01:04:56 -06:00
Trianta d574883963 core: actually achieve split intro 2024-12-10 01:02:34 -06:00
Trianta a751832a5c core: attempt to split intro 2024-12-10 00:54:17 -06:00
Trianta 2a5dcb5ed7 core: make navigation a class 2024-12-10 00:29:01 -06:00
Trianta e399b6ed8e core: more css cleanup and fixes 2024-12-10 00:26:52 -06:00
Trianta e1b559d226 core: cleanup css and split intro in two 2024-12-10 00:24:29 -06:00
Trianta 103cd033de core: fix missing navItem class on element 2024-12-09 23:44:18 -06:00
Trianta 1224943b47 core: decrease border thickness on navItems 2024-12-09 23:37:37 -06:00
Trianta 697c2dd500 core: make purple brighter 2024-12-09 23:36:29 -06:00
Trianta 50f1462738 core: remove border radius and change button colors 2024-12-09 23:34:12 -06:00
Trianta 158239726c core: add borders to canvas 2024-12-09 23:26:47 -06:00
Trianta ac770bc509 snake: better empty paint 2024-12-09 23:25:24 -06:00
Trianta a83b18c30d snake: don't paint on empty 2024-12-09 23:23:22 -06:00
Trianta 18881b07cc core: improve buttons 2024-12-09 23:18:39 -06:00
Trianta 6964cf3957 core: fix introduction 2024-12-09 23:16:59 -06:00
Trianta 6f2461ad5b core: test h1 idea 2024-12-09 23:11:54 -06:00
Trianta c49a4081f5 core: actually change bg 2024-12-09 23:06:07 -06:00
Trianta ccd9b38129 core: change to cyberpunk theme 2024-12-09 23:01:42 -06:00
Trianta 96d0f8ea5b core: test having name in center 2024-12-09 21:52:11 -06:00
Trianta 72a640c0a3 core: move snake stats back to right and move h3 into stats 2024-12-09 21:20:32 -06:00
Trianta 09376c4820 core: use proper canvas class 2024-12-09 21:17:44 -06:00
Trianta 8de385132a core: improve design a bit 2024-12-09 21:15:13 -06:00
Trianta 68e386fade core: add foundations of idea 2024-12-09 21:04:28 -06:00
Trianta cb669ae425 core: try another palette thats winter 2024-12-09 20:41:14 -06:00
Trianta db5681df08 core: try another palette 2024-12-09 20:31:57 -06:00
Trianta 2b29ad9671 core: change color palette to something warm 2024-12-09 19:34:39 -06:00
Trianta 0ff9ab2acf core: actually keep radius consistent 2024-12-09 16:58:40 -06:00
Trianta 18503526e1 core: keep button radius consistent 2024-12-09 16:56:27 -06:00
Trianta 7403db87d5 core: keep buttons using same text color 2024-12-09 16:55:16 -06:00
Trianta 712100e68e core: better button styling 2024-12-09 16:53:24 -06:00
Trianta 697c2a2992 core: more spacing issue cleanup 2024-12-09 16:49:59 -06:00
Trianta 0fc9a025d7 core: fix spacing issues 2024-12-09 16:44:54 -06:00
Trianta 1f4ad4ebd3 core: separate h2 background color and add spacing 2024-12-09 16:40:19 -06:00
Trianta 2008e7ba63 core: add default background color as second 2024-12-09 16:37:01 -06:00
Trianta 6cc3907ff4 core: add color comments 2024-12-09 16:35:53 -06:00
Trianta 501ef4f2b8 core: color redesign 2024-12-09 16:34:23 -06:00
Trianta e220f9c213 core: fix color order 2024-12-09 16:18:02 -06:00
Trianta b114b117e5 core: add inside class to intro 2024-12-09 16:16:45 -06:00
Trianta 278241eca6 core: add min-height 2024-12-09 16:14:30 -06:00
Trianta 13428ff28b core: cleanup div order for css 2024-12-09 16:11:21 -06:00
Trianta 536c8dd473 core: fix header order 2024-12-09 15:45:49 -06:00
Trianta 8c049aa0f7 core: rescale fonts 2024-12-09 15:42:44 -06:00
Trianta 226cfd3b75 core: resize some other width to rem 2024-12-09 15:37:45 -06:00
Trianta 55f39569f3 core: experiment with rem width 2024-12-09 15:29:08 -06:00
Trianta e05506e2ac core: clarify its a testing framework 2024-12-01 16:55:24 -06:00
Trianta d0c91dafe4 core: slight wording adjustment on h3 2024-12-01 16:46:36 -06:00
Trianta 4186f3d319 core: use rgba instead 2024-11-26 17:49:15 -06:00
Trianta 2ea10b1227 core: decrease alpha of text a bit 2024-11-26 17:46:57 -06:00
Trianta f479617192 core: update coloring a bit 2024-11-26 17:45:19 -06:00
Trianta e45f348e47 core: add more cards and information to page 2024-11-26 17:40:30 -06:00
Trianta 4442393049 core: finalize summary 2024-11-26 00:59:18 -06:00
Trianta 07a1e245f6 core: improve h3 element 2024-11-26 00:50:03 -06:00
Trianta ecda9ea210 core: add h3 summary 2024-11-26 00:47:03 -06:00
Trianta 3b666182a3 core: match 'view code' button color 2024-11-26 00:43:25 -06:00
Trianta a6ffab5181 core: remove shadows 2024-11-26 00:41:14 -06:00
Trianta fa7fc16fd2 core: remove bold font 2024-11-26 00:39:30 -06:00
Trianta b87d481826 core: too much color and border, try remove 2024-11-26 00:33:58 -06:00
Trianta d2ba977656 core: body background switched to base 2024-11-25 23:39:57 -06:00
Trianta c77b691279 core: chance nav background color 2024-11-25 23:38:48 -06:00
Trianta 526a0f1952 core: color fixup for new elements 2024-11-25 23:37:18 -06:00
Trianta 38f216c2af core: add main h1 elements for sectioning 2024-11-25 23:29:38 -06:00
Trianta 64b04cc031 nav: final cleanup fix for nav bar 2024-11-25 23:27:21 -06:00
Trianta ddfc99cd9d nav: fix float area 2024-11-25 23:22:17 -06:00
Trianta 2d9acc6df7 nav: fix name font size breaking element alignment 2024-11-25 22:54:58 -06:00
Trianta b048216da2 color: update main palette choices 2024-11-25 22:48:00 -06:00
Trianta 6a7be4362d nav: reduce padding 2024-11-25 22:42:27 -06:00
Trianta bb119f34c0 nav: remove extra container 2024-11-25 22:40:51 -06:00
Trianta a0972d19cf navbar: shorten width 2024-11-25 22:35:40 -06:00
Trianta 6068c2b4fa navbar: add shadow coloring to name 2024-11-25 22:33:22 -06:00
Trianta 901faf6d4e navbar: increase width of container 2024-11-25 19:52:32 -06:00
Trianta ed18ddfa59 navbar: color my name 2024-11-25 19:51:49 -06:00
Trianta 833cbdbe07 navbar: extra container to center items 2024-11-25 19:46:33 -06:00
Trianta f58effc904 core: remove viewport tag until mobile dev is ready to start 2024-11-25 19:43:15 -06:00
Trianta 84643c765a core: add meta viewport tag 2024-11-25 19:32:38 -06:00
Trianta f00bc01ad7 navbar: don't forget float 2024-11-25 19:07:25 -06:00
Trianta 688a31cff9 navbar: potentially fix mobile spacing 2024-11-25 19:05:28 -06:00
Trianta c0f669d419 navitem: increase border size 2024-11-25 18:51:11 -06:00
Trianta 8e839e4efd canvas: fix the canvas element usage of space 2024-11-25 18:40:22 -06:00
Trianta ad7d7e1c85 canvas: fix margin gaps 2024-11-25 18:35:59 -06:00
Trianta 794a1c23d0 navbar: set fixed to top of screen 2024-11-25 18:30:51 -06:00
Trianta 68b7d66f2d body: only do single line if it could fit 2024-11-25 18:22:49 -06:00
Trianta c856505bb4 navbar: increase font size of name 2024-11-25 18:19:22 -06:00
Trianta e330c9ab08 navbar: adjust left size styling, especially since not a button 2024-11-25 18:16:24 -06:00
Trianta c10676064d navbar: fix padding issues 2024-11-25 18:13:39 -06:00
Trianta 95bba8bde1 nav: add radius to border 2024-11-25 17:14:00 -06:00
Trianta 028ef8df27 nav: reintroduce background and add border to items 2024-11-25 17:12:30 -06:00
Trianta 9c3539ebef nav: move padding to bar instead of items 2024-11-25 17:06:50 -06:00
Trianta 97f832de22 card: match top text color 2024-11-25 15:49:19 -06:00
Trianta b4ef84bc04 nav: increase padding and make text bold 2024-11-25 15:46:29 -06:00
Trianta f3a5359a84 core: restyle catppuccin-macchiato to catppuccin-latte 2024-11-25 15:43:19 -06:00
Trianta c27b5c0ea9 core: remove background color on nav bar 2024-11-25 15:37:20 -06:00
Trianta f1346a628c core: make entire card same border radius 2024-11-25 15:34:53 -06:00
Trianta 343af77bd1 snake: make game resizable by user 2024-11-25 15:20:56 -06:00
Trianta 47fd5c7458 core: rearrange navigation and put main projects in a single row 2024-11-25 14:37:17 -06:00
trianta a754319374 Merge pull request 'core: reorganize some pieces for the future' (#10) from reorganize into main
Reviewed-on: Trianta/trianta.dev#10
2024-11-16 19:12:30 -06:00
Trianta 4aeed537d7 core: update package to v0.2.2 2024-11-16 19:01:52 -06:00
Trianta f725b4e922 core: propagate changes throughout files 2024-11-16 02:45:38 -06:00
Trianta 8252f38bb7 core: move home page css to root and rename 2024-11-16 02:38:15 -06:00
Trianta e4d9afdd68 pong: remove unused css file 2024-11-16 02:32:58 -06:00
Trianta 90c868d9e9 docker: add healthcheck 2024-11-09 04:37:30 -06:00
Trianta 452c35c1b0 snake: slightly increase speed 2024-11-09 03:18:42 -06:00
Trianta 9dea6014fe snake: remove dealt with comments 2024-11-09 02:57:12 -06:00
Trianta e37d737d3a snake: decrease speed again 2024-11-09 02:50:24 -06:00
Trianta 65c7b930e3 meta: update package.json 2024-11-09 02:38:08 -06:00
Trianta 082176d75e snake: revert speed back 2024-11-09 02:32:14 -06:00
Trianta 18673c95c4 snake: decrease speed slightly more 2024-11-09 02:25:16 -06:00
Trianta cb52bd1561 snake: slightly decrease game speed 2024-11-09 02:09:06 -06:00
trianta 0c196e690f Merge pull request 'snake: add some misc tweaks to game and page' (#8) from snake into main
Reviewed-on: Trianta/trianta.dev#8
2024-11-09 01:42:25 -06:00
Trianta 532d8a480c snake: decrease timeout to make it faster 2024-11-09 01:39:46 -06:00
Trianta 92cfd954c1 snake: display information about game in stats 2024-11-09 01:39:16 -06:00
trianta 3bbc9701c5 Merge pull request 'core: add Snake using Typescript' (#7) from snake into main
Reviewed-on: Trianta/trianta.dev#7
2024-11-09 01:26:09 -06:00
Trianta 3699ed465b snake: not adding last piece was correct, bool check was not 2024-11-09 01:23:11 -06:00
Trianta b6fe678367 snake: add snake, but ignore when counting length left 2024-11-09 01:20:05 -06:00
Trianta f59e7cf747 snake: don't add the snake itself to path 2024-11-09 01:10:24 -06:00
Trianta 33d5c491c2 snake: move extraneous logging to debug 2024-11-05 21:23:34 -06:00
Trianta de80157f2e snake: revert last commit and minor cleanups 2024-11-05 21:21:16 -06:00
Trianta 86ef363d3b snake: attempt to move path refresh to post-regen 2024-11-05 21:11:46 -06:00
Trianta 727e13a1c9 snake: minor adjustment to trimming logic 2024-11-05 20:59:27 -06:00
Trianta acc1e2b042 snake: add enums for bit states 2024-11-05 20:08:55 -06:00
Trianta 2916b4e127 snake: clear path on reset 2024-11-05 18:26:53 -06:00
Trianta 61f59208a0 snake: rename global variables 2024-11-05 18:17:44 -06:00
Trianta 7f23f4a40c snake: add stashed changes 2024-11-05 17:29:07 -06:00
Trianta 457c7a22fa jenkins: remove old container instead of just stopping if exists 2024-09-17 20:12:37 -05:00
Trianta 6667a2f79b jenkins: remove old container if exists 2024-09-17 20:11:37 -05:00
Trianta de5f4c5eaf docker: fix directories when in container 2024-09-17 20:03:26 -05:00
Trianta 2967663a82 docker: correctly set up image 2024-09-17 19:49:49 -05:00
Trianta 477ce1461e docker: build before deploy 2024-09-17 19:20:32 -05:00
Trianta 3641cfd836 docker: deploy website to nginx dir 2024-09-17 19:19:15 -05:00
Trianta bda79f51a6 jenkins: add name to container on deploy 2024-09-17 19:14:33 -05:00
Trianta 98149cae07 docker: use nginx internal port 2024-09-17 19:09:54 -05:00
Trianta e0c09898ae jenkins: detach container on deploy 2024-09-17 19:03:13 -05:00
Trianta 0e34226b43 docker: use base image with apt 2024-09-17 18:43:39 -05:00
Trianta 4f6fbc4196 docker: use npm for Typescript stuff 2024-09-17 18:40:58 -05:00
trianta b8198afd25 dockerfile: use nginx to host static site 2024-09-17 14:51:59 -05:00
trianta 08645727a8 docker: remove start script 2024-09-17 02:53:37 -05:00
trianta c317e7ab08 npm: add build script 2024-09-17 02:51:23 -05:00
trianta 4f41b247ba jenkins: fix deploy 2024-09-17 02:46:51 -05:00
trianta 10db37262c jenkins: add initial Jenkinsfile 2024-09-17 02:31:19 -05:00
trianta ceeb1f552b docker: add initial Dockerfile 2024-09-17 02:30:55 -05:00
Trianta 8e626448a2 snake: fix snake body skipping placement half the time 2024-09-01 05:05:49 -05:00
Trianta f975b0a045 snake: move core game pieces into separate functions instead of just the main loop 2024-08-28 00:29:51 -05:00
Trianta 06b7aa8c6f index: use new files after move and ts conversion 2024-08-27 23:34:13 -05:00
Trianta 53af784952 core: move files to src and convert snake to ts 2024-08-27 23:32:54 -05:00
Trianta eb6c023578 tsconfig: adjust build dir name 2024-08-27 23:29:51 -05:00
Trianta 0cbdb1f7fc core: add typescript and npm 2024-08-27 23:28:36 -05:00
Trianta 50942522fe snake: add most of snake, needs trim function to be fixed 2024-08-24 06:26:38 -05:00
20 changed files with 869 additions and 186 deletions
+11
View File
@@ -0,0 +1,11 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
# production
/build
# typescript
*.tsbuildinfo
next-env.d.ts
+26
View File
@@ -0,0 +1,26 @@
FROM nginx:latest
RUN apt-get update && apt-get install -y nodejs npm netcat-openbsd
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
WORKDIR /usr/share/nginx/html
COPY index.html .
COPY default.css .
COPY pages/ .
RUN mkdir -p /usr/share/nginx/html/public
RUN cp /app/build/* ./public
HEALTHCHECK CMD nc -z 127.0.0.1 80
EXPOSE 80
Vendored
+54
View File
@@ -0,0 +1,54 @@
pipeline {
agent none
stages {
stage('Checkout') {
agent { label 'agent-12' }
when { expression { return env.GIT_BRANCH == 'origin/main' } }
steps {
checkout scm
}
}
stage('Build') {
agent { label 'agent-12' }
when { expression { return env.GIT_BRANCH == 'origin/main' } }
steps {
script {
docker.build('trianta.dev:latest')
}
}
}
stage('Deploy') {
agent { label 'agent-12' }
when { expression { return env.GIT_BRANCH == 'origin/main' } }
steps {
sh 'docker stop trianta.dev && docker rm trianta.dev || exit 0'
sh 'docker run -d -e USER=scv -e USER_UID=1001 -e USER_GID=1001 --restart=unless-stopped -p 3466:80 --name trianta.dev trianta.dev:latest'
}
}
stage('Test Checkout') {
agent { label 'agent-13' }
when { expression { return env.GIT_BRANCH != 'origin/main' } }
steps {
sh 'echo $GIT_BRANCH'
checkout scm
}
}
stage('Test Build') {
agent { label 'agent-13' }
when { expression { return env.GIT_BRANCH != 'origin/main' } }
steps {
script {
docker.build('test.trianta.dev:latest')
}
}
}
stage('Test Deploy') {
agent { label 'agent-13' }
when { expression { return env.GIT_BRANCH != 'origin/main' } }
steps {
sh 'docker stop test.trianta.dev && docker rm test.trianta.dev || exit 0'
sh 'docker run -d -e USER=scv -e USER_UID=1001 -e USER_GID=1001 --restart=unless-stopped -p 3466:80 --name test.trianta.dev test.trianta.dev:latest'
}
}
}
}
-142
View File
@@ -1,142 +0,0 @@
body {
font-family: Arial, sans-serif;
font-size: 14px;
color: #cad3f5;
line-height: 1.5;
max-width: 1920px;
margin-inline: auto;
background: #24273a;
margin: 0px auto;
}
#navigation {
background: #181926;
display: flex;
border-bottom-left-radius: 18px;
border-bottom-right-radius: 18px;
}
.navItem {
margin: 6px;
margin-top: 0px;
padding: 8px;
line-height: 21px;
display: inline-block;
}
#top {
margin-bottom: 6px;
border-radius: 16px;
border-top-left-radius: 0px;
margin: 4px auto;
margin-top: 0px;
height: 55px;
}
#main {
/*background: #1e2030;*/
}
.cardStats {
font-size: 18px;
}
h1 {
width: 130px;
text-align: center;
display: inline-block;
font-size: 1.8rem;
margin: 0px;
padding: 8px;
border-top-left-radius: 18px;
border-top-right-radius: 18px;
}
h2 {
color: #6c6f85;
font-size: 1.8rem;
text-align: center;
margin-top: 0;
margin-bottom: 0.5rem;
}
h3 {
color: #dc8a78;
font-size: 1.3rem;
margin-top: 0;
margin-bottom: 0;
}
h4 {
color: #8c8fa1;
font-size: 1.1rem;
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin: 0px;
}
a {
text-decoration: none;
padding: 8px;
color: #8aadf4;
}
a:hover, a:active {
border-radius: 9px;
text-decoration: underline;
text-shadow: 1px 1px 1px #333;
animation: hover 3s linear infinite;
}
a.button {
margin: 14px 10%;
padding: 4px 12px;
border: 1px outset #494d64;
border-radius: 9px;
color: #8aadf4;
display: inline-block;
background-color: #363a4f;
text-decoration: none;
width: 80px;
text-align: center;
}
@keyframes hover {
0% { box-shadow: 0 0 8px 4px #24273a; }
15% { box-shadow: 0 0 8px 4px #494d64; }
50% { box-shadow: 0 0 8px 4px #b7bdf8; }
85% { box-shadow: 0 0 8px 4px #494d64; }
100% { box-shadow: 0 0 8px 4px #24273a; }
}
@keyframes card {
0% { box-shadow: 0 0 8px 4px #24273a; }
50% { box-shadow: 0 0 8px 4px #df8e1d; }
100% { box-shadow: 0 0 8px 4px #24273a; }
}
.card {
background: #363a4f;
text-align: center;
border-radius: 6px;
border-top-left-radius: 18px;
border-top-right-radius: 18px;
animation: card 3s linear infinite;
max-width: 800px;
margin: 0px auto;
}
.cardTop {
background: #1e2030;
border-top-left-radius: 18px;
border-top-right-radius: 18px;
}
#pong {
margin: 6px;
border-radius: 9px;
background: #494d64;
}
-23
View File
@@ -1,23 +0,0 @@
html, body {
height: 100%;
margin: 0;
}
body {
background: black;
display: flex;
align-items: center;
justify-content: center;
}
.button {
background: blue;
color: white;
padding: 15px 20px;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
cursor: pointer;
position: relative;
}
+151
View File
@@ -0,0 +1,151 @@
/*
* text / border: #8c7862
* foreground: #fbf1c7
* background: #89bea6
*/
body {
font-family: "Departure Mono", sans-serif;
font-optical-sizing: auto;
font-weight: 400;
color: #8c7862;
background: #89bea6;
line-height: 1.5;
margin-inline: auto;
margin: 0 auto;
}
.inside {
max-width: 60rem;
margin: 2rem auto;
padding: 2rem 1.5rem;
background: #fbf1c7;
border: 4px solid #8c7862;
border-radius: 14px;
}
nav {
padding: 1rem;
text-align: center;
width: 6rem;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
}
.gap {
width: 4rem;
}
.content {
width: 48rem;
text-align: left;
}
@media screen and (max-width: 600px) {
.column {
width: 100%;
}
.gap {
visibility: hidden;
}
}
.trianta {
font-size: 2.5rem !important;
padding: 0px;
}
.canvas {
margin: auto;
display: inline-block;
width: 60rem;
vertical-align: bottom;
}
.stats {
font-size: 18px;
display: inline-block;
vertical-align: middle;
}
h1 {
max-width: 650px;
text-align: left;
padding: 8px 1.5rem;
}
h2 {
border: solid 2px #8c7862;
margin: auto;
padding: 8px;
text-align: center;
width: 400px;
}
h3 {
text-align: center;
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin: 1rem;
}
a {
max-width: 8rem;
padding: 8px;
text-decoration: none;
width: 100%;
color: #8c7862;
}
a:hover, a:active {
text-decoration: underline;
}
a.button {
margin: 14px 10%;
padding: 4px 12px;
display: inline-block;
text-decoration: none;
width: 80px;
text-align: center;
}
a:visited {
color: #8c7862;
}
@keyframes hover {
0% { box-shadow: 0 0 8px 4px #eff1f5; }
15% { box-shadow: 0 0 8px 4px #bcc0cc; }
50% { box-shadow: 0 0 8px 4px #7287fd; }
85% { box-shadow: 0 0 8px 4px #bcc0cc; }
100% { box-shadow: 0 0 8px 4px #eff1f5; }
}
@keyframes card {
0% { box-shadow: 0 0 8px 4px #eff1f5; }
50% { box-shadow: 0 0 8px 4px #fe640b; }
100% { box-shadow: 0 0 8px 4px #eff1f5; }
}
.card {
text-align: center;
margin: 0px auto;
margin-top: 25px;
margin-bottom: 25px;
border: 2px solid #8c7862;
padding: 10px 0px;
}
#pong {
margin: 6px;
background: #61937c;
}
+34 -17
View File
@@ -3,28 +3,45 @@
<head>
<meta charset="utf-8"/>
<title>Trianta</title>
<link rel="stylesheet" href="css/home.css" />
<link rel="stylesheet" href="/default.css">
<link rel="stylesheet" href="https://www.nerdfonts.com/assets/css/webfont.css">
</head>
<body>
<div id="navigation" style="margin-bottom: 30px;">
<a class="navItem" href="https://www.github.com/trimutex">GitHub</a>
<a class="navItem" href="https://lab.trianta.dev/Trianta">Projects</a>
<p class="navItem" style="text-align: right; flex-grow: 1;">Trianta</p>
<div class="inside">
<div>
<a href="/" class="trianta">[ TRIANTA ]</a>
<div class="column">
<a href="https://www.github.com/trimutex" alt="GitHub">[ <i class="nf nf-dev-github"></i> ]</a>
<a href="https://lab.trianta.dev/Trianta" alt="Personal Projects">[ <i class="nf nf-linux-gitea"></i> ]</a>
<a href="/completed" alt="Completed">[ <i class="nf nf-dev-javascript"></i> ]</a>
<a href="/current" alt="Current">[ <i class="nf nf-dev-git_branch"></i> ]</a>
<a href="/other" alt="Other">[ <i class="nf nf-dev-git_merge"></i> ]</a>
<a href="/contact" alt="Contact">[ <i class="nf nf-oct-feed_person"></i> ]</a>
</div>
<div id="main">
</div>
<p>Progress Not Perfection</p>
<h2> Welcome! </h2>
<div class="card">
<h2 class="cardTop">Pong</h2>
<canvas width="750" height="585" id="pong"></canvas>
<script src="js/pong.js"></script>
<div id="gameover" hidden="true">
<h1>Game Over</h1>
<h3>What is this place?</h3>
<p>My name is Greg, also known as Trianta in online spaces.
This is my personal home page, hosted on my own server hardware.
All of my code is 100% self-produced with no AI (LLM) code.
Enjoy a look around! </p>
<p>If you want to contact me, see my <a href="/contact">[ contact ]</a> page.</p>
</div>
<div id="restart" hidden="true">
<button class="button" type="button" onclick = "restartGame()">Restart Game</a>
</div>
<p class="cardStats">Left Paddle Height: <span id="leftPaddle"></span></p>
<p class="cardStats">Right Paddle Height: <span id="rightPaddle"></span></p>
<a class="navItem" href="https://lab.trianta.dev/Trianta/trianta.dev/src/branch/main/js/pong.js">View Code</a>
<div class="card">
<h3>Sitemap</h3>
<a href="/completed">[ Completed JavaScript Projects ]</a> .
<a href="/current">[ Current Personal Projects ]</a>
<br>
<a href="/other">[ Other Projects and Contributions ]</a> .
<a href="/contact">[ Contact Methods ]</a> .
<a href="https://lab.trianta.dev/Trianta">[ Gitea ]</a>
<br>
<a href="https://clips.trianta.dev">[ Gaming Clips ]</a> .
<a href="https://draw.trianta.dev">[ Excalidraw ]</a> .
<a href="https://pdf.trianta.dev">[ Stirling-pdf ]</a>
<p>If you want to contact me, see my <a href="/contact">[ contact ]</a> page.</p>
</div>
</div>
</body>
+29
View File
@@ -0,0 +1,29 @@
{
"name": "trianta.dev",
"version": "0.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "trianta.dev",
"version": "0.2.2",
"license": "MIT",
"dependencies": {
"typescript": "^5.5.4"
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"name": "trianta.dev",
"version": "0.2.2",
"description": "My personal website",
"main": "index.html",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://lab.trianta.dev/Trianta/trianta.dev.git"
},
"author": "trianta",
"license": "MIT",
"dependencies": {
"typescript": "^5.5.4"
}
}
+1
View File
@@ -0,0 +1 @@
DirectoryIndex index.html
+62
View File
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Trianta</title>
<link rel="stylesheet" href="/default.css" />
<link rel="stylesheet" href="https://www.nerdfonts.com/assets/css/webfont.css">
</head>
<body>
<div class="inside">
<div>
<a href="/" class="trianta">[ TRIANTA ]</a>
<div class="column">
<a href="https://www.github.com/trimutex" alt="GitHub">[ <i class="nf nf-dev-github"></i> ]</a>
<a href="https://lab.trianta.dev/Trianta" alt="Personal Projects">[ <i class="nf nf-linux-gitea"></i> ]</a>
<a href="/completed" alt="Completed">[ <i class="nf nf-dev-javascript"></i> ]</a>
<a href="/current" alt="Current">[ <i class="nf nf-dev-git_branch"></i> ]</a>
<a href="/other" alt="Other">[ <i class="nf nf-dev-git_merge"></i> ]</a>
<a href="/contact" alt="Contact">[ <i class="nf nf-oct-feed_person"></i> ]</a>
</div>
</div>
<p>Progress Not Perfection</p>
<h2>Completed JavaScript Projects</h2>
<div class="card">
<div class="canvas">
<canvas width="750" height="585" id="pong"></canvas>
<script src="/public/pong.js"></script>
<div id="gameover" hidden="true">
<h3>Game Over</h3>
</div>
<div id="restart" hidden="true">
<button class="button" type="button" onclick = "restartGame()">Restart Game</a>
</div>
</div>
<div class="stats">
<p style="font-size: 22px;">Pong</p>
<p>Left Paddle Height: <span id="leftPaddle"></span></p>
<p>Right Paddle Height: <span id="rightPaddle"></span></p>
<a href="https://lab.trianta.dev/Trianta/trianta.dev/src/branch/main/src/pong.js">[ View Code ]</a>
</div>
</div>
<div class="card">
<div class="canvas">
<canvas width="625" height="375" id="snake"></canvas>
<script src="/public/snake.js"></script>
</div>
<div class="stats">
<p style="font-size: 22px;">Snake</p>
<p>
Adjust game size -- Width:
<input id="snakeWidth" type="number" min="2" max="31" value="31">
Height:
<input id="snakeHeight" type="number" min="2" max="24" value="24">
</p>
<p>Snake Head Location: <span id="snakeHead"></span></p>
<p>Food Location: <span id="snakeFood"></span></p>
<a href="https://lab.trianta.dev/Trianta/trianta.dev/src/branch/main/src/snake.ts">[ View Code ]</a>
</div>
</div>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
DirectoryIndex index.html
+57
View File
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Trianta</title>
<link rel="stylesheet" href="/default.css" />
<link rel="stylesheet" href="https://www.nerdfonts.com/assets/css/webfont.css">
</head>
<body>
<div class="inside">
<div>
<a href="/" class="trianta">[ TRIANTA ]</a>
<div class="column">
<a href="https://www.github.com/trimutex" alt="GitHub">[ <i class="nf nf-dev-github"></i> ]</a>
<a href="https://lab.trianta.dev/Trianta" alt="Personal Projects">[ <i class="nf nf-linux-gitea"></i> ]</a>
<a href="/completed" alt="Completed">[ <i class="nf nf-dev-javascript"></i> ]</a>
<a href="/current" alt="Current">[ <i class="nf nf-dev-git_branch"></i> ]</a>
<a href="/other" alt="Other">[ <i class="nf nf-dev-git_merge"></i> ]</a>
<a href="/contact" alt="Contact">[ <i class="nf nf-oct-feed_person"></i> ]</a>
</div>
</div>
<p>Progress Not Perfection</p>
<div class="card">
<h3>Contact Methods</h3>
<p>E-mail: gregcraw2001@gmail.com</p>
<p>Matrix: @trianta:matrix.trianta.dev</p>
<p>Discord: @trianta (depreciated)</p>
</div>
<div class="card">
<h3>How do I use Matrix?</h3>
<p>Here's my notes of how to access it:</p>
<h3>Picking a Client</h3>
<p>A client is needed to access the server. As such, here's some listed popular clients:</p>
<p><a href="https://cinny.in">[ Cinny (Personal Choice) ]</a></p>
<p><a href="https://app.element.io">[ Element ]</a></p>
<p><a href="https://commet.chat">[ Commet ]</a></p>
<p><a href="https://matrix.org/ecosystem/clients">[ Clients Listed From Official Site ]</a></p>
<h3>Account Creation</h3>
<p>Once you open a client, you will create an account. Here's info about the details:</p>
<p>+ --- Homeserver --- +</p>
<p>This is which server your account resides</p>
<p>Mine is `matrix.trianta.dev`, other default options exist</p>
<p>+ --- Username / Password --- +</p>
<p>The login details for accessing the account on the above server</p>
<p>+ --- Registration Token --- +</p>
<p>A password for account creation on a server if enabled</p>
<p>The default options normally don't have this</p>
<p>If you want the token for my server, contact me another way first!</p>
<h3>Welcome In!</h3>
<p>Mess around with it, `Add Space` (the plus icon) is the equivalent of creating a server in Discord.</p>
<p>Accounts are able to connect to spaces that exist in other servers if the server enables it (known as federation).</p>
<p>My Contact: `@trianta:matrix.trianta.dev`</p>
<p>My Space Invite: <a href="https://matrix.to/#/#core:matrix.trianta.dev">#core:matrix.trianta.dev</a></p>
</div>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
DirectoryIndex index.html
+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Trianta</title>
<link rel="stylesheet" href="/default.css" />
<link rel="stylesheet" href="https://www.nerdfonts.com/assets/css/webfont.css">
</head>
<body>
<div class="inside">
<div>
<a href="/" class="trianta">[ TRIANTA ]</a>
<div class="column">
<a href="https://www.github.com/trimutex" alt="GitHub">[ <i class="nf nf-dev-github"></i> ]</a>
<a href="https://lab.trianta.dev/Trianta" alt="Personal Projects">[ <i class="nf nf-linux-gitea"></i> ]</a>
<a href="/completed" alt="Completed">[ <i class="nf nf-dev-javascript"></i> ]</a>
<a href="/current" alt="Current">[ <i class="nf nf-dev-git_branch"></i> ]</a>
<a href="/other" alt="Other">[ <i class="nf nf-dev-git_merge"></i> ]</a>
<a href="/contact" alt="Contact">[ <i class="nf nf-oct-feed_person"></i> ]</a>
</div>
</div>
<p>Progress Not Perfection</p>
<h2>Active Personal Projects</h2>
<div class="card">
<h3>Wrench</h3>
<p>Description: A simple application to handle all of your Linux configuration needs.</p>
<p>Language: C++26</p>
<p>Tools: CMake</p>
<p>Frameworks: Qt6</p>
<a href="https://github.com/Trimutex/wrench">[ View Repository ]</a>
</div>
<div class="card">
<h3>Synopsis</h3>
<p>Description: A markdown repository containing details and changes of servers I maintain.</p>
<a href="https://github.com/Trimutex/synopsis">[ View Repository ]</a>
</div>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
DirectoryIndex index.html
+69
View File
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Trianta</title>
<link rel="stylesheet" href="/default.css" />
<link rel="stylesheet" href="https://www.nerdfonts.com/assets/css/webfont.css">
</head>
<body>
<div class="inside">
<div>
<a href="/" class="trianta">[ TRIANTA ]</a>
<div class="column">
<a href="https://www.github.com/trimutex" alt="GitHub">[ <i class="nf nf-dev-github"></i> ]</a>
<a href="https://lab.trianta.dev/Trianta" alt="Personal Projects">[ <i class="nf nf-linux-gitea"></i> ]</a>
<a href="/completed" alt="Completed">[ <i class="nf nf-dev-javascript"></i> ]</a>
<a href="/current" alt="Current">[ <i class="nf nf-dev-git_branch"></i> ]</a>
<a href="/other" alt="Other">[ <i class="nf nf-dev-git_merge"></i> ]</a>
<a href="/contact" alt="Contact">[ <i class="nf nf-oct-feed_person"></i> ]</a>
</div>
</div>
<p>Progress Not Perfection</p>
<h2>Other Projects and Contributions</h2>
<div class="card">
<h3>Hyprland</h3>
<p>Description: An independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks. </p>
<a href="https://github.com/hyprwm/Hyprland">[ View Repository ]</a>
<p>Language: C++26</p>
<p>Tools: CMake</p>
<p>and various libraries.</p>
<p>Contributions (newest first)</p>
<a href="https://github.com/hyprwm/Hyprland/pull/8323">[ hyprwm/Hyprland#8323 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/8044">[ hyprwm/Hyprland#8044 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/7959">[ hyprwm/Hyprland#7959 ]</a>
<br>
<a href="https://github.com/hyprwm/Hyprland/pull/7755">[ hyprwm/Hyprland#7755 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/7683">[ hyprwm/Hyprland#7683 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/7633">[ hyprwm/Hyprland#7633 ]</a>
<br>
<a href="https://github.com/hyprwm/Hyprland/pull/7575">[ hyprwm/Hyprland#7575 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/7458">[ hyprwm/Hyprland#7458 ]</a>
<a href="https://github.com/hyprwm/Hyprland/pull/6652">[ hyprwm/Hyprland#6652 ]</a>
</div>
<div class="card">
<h3>Proxy</h3>
<p>Description: A program written in C++ to act as a proxy for another server.</p>
<a href="https://lab.trianta.dev/Trianta/proxy-network">[ View Repository ]</a>
<p>Language: C++11</p>
<p>Tools: CMake</p>
<p>Testing Frameworks: <a href="https://github.com/ThrowTheSwitch/Unity">[ Unity Test (ThrowTheSwitch) ]</a></p>
</div>
<div class="card">
<h3>Cloudcare</h3>
<p>Description: A sample repository that uses downloaded .bed files to train a model on DNA using PyTorch.</p>
<a href="https://github.com/Trimutex/cloudcare">[ View Repository ]</a>
<p>Languages: Python, Bash</p>
<p>Libraries: PyTorch</p>
<p>Tools: Conda</p>
</div>
<div class="card">
<h3>N-Queens</h3>
<p>Description: The N-Queens problem recreated in C++ which gets solved using a Genetic Algorithm.</p>
<a href="https://lab.trianta.dev/Trianta/n-queens">[ View Repository ]</a>
<p>Language: C++11</p>
<p>Tools: CMake</p>
</div>
</div>
</body>
</html>
View File
+302
View File
@@ -0,0 +1,302 @@
enum BoardState {
SNAKE = 0,
FOOD = 1,
CHECKED = 2 // For search algorithms
}
// Bit functions for ease
function isBitSet(value: number, bit: number): boolean {
return ((value >> bit) % 2 != 0)
}
function bitSet(value: number, bit: number): number {
return value | 1 << bit;
}
function bitClear(value: number, bit: number): number {
return value & ~(1 << bit);
}
class Point {
x: number;
y: number;
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
copy(other: Point) {
this.x = other.x;
this.y = other.y;
}
add(other: Point) {
var result = new Point;
result.x = this.x + other.x;
result.y = this.y + other.y;
return result;
}
subtract(other: Point) {
var result = new Point;
result.x = this.x - other.x;
result.y = this.y - other.y;
return result;
}
}
class SnakeCore {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
grid: number;
timeout: number;
width: number;
height: number;
board: number[][];
body: Point[];
food: Point;
gameover: boolean;
foodAte: boolean;
constructor() {
this.canvas = document.getElementById('snake') as HTMLCanvasElement;
this.context = this.canvas.getContext('2d') as CanvasRenderingContext2D;
this.grid = 25; // size of grid squares
this.timeout = 32; // speed in ms
this.width = 25;
this.height = 15;
this.board = [];
for (let i = 0; i < this.height; i++)
this.board.push(new Array(this.width));
this.body = [];
this.food = new Point();
this.gameover = false;
this.foodAte = true;
this.body.push(new Point(12, 8));
this.board[8][12] = 1;
}
get head(): Point {
return this.body[this.body.length - 1];
}
reset() {
console.debug("[TRACE] Reset was triggered");
this.gameover = false;
this.foodAte = true;
for (let i = 0; i < this.height; i++) {
for (let j = 0; j < this.width; j++) {
this.board[i][j] = 0;
}
}
while (this.body.length > 0)
this.body.pop();
while (g_snakebot.path.length > 0)
g_snakebot.path.pop();
this.startRandom();
this.foodRegen();
this.draw();
}
startRandom() {
this.body.push(new Point(Math.floor(Math.random() * this.width), Math.floor(Math.random() * this.height)));
}
foodRegen() {
if (!this.foodAte)
return;
console.debug("[TRACE] Food reset was triggered");
this.foodAte = false;
while (true) {
let tmp = new Point(Math.floor(Math.random() * this.width), Math.floor(Math.random() * this.height));
if (isBitSet(this.board[tmp.y][tmp.x], BoardState.SNAKE))
continue;
this.board[tmp.y][tmp.x] = bitSet(this.board[tmp.y][tmp.x], BoardState.FOOD);
this.food.copy(tmp);
return;
}
}
// Simulate game logic
simulate() {
// Move snake
let next: Point = new Point;
next.copy(g_snakebot.nextMove());
if (next.x < 0 || next.x > g_snake.width || next.y < 0 || next.y > g_snake.height) {
g_snake.gameover = true;
return;
}
if (isBitSet(g_snake.board[next.y][next.x], BoardState.SNAKE) && (g_snake.body.length > 1)) {
g_snake.gameover = true; // Game should end (Snake touching snake)
return;
}
g_snake.board[next.y][next.x] = bitSet(g_snake.board[next.y][next.x], BoardState.SNAKE);
g_snake.body.push(next);
if (!isBitSet(g_snake.board[next.y][next.x], BoardState.FOOD)) {
let old: Point = g_snake.body.shift() as Point;
g_snake.board[old.y][old.x] = bitClear(g_snake.board[old.y][old.x], BoardState.SNAKE);
} else {
g_snake.board[next.y][next.x] = bitClear(g_snake.board[next.y][next.x], BoardState.FOOD);
g_snake.foodAte = true;
while (g_snakebot.path.length > 0)
g_snakebot.path.pop();
}
}
// Draw game to canvas
draw() {
// Clear the screen
g_snake.context.clearRect(0, 0, g_snake.canvas.width, g_snake.canvas.height);
// Draw game
for (let i = 0; i < g_snake.height; i++) {
for (let j = 0; j < g_snake.width; j++) {
if (isBitSet(g_snake.board[i][j], BoardState.SNAKE))
g_snake.context.fillStyle = "green";
else if (isBitSet(g_snake.board[i][j], BoardState.FOOD))
g_snake.context.fillStyle = "red";
else
continue;
g_snake.context.fillRect(j * g_snake.grid, i * g_snake.grid, g_snake.grid, g_snake.grid);
}
}
}
// Update text on page to match game
updatePageText() {
document.getElementById("snakeHead").innerHTML = "x: " + this.body[this.body.length - 1].x + " y: " + this.body[this.body.length - 1].y;
document.getElementById("snakeFood").innerHTML = "x: " + this.food.x + " y: " + this.food.y ;
}
// Update width and height from page to match game
getPageNumbers() {
let specifiedWidth = parseInt((document.getElementById("snakeWidth") as HTMLInputElement).value);
let specifiedHeight = parseInt((document.getElementById("snakeHeight") as HTMLInputElement).value);
if (this.width == specifiedWidth && this.height == specifiedHeight)
return false;
this.width = specifiedWidth;
this.height = specifiedHeight;
while (this.height > this.board.length)
this.board.push(new Array(this.width));
this.canvas.setAttribute("width", String(specifiedWidth * this.grid));
this.canvas.setAttribute("height", String(specifiedHeight * this.grid));
return true;
}
}
class Bot {
pathUntrimmed: Point[];
path: Point[];
constructor() {
this.pathUntrimmed = [];
this.path = [];
}
bfs() {
var search: Point[] = [g_snake.head];
while (search.length !== 0) {
let current: Point = search.shift() as Point;
if (isBitSet(g_snake.board[current.y][current.x], BoardState.CHECKED))
continue;
this.pathUntrimmed.push(current);
let locals: Point[] = new Array(4);
for (var i = 0; i < 4; i++) {
locals[i] = new Point;
locals[i].copy(current);
}
locals[0].y += 1;
locals[1].x += 1;
locals[2].y -= 1;
locals[3].x -= 1;
for (const local of locals) {
if (local.x < 0 || local.x > g_snake.width - 1 || local.y < 0 || local.y > g_snake.height - 1)
continue;
let value = g_snake.board[local.y][local.x];
if (isBitSet(value, BoardState.FOOD)) {
this.pathUntrimmed.push(local);
return;
}
if (isBitSet(value, BoardState.CHECKED) || isBitSet(value, BoardState.SNAKE))
continue;
search.push(local);
}
g_snake.board[current.y][current.x] = bitSet(g_snake.board[current.y][current.x], BoardState.CHECKED);
}
}
trim() {
let reachedSnake = false;
this.path.push(this.pathUntrimmed.pop() as Point); // Push food location
while (this.pathUntrimmed.length !== 0) {
let location: Point = this.pathUntrimmed.pop();
if (reachedSnake)
continue;
if (isBitSet(g_snake.board[location.y][location.x], BoardState.SNAKE)) {
reachedSnake = true;
continue;
}
var delta = new Point;
delta = location.subtract(this.path[this.path.length - 1]);
if ((Math.abs(delta.x) + Math.abs(delta.y)) === 1)
this.path.push(location);
}
}
unvisit() {
for (let i = 0; i < g_snake.height; i++) {
for (let j = 0; j < g_snake.width; j++) {
g_snake.board[i][j] = bitClear(g_snake.board[i][j], BoardState.CHECKED);
}
}
}
nextMove() {
// Get new path to food
if (this.path.length === 0)
this.pathRefresh();
var next: Point = new Point;
next.copy(this.path.pop());
var delta = new Point;
delta = next.subtract(g_snake.head);
if (delta.x > 1)
console.log("[ERR] delta.x > 1");
else if (delta.x < -1)
console.log("[ERR] delta.x < 1");
if (delta.y > 1)
console.log("[ERR] delta.y > 1");
else if (delta.y < -1)
console.log("[ERR] delta.y < 1");
return next;
}
pathRefresh() {
this.bfs();
this.trim();
this.unvisit();
}
}
const g_snake: SnakeCore = new SnakeCore();
const g_snakebot: Bot = new Bot();
// game loop
function snakeloop() {
// Reset of needed
if (g_snake.gameover || g_snake.getPageNumbers())
g_snake.reset();
// Simulate movement of snake
g_snake.simulate();
// Regenerate food if needed
g_snake.foodRegen();
g_snake.draw();
g_snake.updatePageText();
}
// start the game
setInterval(snakeloop, g_snake.timeout);
+8
View File
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"outDir": "./build",
"allowJs": true,
"target": "es5"
},
"include": ["./src/**/*"]
}