►
From YouTube: NEAR Certified Demo | Episode 3.5 -- Creature Catcher
Description
This demonstration was presented by the author(s) after just 1 week of working with the NEAR platform as part of the NEAR Certified Developer program.
You can find the source code to this demo here:
https://github.com/Learn-NEAR/NCD-03--creature-catcher
---
Follow the latest from NEAR Protocol on:
Website: https://near.org/
Discord: https://near.chat/
Blog: https://near.org/blog/
Twitter: https://twitter.com/NEARProtocol
GitHub: https://github.com/near https://github.com/nearprotocol
#Blockchain #FutureIsNEAR #NEAR #nearprotocol
B
Can
you
see
my
screen
yep?
Okay,
so
just
really
quick.
It's
pretty
similar
to
the
other
examples.
So
I'll
just
show
the
the
two
functions
in
the
contract.
One
is
attempt
catch.
It
basically
just
rolls
a
random
there's,
a
50
chance
to
roll
a
successful
catch.
You
can
think
of
like
pokemon
or
something
like
that,
and
if
you
do
catch
something,
then
you
have
a
one
and
three
chance
to
catch
one
of
these
creatures
and
in
the
output
here
you
can
see
I
caught
a
scorpion.
Did
you.
B
No,
I
go
max,
and
so
here
we
go,
I
caught
a
rat
and
you
can
fail
a
catch
too.
So
yeah
there
you
go,
let
me
move
the
zoom
bar
and
then
the
other
function
is
get
all
features,
yeah
creatures,
and
it
can
basically
just
show
you
what's
in
your
account
wallet
for
instance,
but
basically
I
was
just
trying
to
represent
like
what
an
nft
could
be.
I
still.
A
B
Figure
out
how
to
deserialize
strings
into
objects.
I
was
trying
out
these
data
structures
from
scratch.
B
So
I
got
kind
of
stuck
on
randomness.
I
thought
you
could
use
math.random
in
here
because
the
you
could
actually
log
it
when
you
run
your
tests
and
you
couldn't
actually
like,
like
one
of
the
the
starter
project
lets.
B
Code
with
math.random,
but
then
it
tells
you
like
the
wasm
link,
there's
a
wasm
link
error
but
then
like.
If
I
go
on
to
another
repo
and
I
come
and
I
build
and
compile
the
contract
that
says.
Oh,
you
can't
use
floats
so
there's
a
lot
of
like
low
level
programming
involved
in
this
which
threw
me
off.
I
thought
it
would
be
a
lot
similar
so
like
typescript,
so
yeah.
That
was
a
one
of
the
surprises
is
how
much
low
level
micro
managing
of
types
and
all
that
you
have
to
do
so.
Yeah.
A
Nice
yeah
just
just
a
couple
of
quick
points
on
that,
so
you
could
check
out
the
lottery
example
for
some
random
number
generation.
Yeah
math,
not
random,
won't
work.
I
think,
because
of
its
dependency
on
like
system
time,
maybe
so
maybe
some
machine
data
for
the
randomness,
I'm
not
sure,
but
you're
operating
in
this
constrained
environment,
this
virtual
machine-
that's
running
on
chain,
so
you
won't
be
able
to
do
it.
You
need
something
like
maybe
like
this.
What
you're
doing
here
from
the
from
the
from
the
environment?
A
So
so
so
again,
there's
a
sample
called
the
lottery
sample
that
uses
a
random
number
generator
from
the
near
sdks.
That
will
help
with
that
assembly.
Script
does
support,
floats
they
added
a
team
added
it.
Maybe
a
couple
of
months
ago
the
assembly
script,
development
team,
and-
and
so
you
can
check
out
their
documentation
about
that
assemblyscript.org
and,
and
also
you
can
see
in
the
lottery
sample
in
the
learn
near
github
organization-
is
use
of
floats
in
there
as
well.
A
So,
if
you're
looking
for
some
examples,
you
want
to
kind
of
push
this
further
along.
There
are
a
couple
of
examples
there
and
I'm
happy
to
jump
on
a
call
with
you.
If
you
want
to
talk
about
some
of
those
strings,
but
basically
you
have
to
create
a
class
for
that
and
then
you
wrap
it
with
nearby
gen.
You
decorate
it
with
your
bind.
Gen
and
that'll.
A
Do
the
serialization
deserialization
for
you,
so
you
can
actually
put
that
the
type
of
that
you
know
creature
into
your
persistent
vector
and
it'll
it'll,
save
it
to
chain.
Okay,
so
you're
we're
only
at
about
three
minutes
for
the
presentation:
yeah,
exactly
daniello,
thanks
for
sharing
that
so
yeah
from
near
sdkas,
3.0.0
floats
were
supported.
So
anything
else.
You
want
to
add
here
any
other
demos.
A
B
Yeah,
I
was
just
kind
of
like
surprised
with
all
of
the
new
kinds
of
concepts
that
I'm
not
really
familiar
with
and
because
I'm
just
I'm,
I
mostly
do
javascript
development
and
yeah
there's
some
similarities,
but
quite
a
lot
of
differences.
But
this
is
a.
It
was
actually
very
quick
and
easy
to
deploy
contracts
which
I
loved
onto
the
network.
B
So
you
could
iterate
very
quickly
once
I
feel
like
once
you
get
the
syntax
down
and
understand
all
the
patterns
you
have
to
follow
that
contract
development
is
gonna,
be
like
very
seamless,
so
yeah,
that's
pretty
cool.
I.
B
Chance
to
check
out
simulation
testing-
I
just
didn't
have
time,
but
it's
all
pretty
cool
like
pretty.
A
Robust
that's
great
yeah!
Thank
you
so
much
for
for
the
demo
congrats
on
the
work.