Skip to content

Commit

Permalink
Merge remote-tracking branch 'hackclub/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs256 committed Oct 17, 2023
2 parents a830bf9 + bd89c75 commit 5933101
Show file tree
Hide file tree
Showing 44 changed files with 10,775 additions and 484 deletions.
75 changes: 75 additions & 0 deletions .astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
declare module 'astro:content' {
export { z } from 'astro/zod';
export type CollectionEntry<C extends keyof typeof entryMap> =
(typeof entryMap)[C][keyof (typeof entryMap)[C]] & Render;

type BaseSchemaWithoutEffects =
| import('astro/zod').AnyZodObject
| import('astro/zod').ZodUnion<import('astro/zod').AnyZodObject[]>
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
| import('astro/zod').ZodIntersection<
import('astro/zod').AnyZodObject,
import('astro/zod').AnyZodObject
>;

type BaseSchema =
| BaseSchemaWithoutEffects
| import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;

type BaseCollectionConfig<S extends BaseSchema> = {
schema?: S;
slug?: (entry: {
id: CollectionEntry<keyof typeof entryMap>['id'];
defaultSlug: string;
collection: string;
body: string;
data: import('astro/zod').infer<S>;
}) => string | Promise<string>;
};
export function defineCollection<S extends BaseSchema>(
input: BaseCollectionConfig<S>
): BaseCollectionConfig<S>;

type EntryMapKeys = keyof typeof entryMap;
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
type ValidEntrySlug<C extends EntryMapKeys> = AllValuesOf<(typeof entryMap)[C]>['slug'];

export function getEntryBySlug<
C extends keyof typeof entryMap,
E extends ValidEntrySlug<C> | (string & {})
>(
collection: C,
// Note that this has to accept a regular string too, for SSR
entrySlug: E
): E extends ValidEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
collection: C,
filter?: (entry: CollectionEntry<C>) => entry is E
): Promise<E[]>;
export function getCollection<C extends keyof typeof entryMap>(
collection: C,
filter?: (entry: CollectionEntry<C>) => unknown
): Promise<CollectionEntry<C>[]>;

type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
Required<ContentConfig['collections'][C]>['schema']
>;

type Render = {
render(): Promise<{
Content: import('astro').MarkdownInstance<{}>['Content'];
headings: import('astro').MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
}>;
};

const entryMap: {
"translations": {
},

};

type ContentConfig = never;
}
11 changes: 11 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: yarn install && yarn run build
command: yarn run start


253 changes: 253 additions & 0 deletions games/Destroy_The_Hearts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
/*
@title Destroy the hearts!
@author zKxra
How to play:
WASD To move, J to restart level
typical sokoban game
*/

const player = "p";
const box = "b";
const goal = "g";
const wall = "w";

setLegend(
[ player, bitmap`
................
....00000000....
....020LL020....
....0LLLLLL0....
....0L0LL0L0....
....0LL00LL0....
0000000000000000
0L011111111110L0
0L011111111110L0
0L011111111110L0
0L011111111110L0
0000000000000000
....0L0..0L0....
....0L0..0L0....
....0L0..0L0....
....000..000....`],
[ box, bitmap`
................
................
........L.......
.......LL.......
.......L1.......
......LL1.......
......L11.......
......L11.......
......L11.......
......L11.......
......000.......
......0C0.......
......0C0.......
......0C0.......
......0C0.......
......000.......`],
[ goal, bitmap`
................
................
................
................
......C..C......
.....CCCCCC.....
....CCCCCCCC....
....CCCCCCCC....
.....CCCCCC.....
......CCCC......
.......CC.......
................
................
................
................
................`],
[ wall, bitmap`
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000`]
);

let level = 0;
const levels = [
map`
w....
.....
..ww.
wbww.
p.wwg`,
map`
g....ww
w..b.ww
www.w..
ww..wb.
p.g....
.bwwwgw
..wwwww`,
map`
......g
...wg..
.wwww..
....wg.
.bb....
.pb....
wwwww..`,
map`
...wwgw
.b.ww.w
.pb...w
.w.w..w
...b..w
..gwg.w`,
map`
ww..bg
...ww.
.wwww.
......
wwwww.
p.....`,
map`
......
....w.
p.w.w.
.bwgw.
..www.
..bgw.`,
map`
..........
...wb.ww..
..wwgww...
..wwww.www
..wg..gb..
..wbw.w...
....www...
...www....
.......p..`,
map`
.........
..wgwww..
..w...ww.
.w..bb.w.
.w.bw..w.
.wp.w..w.
.ww.g..w.
..wwwwg..
.........`,
map`
g......
.w..bb.
..wp...
..wgw..
...gww.
.bb.w.g
.....w.`,
map`
p...
gw..
.w..
gwwb
b.w.
..w.
..w.
b..g
....`,
map`
.gwwwwwwww
.b.g..wp.g
.bwwww....
....g..b.b
b.wwwwwb..
gwg...bg..`,
map`
..w...
..w.b.
.gwg..
wb.bw.
w....w
wpg...`,
map`
wwwwww.
www...w
gpb...w
wwwggww
wgw..b.
w..bb..
.....ww
www..ww`
];

const currentLevel = levels[level];
setMap(currentLevel);

setSolids([ player, box, wall ]);

setPushables({
["p"]: ["b", "p"],
});


// START - PLAYER MOVEMENT CONTROLS

onInput("s", () => {
getFirst(player).y += 1;
});

onInput("w", () => {
getFirst(player).y -= 1;
});

onInput("a", () => {
getFirst(player).x -= 1;
});

onInput("d", () => {
getFirst(player).x += 1;
});

// END - PLAYER MOVEMENT CONTROLS

onInput("j", () => {
const currentLevel = levels[level];
if (currentLevel !== undefined) {
clearText("");
setMap(currentLevel);
}
});

afterInput(() => {
// count the number of tiles with goals
const targetNumber = tilesWith(goal).length;

// count the number of tiles with goals and boxes
const numberCovered = tilesWith(goal, box).length;

if (numberCovered === targetNumber) {
// increase the current level number
level = level + 1;

const currentLevel = levels[level];

// make sure the level exists and if so set the map
if (currentLevel !== undefined) {
setMap(currentLevel);
} else {
addText("you win!", { y: 4, color: color`3` });
}
}
});
Loading

0 comments on commit 5933101

Please sign in to comment.