Skip to content

Instantly share code, notes, and snippets.

View krysits's full-sized avatar
💥

Kristaps Ledins krysits

💥
View GitHub Profile
@straker
straker / README.md
Last active November 18, 2024 15:38
Basic Snake HTML and JavaScript Game

Basic Snake HTML and JavaScript Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When the snake eats an apple, the score should increase by one. Use context.fillText() to display the score to the screen
@derofim
derofim / harvester.js
Created March 11, 2016 22:34
screeps.com
/*
* Module code goes here. Use 'module.exports' to export things:
* module.exports = 'a thing';
*
* You can import it from another modules like this:
* var mod = require('harvester'); // -> 'a thing'
*/
module.exports = function (creep) {
if(creep.carry.energy < creep.carryCapacity) {
module.exports = function (creep) {
if(creep.energy == 0) {
creep.moveTo(Game.spawns.Spawn1);
Game.spawns.Spawn1.transferEnergy(creep);
}
else {
var targets = creep.room.find(Game.CONSTRUCTION_SITES);
if(targets.length) {
creep.moveTo(targets[0]);
creep.build(targets[0]);