OctaveCodeQuestion type
- Dominant language
- Python
- Stars
- 435
- Forks
- 124
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 14
Description
I have created a working OctaveCodeQuestion type using Oct2Py. You can see it at https://github.com/davis68/relate for now. I haven't created a PR yet for it.
- It uses `data_files` to include M-files for supporting functions.
- It has its own new image for Octave. (This is currently messy since I kept a quick update to the image around for development purposes, but once you're satisfied with the extension I will flatten those files into one.)
The following works correctly:
```
type: OctaveCodeQuestion
id: test_apply_function
value: 1
timeout: 10
title: "Checkpoint: Applying a Function"
access_rules:
add_permissions:
- see_correctness
- change_answer
prompt: |
### Applying a Function
Apply the provided function `f` to the provided array `x`. Store the result in `y`.
(`x` has the value `[ 1 2 3 4 5 ]` but is already defined and available for you.)
setup_code: |
x = [ 1 2 3 4 5 ];
initial_code: |
y = f( ___ );
names_for_user: [ x ]
names_from_user: [ y ]
data_files: [ "./question-data/f.m" ]
test_code: |
pts = 0.0
try:
import oct2py
from oct2py import Struct,Cell,StructArray
import numpy as np
oc = oct2py.Oct2Py()
test_y = oc.eval( "[ 1 2 3 4 5 ].^2;" )
print(test_y,y )
assert np.allclose( y,test_y )
pts = 1.0
except NameError:
feedback.finish( 0.0,'Something is wrong. Have you created `y`?' )
except AssertionError:
feedback.finish( 0.0,'Something is wrong. Have you used `f` on `x` to obtain `y`?' )
if np.isclose( pts,1.0 ):
feedback.finish( pts,'Success!' )
else:
feedback.finish( pts,'Keep trying. If you get stuck, please ask a TA for help on Piazza or office hours.' )
correct_code: |
y = f(x);
```
What additional documentation and tests would you like to see as part of the PR?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the OctaveCodeQuestion implementation in the linked relate repository and the supplied working example, including its Oct2Py use, data_files support, and Octave image. Identify the corresponding RELATE entry points, then add the requested documentation and tests so the new question type and image behavior are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- backend, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100