Bebras挑战样题之七——一种模拟植物生长的语言

13 篇文章 4 订阅
12 篇文章 11 订阅

对话框回复「导航」获取精选文章

与非学堂

专注青少年信息技术教育,探讨少儿编程的教与学,交流技巧、分享资源。

一、题目(Seniors 16-18岁适用,Easy 简单

有一只小海狸喜欢种花,他基于植物的生长过程,创建了一种简单的编程语言,用于视觉设计。

在这种视觉设计编程语言中,每一步看得见的东西我们称作“视觉对象”。

一切视觉对象都可以从一个小方块a开始,经过若干次grow(), split(), die()这三种命令的执行后得到。下图展示了这几种命令的意思:

grow()会让视觉对象向特定的方向,增大到原来的两倍。

split()会让一个视觉对象(非正方形),分裂成两个大小一样的视觉对象。正方形不可分裂。

die()会让一个视觉对象消息。

上面几幅图连续表示的意思是:a从一个小方块开始,a.grow(east)向东生长,变成a的两倍长2a;

紧接着,a.grow(east)再向东生长,变成2a的两倍,即4a;

第二行中,b,c=a.split()让4a分裂成一样大小的两部分b和c,每一部分都是2a长;

c.grow(north)表示让c那一部分向北生长,变成2a长,2a高;

最后b.die()表示让b的那一部分2a消失,于是只剩下了c那一部分2a长2a高的正方形。

请问,根据上面的语法,小海狸要从左边的视觉对象,得到右边的样子,需要使用的一串命令中前四个命令应该是什么?

选项:

A. a.grow(east); a.grow(east); b,c = a.split(); b.die();
B. a.grow(north); a.grow(east); a.grow(east); b,c =a.split();
C. a.grow(east); a.grow(east); a.grow (north); a.die();
D. a.grow(east); b,c = a.split(); c.grow(north); c.grow(east);

二、原题

Plant Life

(Age group: Seniors; Difficulty: easy; Category: ALG)

The Beaver loves flowers. May be this is the reason why he has invented a simple programming language for visual design based on the idea of plant life.


Each picture starts with a square called a. A visual object can perform three operations: grow(), split() and die().


The following program explains the semantics:

Please note, that only an oblong object may execute the split()-Operation producing two shorter Objects of equal size. A square cannot be split.


Beaver wants to write a program that transforms the left image to the right image. Which could be the first four commands of this program?

Answer:

A. a.grow(east); a.grow(east); b,c = a.split(); b.die();
B. a.grow(north); a.grow(east); a.grow(east); b,c =a.split();
C. a.grow(east); a.grow(east); a.grow (north); a.die();
D. a.grow(east); b,c = a.split(); c.grow(north); c.grow(east);

It's Informatics

Computer programs, class libraries and programming languages are often based on intuitive metaphors. This makes it easier for a human programmer to understand and use them. For example the LOGO graphics system uses the idea of a moving turtle pulling a pen over the ground. In this task the Beaver adopted the idea of vegetation. Plants cannot walk from one spot to another, since they do not have legs and muscles. But plants can grow, reproduce vegetative and die. With these operations they can implement locomotion in a special way. This is an algorithmic facet of biology.

该题答案请在公众号对话框中输入「0321」获取。

三、赛事介绍

Bebras国际计算性思维挑战活动

International Challenge on Informatics and Computational Thinking

Bebras是全球性的国际信息学与计算性思维主题活动,2004年由国际计算思维联盟发起,旨在培养青少年的计算性思维(Computational Thinking)。截止2021年4月,全球已有300万学生参与。

其题目有着浅显直白、简短易懂、贴近生活、生动有趣、富于启发意义、与具体编程环境无关等特点,是青少年训练、挑战计算性思维的绝佳示范。

考试分为六个年龄级别:

I group. Pre-Primary – Grade 1 and 2 (5-8 years old)

II group. Primary - Grade 3 and 4 (8-10 years old)

III group. Benjamins – Grade 5 and 6 (10-12 years old)

IV group. Cadets – Grade 7 and 8 (12-14 years old)

V group. Juniors – Grade 9 and 10 (14-16 years old)

VI group. Seniors – Grade 11 and 12(13) (16-19 years old)

官网地址:https://www.bebras.org

相关链接:

Bebras国际计算思维挑战赛解析-学前级

Bebras国际计算思维挑战赛解析-小学低年级

Bebras国际计算思维挑战赛解析-小学高年级

Bebras国际计算思维挑战赛解析-小学高年级~给苹果树浇水

Bebras国际计算思维挑战赛解析-Cadets级-Cloud of Castoria

Bebras挑战样题之一——小海狸的洗衣房生意

Bebras挑战样题之二——小海狸建大坝

Bebras挑战样题之三——Lucia的社交网络

Bebras挑战样题之四——小海狸的密码机器

Bebras挑战样题之五——警察能抓住海盗吗?

— OVER —

与非学堂

专注青少年信息技术教育,探讨少儿编程的教与学,交流技巧、分享资源。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值