Skip to content

Instantly share code, notes, and snippets.

View b-adams's full-sized avatar

Prof. Bryant E Adams b-adams

  • Wells College
  • Aurora NY
View GitHub Profile
@b-adams
b-adams / main.m
Last active December 11, 2015 07:28
NSLog demo code for cs132sp13
/**
@file main.m
@author Prof. Adams
@date 2013 01 18
*/
#import <Foundation/Foundation.h>
/**
@brief Entry point for the program - sets up objects and puts everything in motion
$ clang cs131_test_final_problem_1_lforce.c
$ ./a.out
Welcome to Nim
How many piles would you like to use? The number is usually 3, but this version allows up to ten.3
How many players will be in this game? No more than ten can play.Cannot be less than zero.
@b-adams
b-adams / Problem.md
Created December 10, 2012 19:39
L-Force Feedback 121012

Sorry I am sending so many messages, but I have a piece of code that is annoying me beyond words to describe.

I have been working on making things like the number of players, number of slots, and beans per slot adjustable, then I am going to move on to enforce game rules.

But the code that is getting in my way is the fact that I cannot make the array's values change.

@b-adams
b-adams / demo.pep
Created December 9, 2012 03:40
cs225fa12 2d array passing and access
;Function `demo` ****************************************
;void demo()
;{
; int row;
; int col;
; char grid[64];
; int index;
; for(index=0; index<64; index++)
; {
; grid[index] = 'a'+index;
@b-adams
b-adams / Instructions.md
Created December 5, 2012 02:07
cs131fa12 Final Program starter

Your Goal

Your goal is pretty simply stated:

Demonstrate the extent of what you've learned in the class by creating the most flexible, feature-rich, readable implementation of the game of Nim that you can.

On the D- side

It's possible to make a basic working game of Nim (where the players have to enforce some of the rules) in 20 lines of C code, using only a few of the tools we've introduced (variable declaration, arithmetic, assignment, printf, scanf, and while loops). In fact, just such code is provided to you as a sample you may start from (see below)

If the documentation and code style (formatting, comments, magic numbers, naming) aren't horrible, that'd be enough for a bare minimum passing grade.

@b-adams
b-adams / 121102_indexed.pep
Created November 2, 2012 15:24
CS225 Global index addressing with non-byte sized data values
BR main
foo: .block 12 ;blah #2d6a
;bar: .block 12 ;blah #1c12a
;baz: .block 6 ;blah #2h3a
;bat: .block 6 ;blah #2d3a
;on cheat sheet, index would be blue
index: .equate 0 ;local variable #2d for loop control
;on cheat sheet, frame would be green
frame: .equate 2 ;size of main's local frame
@b-adams
b-adams / multProc.pep
Created October 28, 2012 22:01
Multiplication function
-------------------------------------------------------------------------------
Object
Addr code Symbol Mnemon Operand Comment
-------------------------------------------------------------------------------
0000 04002B BR main
mainFram:.EQUATE 6 ;Size of main's local variables
en: .EQUATE 0 ;main local variable #2d
em: .EQUATE 2 ;main local variable #2d
prod: .EQUATE 4 ;main local vairbale #2d
@b-adams
b-adams / Readme.md
Created October 28, 2012 21:17
CS225 Multiplication notes
@b-adams
b-adams / fibo.pep
Created October 26, 2012 06:58
CS225 recursive function
-------------------------------------------------------------------------------
Object
Addr code Symbol Mnemon Operand Comment
-------------------------------------------------------------------------------
;Example function with arguments and return value
;int factorial(int n)
;finds the nth fibonacci number
; fibF(0)=fibF(1)=1
; fibF(n) = fibF(n-1)+fibF(n-2)
@b-adams
b-adams / cs225_121022.pep
Created October 22, 2012 15:23
Loop in loop for triangle star
Br main
LCOut: .block 2 ;global variable #2d
LCIn: .block 2 ;global variable #2d
UserInPt: .block 2 ;global variable #2d
msg1: .ASCII "Please enter a number (of stars wide):\x00" ;Don't forget the string terminator!
;Welcome user, get input, descend into outer loop
main: NOP0
STRO msg1,d