TEST
rqcker / test Goto Github PK
View Code? Open in Web Editor NEWA test repo for my GIT @Rqcker
License: MIT License
A test repo for my GIT @Rqcker
License: MIT License
TEST
We have an existing python script that exercises Audacity. It currently needs fixing, because Audacity has moved on since it was originally written, several years ago. After that making it more flexible and more useful for generating images for our manual - its main purpose - would be good. There is plenty of scopes to extend the project to increase the range of what is tested and improve on the image generation.
Requires C++ and some python. Project is easy if restricted to fixes and a few new tests of the same kind. It becomes medium if improved flexibility is added.
Required: Diagnose where/why the script fails and fix that. done.
Required: Some improvement to scripting.
Desired: Review what images in the manual can't be produced automatically by the script yet, and address some of these.
Proposal Details
Title: Python Scripting in Audacity
Category: enhancement
Abstract:
In this project, I will focus on solving known problems in python scripting. And add some functions appropriately to improve the function, the detailed information is as follows.
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
/* Constants */
#define COL 3
#define LEN 3
/* Global variables */
static const int colors = COL;
static const int seqlen = LEN;
static char* color_names[] = { "red", "green", "blue" };
static int* theSeq = NULL;
/* initialise the secret sequence; by default it should be a random sequence, with -s use that sequence */
void initSeq() {
// @ Junhao Song
/* Test Part
int x,y,z;
srand(time(NULL)); // set random seed with machine time
x=rand()%3+1; // generate 3 random numbers
do
{
y=rand()%3+1;
} while (y==x);
do
{
z=rand()%3+1;
} while (z==x||z==y); // the 3 random numbers set are different from each other
*/
srand(time(NULL)); // set random seed with machine time
for(int i=0;i<seqlen;i++)
{
color_names[i]=rand()%colors+1; // generate 3 random numbers
}
}
/* display the sequence on the terminal window, using the format from the sample run above */
void showSeq(int *seq) {
// @ Junhao Song
for(int i=0;i<seqlen;i++)
{
seq=color_names[i]; // pointer to store element which in the array[]
printf(" %d ",seq); // print the random number
}
}
int main()
{
int *test=0;
initSeq();
showSeq(test);
}
By Testing @Rqcker
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
//#include <unistd.h>
#include <errno.h>
#include <string.h>
#include<time.h>
#include <windows.h>
/* Constants */
#define COL 3
#define LEN 3
/* Global variables */
int x;
int y;
int z;
static const int colors = COL;
static const int seqlen = LEN;
static char* color_names[] = { "red", "green", "blue" };
static int* theSeq = NULL;
/* Aux functions */
/* initialise the secret sequence; by default it should be a random sequence, with -s use that sequence */
void initSeq() {
srand(time(NULL));//�û���ʱ�������������
x = rand() % 6 + 1;//����6���������
do
{
y = rand() % 6 + 1;
} while (y == x);
do
{
z = rand() % 6 + 1;
} while (z == x || z == y);
/* COMPLETE the code here */
}
/* display the sequence on the terminal window, using the format from the sample run above */
void showSeq(int seq) {
fprintf(stderr, "secret sequence is %d %d %d\n", x, y, z);
/ COMPLETE the code here */
}
/* counts how many entries in seq2 match entries in seq1 /
/ returns exact and approximate matches */
int countMatches(int *seq1, int seq2) {
/ COMPLETE the code here */
}
/* show the results from calling countMatches on seq1 and seq1 /
void showMatches(int code, / only for debugging */ int * seq1, int seq2) {
/ COMPLETE the code here */
}
/* read a guess sequence fron stdin and store the values in arr */
void readString(int arr) {
/ COMPLETE the code here */
}
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
int main(int argc, char *argv) {
/ DEFINE your variables here /
int found = 0;
srand(time(NULL));//�û���ʱ�������������
x = rand() % 6 + 1;//����6���������
do
{
y = rand() % 6 + 1;
} while (y == x);
do
{
z = rand() % 6 + 1;
} while (z == x || z == y);
/ COMPLETE the code here */
// +++++ main loop
int attempts = 1;
int a,b,c;
int i = 0, j = 0;
printf_s("Contents of the sequence (of length 3)%d,%d,%d\n ", x, y, z);
while (!found) {
printf_s("Input seq (len 3):");
scanf_s("%d %d %d", &a,&b, &c);
if (a == x)
i++;
if (b == y)
i++;
if (c == z)
i++; //Determine the number of correct positions
if (a != x && (x == b || x == c))
j++;
if (b != y && (y == a || y == c))
j++;
if (c != z && (z == a || z == b))
j++; //Determine the error position and correct number
printf_s("The correct position and value are %d, The correct value is in the wrong position are %d\n", i, j);
if (i == 3)//Completely deduce the situation return the answer, feedback the number of reasoning, break out of the loop
{
found = 1;
break;
}
attempts++;//������һ
i = 0;
j = 0;//Judge the number of correct positions and determine the number of wrong positions and correct values
Sleep(3000);
printf_s("After 3 seconds of punishment\n");
}
if (found) {
printf_s("\nSUCCESS after %d iterations; secret sequence is %d %d %d \n", attempts, a, b, c);
}
else {
printf_s("\nGame finished in %d moves.\n", attempts);
}
return 0;
}
`@ Used the CPUlator to run and debug your code: https://cpulator.01xz.net/?sys=arm-de1soc&d_audio=48000
@ Note, that the CPUlator simulates a DE1-SoC device, and here you should use the HEX displays to show the numbers
@ See the Tutorials on LED, Button, and HEX displays in the F28HS course (Weeks 8 and 9)
@ This ARM Assembler code should implement a matching function, for use in MasterMind program, as
@ described in the CW3 specification. It should produce as output 2 numbers, the first for the
@ exact matches (peg of right colour and in right position) and approximate matches (peg of right
@ color but not in right position). Make sure to count each peg just once!
@ Example (first sequence is secret, second sequence is guess):
@ 1 2 1
@ 3 1 3 ==> 0 1
@ Display the result as two digits on the two rightmost HEX displays, from left to right
@
@ -----------------------------------------------------------------------------
.text
.global main
main:
LDR R2, =secret @ pointer to secret sequence
LDR R3, =guess @ pointer to guess sequence
@ you probably need to initialise more values here
@ ... COMPLETE THE CODING BY ADDING YOUR CODE HERE, you may want to use sub-routines to structure your code
exit: @mov R0, R4 @ load result to output register
MOV R7, #1 @ load system call code
SWI 0 @ return this value
@ =============================================================================
.data
@ constants about the basic setup of the game: length of sequence and number of colors
.equ LEN, 3
.equ COL, 3
.equ NAN1, 8
.equ NAN2, 9
@ constants needed to interface with external devices
.equ BUTTONBASE, 0xFF200050
.equ HEXBASE, 0xFF200020
.equ BUTTON_NO, 1
@ you probably want to define a table here, encoding the display of digits on the HEX display
.align 1
digits:
.byte 0b0111111 @ 0
@ ... COMPLETE THIS TABLE ...
@ INPUT DATA for the matching function
.align 4
secret: .word 1
.word 2
.word 1
.align 4
guess: .word 3
.word 1
.word 3
@ Not strictly necessary, but can be used to test the result
@ Expect Answer: 0 1
.align 4
expect: .byte 0
.byte 1
.align 4
secret1: .word 1
.word 2
.word 3
.align 4
guess1: .word 1
.word 1
.word 2
@ Not strictly necessary, but can be used to test the result
@ Expect Answer: 1 1
.align 4
expect1: .byte 1
.byte 1
.align 4
secret2: .word 2
.word 3
.word 2
.align 4
guess2: .word 3
.word 3
.word 1
@ Not strictly necessary, but can be used to test the result
@ Expect Answer: 1 0
.align 4
expect2: .byte 1
.byte 0
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.