DPST1091 24T2 - Programming Fundamentals! 1 - CS FlowersR

部署运行你感兴趣的模型镜像

Java Python DPST1091 24T2 - Programming Fundamentals!

Assignment 1 - CS Flowers

Overview

CS Flower is an action packed turn-based game where you the player, move across the Physics Lawn and cut down all the flowers. However, it's not as easy as it sounds. While you snip away at each of them one by one, the flowers wake up, evolve and retaliate against you. So it is up to you to figure out the best angle of attack against these formidable foes!

Assignment Structure

This assignment will test your ability to create, use and manipulate 2D arrays and structs to solve problems. This will be done through the in-game map that has been implemented as a 2D array of tiles. Each of these tiles are represented by a struct tile , which is outlined below:

struct tile

Purpose:

To store information about the tiles of the map.

Contains:

enum tile_type type

The type of the map tile.

All tile types are found in the enum tile_type definition.

struct flower flower

Represents the enemy flower at this location (if one exists).

struct flower

Purpose:

To store information about a particular enemy flower.

Contains:

enum flower_state state

Represents the state that the enemy flower is in.

The provided enums are quite extensive. Definitions of each are provided below:

enum tile_type

Purpose:

Represent the possible types of a tile.

Possible values:

EMPTY

Represents an empty space.

BUSH

A wall that blocks the movement of the player and enemies.

BRANCH

An interactable object that will create sound when stepped on by the player.

DANGER

A tile that indicates a root will erupt soon.

ROOT

A wall that the enemy can place down.

POLLEN

A tile that kills the player, which the enemy can place down.

SEEDLING

A baby flower that can grow.

FLOWER

An enemy flower.

enum flower_state

Purpose:

Represents the state that the flower is in.

Possible values:

NONE

DORMANT

DISTURBED

AWAKENED

ANXIOUS

ENERGETIC

Game Structure

There are two main phases to the overall game:

Setup Phase

This phase takes care of the initial setup of the map and the game. The setup is as follows:

1. The player is spawned onto the map

2. Various tiles known as foliage are placed onto the map

3. The flowers which act as enemies are spawned onto the DPST1091 24T2 - Programming Fundamentals! Assignment 1 - CS FlowersR map

Gameplay Phase

This phase handles the gameplay, which is split into turns. On each turn, the player, flowers, and the game will manipulate the map. A turn is comprised of the following steps:

1. The Player Step

The player is allowed to make an action like moving around or cutting a flower

2. The Upkeep Step

The upkeep is an intermediary step where you update parts of the map and its tiles

3. The Flower Step

The flowers are all allowed to make an action like attacking or defending against the player

4. The End Step

The final step at the end of a turn in which you determine if the game should end or continue

As you progress through each stage of this assignment, you will be implementing parts of each step.

How To Get Started

In order to get started with CS Flowers, do the following:

1. Create a new folder for your assignment work and move into it.

$ mkdir ass1

$ cd ass1

2. Download the starter code (cs_flowers.c) here or, copy this code to your CSE account using the following command

$ 1091 fetch_activity cs_flowers

1. Run 1091 autotest cs_flowers to make sure you have correctly downloaded the file.

$ 1091 autotest cs_flowers

NOTE:

When running the autotest on the starter code (with no modifications), it is expected to see failed tests. You can use [ctrl + c] to exit the autotests.

1. Read through Stage 1.

2. Spend a few minutes playing with the reference solution -- get a feel for how the assignment works.

$ 1091 cs_flowers

3. Think about your solution, draw some diagrams, write some pseudocode to help you get started.

HINT:

You might also find it helpful to draw diagrams and write pseudocode in later stages, especially stage 3 and stage 4!

1. Start coding!

Reference Solution

To help you understand the proper behaviour of the game, we have provided a reference implementation. If you have any questions about the behaviour of your assignment, you can check by trying it in the reference implementation.

To run the reference implementation, use the following command:

$ 1091 cs_flowers

About the Starter Code

The provided starter code has done some setup for you. This is explained below.

Before the main function, the starter code has:

1. Imported the standard input/output library.

2. Defined some initial #define 's and enums.

3. Defined the struct(s) described above.

In the main function, the starter code:

1. Creates a 2D array of struct tile s called map .

2. Initialises this map with some default values.

3         

您可能感兴趣的与本文相关的镜像

TensorFlow-v2.9

TensorFlow-v2.9

TensorFlow

TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型

内容概要:本文介绍了一个基于多传感器融合的定位系统设计方案,采用GPS、里程计和电子罗盘作为定位传感器,利用扩展卡尔曼滤波(EKF)算法对多源传感器数据进行融合处理,最终输出目标的滤波后位置信息,并提供了完整的Matlab代码实现。该方法有效提升了定位精度与稳定性,尤其适用于存在单一传感器误差或信号丢失的复杂环境,如自动驾驶、移动采用GPS、里程计和电子罗盘作为定位传感器,EKF作为多传感器的融合算法,最终输出目标的滤波位置(Matlab代码实现)机器人导航等领域。文中详细阐述了各传感器的数据建模方式、状态转移与观测方程构建,以及EKF算法的具体实现步骤,具有较强的工程实践价值。; 适合人群:具备一定Matlab编程基础,熟悉传感器原理和滤波算法的高校研究生、科研人员及从事自动驾驶、机器人导航等相关领域的工程技术人员。; 使用场景及目标:①学习和掌握多传感器融合的基本理论与实现方法;②应用于移动机器人、无人车、无人机等系统的高精度定位与导航开发;③作为EKF算法在实际工程中应用的教学案例或项目参考; 阅读建议:建议读者结合Matlab代码逐行理解算法实现过程,重点关注状态预测与观测更新模块的设计逻辑,可尝试引入真实传感器数据或仿真噪声环境以验证算法鲁棒性,并进一步拓展至UKF、PF等更高级滤波算法的研究与对比。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值